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

Public Member Functions

 Vector (const std::vector< T > &a_vec, const std::string &a_T)
 
virtual ~Vector ()
 
- Public Member Functions inherited from tools::istorable
virtual ~istorable ()
 

Protected Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual const std::string & store_cls () const
 
virtual bool visit (iobj_const_visitor &a_v) const
 

Static Protected Member Functions

static bool s_visit (const istorable &a_o, iobj_const_visitor &a_v)
 

Protected Attributes

const std::vector< T > & m_vec
 
std::string m_T
 

Detailed Description

template<class T>
class tools::osc::Vector< T >

Definition at line 199 of file osc_streamers.

Constructor & Destructor Documentation

◆ Vector()

template<class T >
tools::osc::Vector< T >::Vector ( const std::vector< T > &  a_vec,
const std::string &  a_T 
)
inline

Definition at line 236 of file osc_streamers.

237  :m_vec(a_vec),m_T(a_T){}

◆ ~Vector()

template<class T >
virtual tools::osc::Vector< T >::~Vector ( )
inlinevirtual

Definition at line 238 of file osc_streamers.

238 {}

Member Function Documentation

◆ cast()

template<class T >
virtual void* tools::osc::Vector< T >::cast ( const std::string &  a_class) const
inlineprotectedvirtual

Implements tools::istorable.

Definition at line 203 of file osc_streamers.

203  {
204  if(void* p = cmp_cast<Vector>(this,a_class)) return p;
205  return 0;
206  }

◆ s_visit()

template<class T >
static bool tools::osc::Vector< T >::s_visit ( const istorable a_o,
iobj_const_visitor a_v 
)
inlinestaticprotected

Definition at line 230 of file osc_streamers.

230  {
231  const Vector* local = safe_cast<istorable,Vector>(a_o);
232  if(!local) return false;
233  return local->Vector<T>::visit(a_v); //IMPORTANT : have Vector::
234  }

◆ store_cls()

template<class T >
virtual const std::string& tools::osc::Vector< T >::store_cls ( ) const
inlineprotectedvirtual

Implements tools::istorable.

Definition at line 207 of file osc_streamers.

207  {
208  static const std::string s_v("BatchLab::Vector<"+m_T+">");
209  return s_v;
210  }

◆ visit()

template<class T >
virtual bool tools::osc::Vector< T >::visit ( iobj_const_visitor a_v) const
inlineprotectedvirtual

Implements tools::istorable.

Definition at line 211 of file osc_streamers.

211  {
212  if(!a_v.begin(*this,Vector<T>::store_cls(),Vector<T>::s_visit)) return false;
213 
214  int version = 1;
215  if(!a_v.visit("fVersion",version)) return false;
216 
217  unsigned int number = (unsigned int)m_vec.size();
218  if(!a_v.visit("fSize",number)) return false;
219 
220  std::string stmp;
221  for(unsigned int index=0;index<number;index++) {
222  const T& elem = m_vec[index];
223  if(!num2s(index,stmp)) return false;
224  if(!a_v.visit(stmp,elem)) return false;
225  }
226 
227  if(!a_v.end(*this)) return false;
228  return true;
229  }

Member Data Documentation

◆ m_T

template<class T >
std::string tools::osc::Vector< T >::m_T
protected

Definition at line 245 of file osc_streamers.

◆ m_vec

template<class T >
const std::vector<T>& tools::osc::Vector< T >::m_vec
protected

Definition at line 244 of file osc_streamers.


The documentation for this class was generated from the following file:
tools::osc::Vector::s_visit
static bool s_visit(const istorable &a_o, iobj_const_visitor &a_v)
Definition: osc_streamers:230
tools::osc::Vector::m_T
std::string m_T
Definition: osc_streamers:245
tools::version
unsigned int version()
Definition: version:14
tools::osc::Vector::Vector
Vector(const std::vector< T > &a_vec, const std::string &a_T)
Definition: osc_streamers:236
tools::osc::Vector::m_vec
const std::vector< T > & m_vec
Definition: osc_streamers:244
tools::osc::Vector::store_cls
virtual const std::string & store_cls() const
Definition: osc_streamers:207
tools::num2s
bool num2s(unsigned short a_value, std::string &a_s)
Definition: num2s:26