g4tools  5.4.0
Public Member Functions | Static Public Member Functions | List of all members
tools::rroot::stl_vector_vector< T > Class Template Reference
Inheritance diagram for tools::rroot::stl_vector_vector< T >:
Inheritance graph
[legend]
Collaboration diagram for tools::rroot::stl_vector_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_vector ()
 
virtual ~stl_vector_vector ()
 
 stl_vector_vector (const stl_vector_vector &a_from)
 
stl_vector_vectoroperator= (const stl_vector_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_vector< T >

Definition at line 99 of file stl_vector.

Constructor & Destructor Documentation

◆ stl_vector_vector() [1/2]

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

Definition at line 167 of file stl_vector.

167  {
168 #ifdef TOOLS_MEM
169  mem::increment(s_class().c_str());
170 #endif
171  }

◆ ~stl_vector_vector()

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

Definition at line 172 of file stl_vector.

172  {
173 #ifdef TOOLS_MEM
174  mem::decrement(s_class().c_str());
175 #endif
176  }

◆ stl_vector_vector() [2/2]

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

Definition at line 178 of file stl_vector.

179  :iro(a_from)
180  ,std::vector< std::vector<T> >(a_from)
181  {
182 #ifdef TOOLS_MEM
183  mem::increment(s_class().c_str());
184 #endif
185  }

Member Function Documentation

◆ cast() [1/2]

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

Implements tools::rroot::iro.

Definition at line 121 of file stl_vector.

121  {
122  if(void* p = cmp_cast< stl_vector_vector<T> >(this,a_class)) {return p;}
123  return 0;
124  }

◆ cast() [2/2]

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

Implements tools::rroot::iro.

Definition at line 114 of file stl_vector.

114  {
115  if(void* p=cmp_cast< stl_vector_vector<T> >(this,a_class)) return p;
116  return 0;
117  }

◆ copy()

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

Implements tools::rroot::iro.

Definition at line 125 of file stl_vector.

125 {return new stl_vector_vector<T>(*this);}

◆ id_class()

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

Definition at line 120 of file stl_vector.

120 {return stl_vector_vector_cid()+_cid(T());}

◆ operator=()

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

Definition at line 186 of file stl_vector.

186  {
187  std::vector< std::vector<T> >::operator=(a_from);
188  return *this;
189  }

◆ s_class()

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

Definition at line 108 of file stl_vector.

108  {
109  static const std::string s_v
110  ("tools::rroot::stl_vector_vector<"+stype(T())+">");
111  return s_v;
112  }

◆ s_cls()

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

Implements tools::rroot::iro.

Definition at line 118 of file stl_vector.

118 {return s_class();}

◆ stream()

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

Implements tools::rroot::iro.

Definition at line 126 of file stl_vector.

126  {
127  typedef typename std::vector<T> vec_t;
128  std::vector<vec_t>::clear();
129 
130  short v;
131  unsigned int s, c;
132  if(!a_buffer.read_version(v,s,c)) return false;
133 
134  //::printf("debug : stl_vector_vector::stream<%s> : version %d, byte count %d\n",stype(T()).c_str(),v,c);
135 
136  unsigned int vecn;
137  if(!a_buffer.read(vecn)) return false;
138 
139  std::vector<vec_t>::resize(vecn);
140  //::printf("debug : stl_vector_vector : %d\n",vecn);
141  for(unsigned int veci=0;veci<vecn;veci++) {
142  vec_t& elem = std::vector<vec_t>::operator[](veci);
143 
144  unsigned int num;
145  if(!a_buffer.read(num)) {
146  std::vector<vec_t>::clear();
147  return false;
148  }
149  //::printf("debug : stl_vector_vector : index %d num %d\n",veci,num);
150  if(num) {
151  T* vec = new T[num];
152  if(!a_buffer.read_fast_array<T>(vec,num)) {
153  delete [] vec;
154  std::vector<vec_t>::clear();
155  return false;
156  }
157  elem.resize(num);
158  T* pos = vec;
159  for(unsigned int index=0;index<num;index++,pos++) elem[index] = *pos;
160  delete [] vec;
161  }
162  }
163 
164  return a_buffer.check_byte_count(s,c,s_store_class());
165  }

The documentation for this class was generated from the following file:
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::rroot::stl_vector_vector_cid
cid stl_vector_vector_cid()
Definition: cids:48
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
tools::rroot::stl_vector_vector::s_class
static const std::string & s_class()
Definition: stl_vector:108