g4tools  5.4.0
Public Member Functions | Static Public Member Functions | List of all members
tools::rroot::stl_vector< T > Class Template Reference
Inheritance diagram for tools::rroot::stl_vector< T >:
Inheritance graph
[legend]
Collaboration diagram for tools::rroot::stl_vector< T >:
Collaboration graph
[legend]

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const
 
virtual void * cast (cid a_class) const
 
virtual irocopy () const
 
virtual bool stream (buffer &a_buffer)
 
 stl_vector ()
 
virtual ~stl_vector ()
 
 stl_vector (const stl_vector &a_from)
 
stl_vectoroperator= (const stl_vector &a_from)
 
- Public Member Functions inherited from tools::rroot::iro
virtual ~iro ()
 

Static Public Member Functions

static const std::string & s_class ()
 
static cid id_class ()
 

Detailed Description

template<class T>
class tools::rroot::stl_vector< T >

Definition at line 18 of file stl_vector.

Constructor & Destructor Documentation

◆ stl_vector() [1/2]

template<class T >
tools::rroot::stl_vector< T >::stl_vector ( )
inline

Definition at line 73 of file stl_vector.

73  {
74 #ifdef TOOLS_MEM
75  mem::increment(s_class().c_str());
76 #endif
77  }

◆ ~stl_vector()

template<class T >
virtual tools::rroot::stl_vector< T >::~stl_vector ( )
inlinevirtual

Definition at line 78 of file stl_vector.

78  {
79 #ifdef TOOLS_MEM
80  mem::decrement(s_class().c_str());
81 #endif
82  }

◆ stl_vector() [2/2]

template<class T >
tools::rroot::stl_vector< T >::stl_vector ( const stl_vector< T > &  a_from)
inline

Definition at line 84 of file stl_vector.

85  :iro(a_from)
86  ,std::vector<T>(a_from)
87  {
88 #ifdef TOOLS_MEM
89  mem::increment(s_class().c_str());
90 #endif
91  }

Member Function Documentation

◆ cast() [1/2]

template<class T >
virtual void* tools::rroot::stl_vector< T >::cast ( cid  a_class) const
inlinevirtual

Implements tools::rroot::iro.

Definition at line 36 of file stl_vector.

36  {
37  if(void* p = cmp_cast< stl_vector<T> >(this,a_class)) {return p;}
38  return 0;
39  }

◆ cast() [2/2]

template<class T >
virtual void* tools::rroot::stl_vector< T >::cast ( const std::string &  a_class) const
inlinevirtual

Implements tools::rroot::iro.

Definition at line 29 of file stl_vector.

29  {
30  if(void* p = cmp_cast< stl_vector<T> >(this,a_class)) return p;
31  return 0;
32  }

◆ copy()

template<class T >
virtual iro* tools::rroot::stl_vector< T >::copy ( ) const
inlinevirtual

Implements tools::rroot::iro.

Definition at line 40 of file stl_vector.

40 {return new stl_vector<T>(*this);}

◆ id_class()

template<class T >
static cid tools::rroot::stl_vector< T >::id_class ( )
inlinestatic

Definition at line 35 of file stl_vector.

35 {return stl_vector_cid()+_cid(T());}

◆ operator=()

template<class T >
stl_vector& tools::rroot::stl_vector< T >::operator= ( const stl_vector< T > &  a_from)
inline

Definition at line 92 of file stl_vector.

92  {
93  std::vector<T>::operator=(a_from);
94  return *this;
95  }

◆ s_class()

template<class T >
static const std::string& tools::rroot::stl_vector< T >::s_class ( )
inlinestatic

Definition at line 24 of file stl_vector.

24  {
25  static const std::string s_v("tools::rroot::stl_vector<"+stype(T())+">");
26  return s_v;
27  }

◆ s_cls()

template<class T >
virtual const std::string& tools::rroot::stl_vector< T >::s_cls ( ) const
inlinevirtual

Implements tools::rroot::iro.

Definition at line 33 of file stl_vector.

33 {return s_class();}

◆ stream()

template<class T >
virtual bool tools::rroot::stl_vector< T >::stream ( buffer a_buffer)
inlinevirtual

Implements tools::rroot::iro.

Definition at line 41 of file stl_vector.

41  {
42  std::vector<T>::clear();
43 
44  short v;
45  unsigned int s, c;
46  if(!a_buffer.read_version(v,s,c)) return false;
47 
48  //::printf("debug : stl_vector::stream<%s> : version %d, byte count %d\n",
49  // stype(T()).c_str(),v,c);
50 
51  unsigned int num;
52  if(!a_buffer.read(num)) return false;
53 
54  //::printf("debug : stl_vector : %d\n",num);
55 
56  if(num) {
57  T* vec = new T[num];
58  if(!a_buffer.read_fast_array<T>(vec,num)) {
59  delete [] vec;
60  return false;
61  }
62  std::vector<T>::resize(num);
63  T* pos = vec;
64  for(unsigned int index=0;index<num;index++,pos++) {
65  std::vector<T>::operator[](index) = *pos;
66  }
67  delete [] vec;
68  }
69 
70  return a_buffer.check_byte_count(s,c,s_store_class());
71  }

The documentation for this class was generated from the following file:
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::rroot::stl_vector_cid
cid stl_vector_cid()
Definition: cids:47
tools::rroot::stl_vector::s_class
static const std::string & s_class()
Definition: stl_vector:24
tools::cmp_cast
void * cmp_cast(const TO *a_this, const std::string &a_class)
Definition: scast:15
tools::stype
const std::string & stype(const mat4f &)
Definition: mat4f:73