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

Public Types

typedef T entry_t
 

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual base_colcopy () const
 
virtual bool add ()
 
virtual bool reset ()
 
virtual uint64 num_elems () const
 
virtual const std::string & aida_type () const
 
virtual bool s_default_value (std::string &a_s) const
 
virtual bool s_value (std::string &a_s) const
 
virtual bool s_fill (const std::string &a_s)
 
virtual void set_user_variable (void *a_user_var)
 
 aida_col (std::ostream &a_out, const std::string &a_name, const T &a_def)
 
virtual ~aida_col ()
 
 aida_col (const aida_col &a_from)
 
aida_coloperator= (const aida_col &a_from)
 
bool fill (const T &a_value)
 
bool get_entry (T &a_v) const
 
virtual bool fetch_entry () const
 
- Public Member Functions inherited from tools::aida::aida_base_col
 aida_base_col (std::ostream &a_out, const std::string &a_name)
 
virtual ~aida_base_col ()
 
 aida_base_col (const aida_base_col &a_from)
 
aida_base_coloperator= (const aida_base_col &a_from)
 
- Public Member Functions inherited from tools::aida::base_col
virtual ~base_col ()
 
const std::string & name () const
 
void set_index (uint64 a_index)
 

Static Public Member Functions

static const std::string & s_class ()
 
- Static Public Member Functions inherited from tools::aida::aida_base_col
static const std::string & s_class ()
 
- Static Public Member Functions inherited from tools::aida::base_col
static const std::string & s_class ()
 

Protected Attributes

std::vector< T > m_data
 
m_default
 
m_tmp
 
T * m_user_var
 
- Protected Attributes inherited from tools::aida::base_col
std::ostream & m_out
 
std::string m_name
 
uint64 m_index
 

Additional Inherited Members

- Protected Member Functions inherited from tools::aida::base_col
 base_col (std::ostream &a_out, const std::string &a_name)
 
 base_col (const base_col &a_from)
 
base_coloperator= (const base_col &a_from)
 

Detailed Description

template<class T>
class tools::aida::aida_col< T >

Definition at line 392 of file aida_ntuple.

Member Typedef Documentation

◆ entry_t

template<class T >
typedef T tools::aida::aida_col< T >::entry_t

Definition at line 394 of file aida_ntuple.

Constructor & Destructor Documentation

◆ aida_col() [1/2]

template<class T >
tools::aida::aida_col< T >::aida_col ( std::ostream &  a_out,
const std::string &  a_name,
const T &  a_def 
)
inline

Definition at line 440 of file aida_ntuple.

441  :aida_base_col(a_out,a_name)
442  ,m_default(a_def)
443  ,m_tmp(a_def)
444  ,m_user_var(0) //not owner
445  {}

◆ ~aida_col()

template<class T >
virtual tools::aida::aida_col< T >::~aida_col ( )
inlinevirtual

Definition at line 447 of file aida_ntuple.

447 {}

◆ aida_col() [2/2]

template<class T >
tools::aida::aida_col< T >::aida_col ( const aida_col< T > &  a_from)
inline

Definition at line 449 of file aida_ntuple.

450  :aida_base_col(a_from)
451  ,m_data(a_from.m_data)
452  ,m_default(a_from.m_default)
453  ,m_tmp(a_from.m_tmp)
454  ,m_user_var(a_from.m_user_var)
455  {}

Member Function Documentation

◆ add()

template<class T >
virtual bool tools::aida::aida_col< T >::add ( )
inlinevirtual

Implements tools::aida::base_col.

Definition at line 406 of file aida_ntuple.

406 {m_data.push_back(m_tmp);m_tmp = m_default;return true;}

◆ aida_type()

template<class T >
virtual const std::string& tools::aida::aida_col< T >::aida_type ( ) const
inlinevirtual

Implements tools::aida::aida_base_col.

Definition at line 415 of file aida_ntuple.

415 {return s_aida_type(T());}

◆ cast()

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

Reimplemented from tools::aida::aida_base_col.

Definition at line 400 of file aida_ntuple.

400  {
401  if(void* p = cmp_cast< aida_col<T> >(this,a_class)) {return p;}
402  return aida_base_col::cast(a_class);
403  }

◆ copy()

template<class T >
virtual base_col* tools::aida::aida_col< T >::copy ( ) const
inlinevirtual

Implements tools::aida::base_col.

Definition at line 405 of file aida_ntuple.

405 {return new aida_col(*this);}

◆ fetch_entry()

template<class T >
virtual bool tools::aida::aida_col< T >::fetch_entry ( ) const
inlinevirtual

Implements tools::aida::base_col.

Definition at line 481 of file aida_ntuple.

481  {
482  //NOTE : it is ok to have a NULL m_user_var.
483  if(m_index>=m_data.size()) {
484  m_out << s_class() << "::get_entry :"
485  << " bad index " << m_index
486  << ". Vec size is " << m_data.size() << "."
487  << "."
488  << std::endl;
489  if(m_user_var) *m_user_var = T();
490  return false;
491  }
492  typedef typename std::vector<T>::size_type sz_t;
493  if(m_user_var) *m_user_var = m_data[sz_t(m_index)];
494  return true;
495  }

◆ fill()

template<class T >
bool tools::aida::aida_col< T >::fill ( const T &  a_value)
inline

Definition at line 466 of file aida_ntuple.

466 {m_tmp = a_value;return true;}

◆ get_entry()

template<class T >
bool tools::aida::aida_col< T >::get_entry ( T &  a_v) const
inline

Definition at line 467 of file aida_ntuple.

467  {
468  if(m_index>=m_data.size()) {
469  m_out << s_class() << "::get_entry :"
470  << " bad index " << m_index
471  << ". Vec size is " << m_data.size() << "."
472  << "."
473  << std::endl;
474  a_v = T();
475  return false;
476  }
477  typedef typename std::vector<T>::size_type sz_t;
478  a_v = m_data[sz_t(m_index)];
479  return true;
480  }

◆ num_elems()

template<class T >
virtual uint64 tools::aida::aida_col< T >::num_elems ( ) const
inlinevirtual

Implements tools::aida::base_col.

Definition at line 413 of file aida_ntuple.

413 {return m_data.size();}

◆ operator=()

template<class T >
aida_col& tools::aida::aida_col< T >::operator= ( const aida_col< T > &  a_from)
inline

Definition at line 456 of file aida_ntuple.

456  {
457  aida_base_col::operator=(a_from);
458  if(&a_from==this) return *this;
459  m_data = a_from.m_data;
460  m_default = a_from.m_default;
461  m_tmp = a_from.m_tmp;
462  m_user_var = a_from.m_user_var;
463  return *this;
464  }

◆ reset()

template<class T >
virtual bool tools::aida::aida_col< T >::reset ( )
inlinevirtual

Implements tools::aida::base_col.

Definition at line 407 of file aida_ntuple.

407  {
408  m_data.clear();
409  m_index = 0;
410  m_tmp = m_default;
411  return true;
412  }

◆ s_class()

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

Definition at line 396 of file aida_ntuple.

396  {
397  static const std::string s_v("tools::aida::aida_col<"+stype(T())+">");
398  return s_v;
399  }

◆ s_default_value()

template<class T >
virtual bool tools::aida::aida_col< T >::s_default_value ( std::string &  a_s) const
inlinevirtual

Implements tools::aida::aida_base_col.

Definition at line 416 of file aida_ntuple.

416  {
417  a_s = tos(m_default);
418  return true;
419  }

◆ s_fill()

template<class T >
virtual bool tools::aida::aida_col< T >::s_fill ( const std::string &  a_s)
inlinevirtual

Implements tools::aida::aida_base_col.

Definition at line 427 of file aida_ntuple.

427  {
428  //if(!to<T>(a_s,m_tmp)) {
429  if(!s__fill(a_s,m_tmp)) {
430  m_out << s_class() << "::fill :"
431  << " can't convert " << sout(a_s) << "."
432  << std::endl;
433  return false;
434  }
435  return true;
436  }

◆ s_value()

template<class T >
virtual bool tools::aida::aida_col< T >::s_value ( std::string &  a_s) const
inlinevirtual

Implements tools::aida::aida_base_col.

Definition at line 420 of file aida_ntuple.

420  {
421  typedef typename std::vector<T>::size_type sz_t;
422  a_s = tos(m_data[sz_t(m_index)]);
423  return true;
424  }

◆ set_user_variable()

template<class T >
virtual void tools::aida::aida_col< T >::set_user_variable ( void *  a_user_var)
inlinevirtual

Implements tools::aida::base_col.

Definition at line 438 of file aida_ntuple.

438 {m_user_var = (T*)a_user_var;} //not owner.

Member Data Documentation

◆ m_data

template<class T >
std::vector<T> tools::aida::aida_col< T >::m_data
protected

Definition at line 497 of file aida_ntuple.

◆ m_default

template<class T >
T tools::aida::aida_col< T >::m_default
protected

Definition at line 498 of file aida_ntuple.

◆ m_tmp

template<class T >
T tools::aida::aida_col< T >::m_tmp
protected

Definition at line 499 of file aida_ntuple.

◆ m_user_var

template<class T >
T* tools::aida::aida_col< T >::m_user_var
protected

Definition at line 500 of file aida_ntuple.


The documentation for this class was generated from the following file:
tools::aida::aida_base_col::aida_base_col
aida_base_col(std::ostream &a_out, const std::string &a_name)
Definition: aida_ntuple:333
tools::aida::aida_col::m_data
std::vector< T > m_data
Definition: aida_ntuple:497
tools::tos
bool tos(const rotf &a_v, std::string &a_s)
Definition: rotf:68
tools::aida::base_col::m_out
std::ostream & m_out
Definition: aida_ntuple:80
tools::aida::aida_col::aida_col
aida_col(std::ostream &a_out, const std::string &a_name, const T &a_def)
Definition: aida_ntuple:440
tools::aida::aida_base_col::cast
virtual void * cast(const std::string &a_class) const
Definition: aida_ntuple:323
tools::aida::aida_base_col::operator=
aida_base_col & operator=(const aida_base_col &a_from)
Definition: aida_ntuple:341
tools::aida::aida_col::s_class
static const std::string & s_class()
Definition: aida_ntuple:396
tools::aida::aida_col::m_user_var
T * m_user_var
Definition: aida_ntuple:500
tools::aida::s__fill
bool s__fill(const std::string &a_s, std::string &a_v)
Definition: aida_ntuple:347
tools::cmp_cast
void * cmp_cast(const TO *a_this, const std::string &a_class)
Definition: scast:15
tools::aida::base_col::m_index
uint64 m_index
Definition: aida_ntuple:82
tools::aida::aida_col::m_tmp
T m_tmp
Definition: aida_ntuple:499
tools::aida::aida_col::m_default
T m_default
Definition: aida_ntuple:498
tools::aida::s_aida_type
const std::string & s_aida_type(short)
Definition: aida_ntuple:254
tools::stype
const std::string & stype(const mat4f &)
Definition: mat4f:73