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

Public Member Functions

virtual void * cast (tools::cid a_class) const
 
virtual tools::cid id_cls () const
 
virtual bool add ()
 
virtual bool fetch_entry ()
 
virtual void reset ()
 
virtual const std::string & name () const
 
virtual bool set_basket_size (size_t)
 
 std_vector_column_ref (store &a_store, pages &a_pages, bool a_write, const std::string &a_name, size_t, std::vector< T > &a_ref)
 
virtual ~std_vector_column_ref ()
 
- Public Member Functions inherited from tools::hdf5::ntuple::icol
virtual ~icol ()
 

Static Public Member Functions

static tools::cid id_class ()
 

Protected Member Functions

 std_vector_column_ref (const std_vector_column_ref &a_from)
 
std_vector_column_refoperator= (const std_vector_column_ref &a_from)
 

Protected Attributes

storem_store
 
pagesm_branch
 
bool m_write
 
std::string m_name
 
std::vector< T > & m_ref
 

Detailed Description

template<class T>
class tools::hdf5::ntuple::std_vector_column_ref< T >

Definition at line 276 of file ntuple.

Constructor & Destructor Documentation

◆ std_vector_column_ref() [1/2]

template<class T >
tools::hdf5::ntuple::std_vector_column_ref< T >::std_vector_column_ref ( store a_store,
pages a_pages,
bool  a_write,
const std::string &  a_name,
size_t  ,
std::vector< T > &  a_ref 
)
inline

Definition at line 315 of file ntuple.

318  :m_store(a_store)
319  ,m_branch(a_pages)
320  ,m_write(a_write)
321  ,m_name(a_name)
322  ,m_ref(a_ref)
323  {
324 #ifdef TOOLS_MEM
325  tools::mem::increment(s_class().c_str());
326 #endif
327  }

◆ ~std_vector_column_ref()

template<class T >
virtual tools::hdf5::ntuple::std_vector_column_ref< T >::~std_vector_column_ref ( )
inlinevirtual

Definition at line 328 of file ntuple.

328  {
329 #ifdef TOOLS_MEM
330  tools::mem::decrement(s_class().c_str());
331 #endif
332  }

◆ std_vector_column_ref() [2/2]

template<class T >
tools::hdf5::ntuple::std_vector_column_ref< T >::std_vector_column_ref ( const std_vector_column_ref< T > &  a_from)
inlineprotected

Definition at line 334 of file ntuple.

335  :icol(a_from)
336  ,m_store(a_from.m_store)
337  ,m_branch(a_from.m_branch)
338  ,m_write(a_from.m_write)
339  ,m_name(a_from.m_name)
340  ,m_ref(a_from.m_ref)
341  {}

Member Function Documentation

◆ add()

template<class T >
virtual bool tools::hdf5::ntuple::std_vector_column_ref< T >::add ( )
inlinevirtual

Implements tools::hdf5::ntuple::icol.

Definition at line 291 of file ntuple.

291  { //write.
292  if(!m_write) return false;
293  const T* _data = tools::vec_data(m_ref);
294  return m_branch.write_vlen<T>(m_ref.size(),_data);
295  }

◆ cast()

template<class T >
virtual void* tools::hdf5::ntuple::std_vector_column_ref< T >::cast ( tools::cid  a_class) const
inlinevirtual

Implements tools::hdf5::ntuple::icol.

Reimplemented in tools::hdf5::ntuple::std_vector_column< T >.

Definition at line 285 of file ntuple.

285  {
286  if(void* p = tools::cmp_cast<std_vector_column_ref>(this,a_class)) {return p;}
287  else return 0;
288  }

◆ fetch_entry()

template<class T >
virtual bool tools::hdf5::ntuple::std_vector_column_ref< T >::fetch_entry ( )
inlinevirtual

Implements tools::hdf5::ntuple::icol.

Definition at line 296 of file ntuple.

296  { //read.
297  if(m_write) return false;
298  size_t n;
299  T* _data;
300  if(!m_branch.read_vlen<T>(n,_data)) {
301  m_store.out() << "tools::hdf5::ntuple::std_vector_column_ref:fetch_entry : read_page() failed." << std::endl;
302  return false;
303  }
304  m_ref.resize(n);
305  T* dpos = _data;
306  T* pos = tools::vec_data(m_ref);
307  for(size_t index=0;index<n;index++,pos++,dpos++) *pos = *dpos;
308  delete [] _data;
309  return true;
310  }

◆ id_class()

template<class T >
static tools::cid tools::hdf5::ntuple::std_vector_column_ref< T >::id_class ( )
inlinestatic

Definition at line 284 of file ntuple.

284 {return tools::_cid_std_vector<T>()+10000;}

◆ id_cls()

template<class T >
virtual tools::cid tools::hdf5::ntuple::std_vector_column_ref< T >::id_cls ( ) const
inlinevirtual

Implements tools::hdf5::ntuple::icol.

Reimplemented in tools::hdf5::ntuple::std_vector_column< T >.

Definition at line 289 of file ntuple.

289 {return id_class();}

◆ name()

template<class T >
virtual const std::string& tools::hdf5::ntuple::std_vector_column_ref< T >::name ( ) const
inlinevirtual

Implements tools::hdf5::ntuple::icol.

Definition at line 312 of file ntuple.

312 {return m_name;}

◆ operator=()

template<class T >
std_vector_column_ref& tools::hdf5::ntuple::std_vector_column_ref< T >::operator= ( const std_vector_column_ref< T > &  a_from)
inlineprotected

Definition at line 342 of file ntuple.

342  {
343  if(&a_from==this) return *this;
344  m_name = a_from.m_name;
345  return *this;
346  }

◆ reset()

template<class T >
virtual void tools::hdf5::ntuple::std_vector_column_ref< T >::reset ( )
inlinevirtual

Implements tools::hdf5::ntuple::icol.

Definition at line 311 of file ntuple.

311 {m_branch.reset_pos();}

◆ set_basket_size()

template<class T >
virtual bool tools::hdf5::ntuple::std_vector_column_ref< T >::set_basket_size ( size_t  )
inlinevirtual

Implements tools::hdf5::ntuple::icol.

Definition at line 313 of file ntuple.

313 {return true;}

Member Data Documentation

◆ m_branch

template<class T >
pages& tools::hdf5::ntuple::std_vector_column_ref< T >::m_branch
protected

Definition at line 349 of file ntuple.

◆ m_name

template<class T >
std::string tools::hdf5::ntuple::std_vector_column_ref< T >::m_name
protected

Definition at line 351 of file ntuple.

◆ m_ref

template<class T >
std::vector<T>& tools::hdf5::ntuple::std_vector_column_ref< T >::m_ref
protected

Definition at line 352 of file ntuple.

◆ m_store

template<class T >
store& tools::hdf5::ntuple::std_vector_column_ref< T >::m_store
protected

Definition at line 348 of file ntuple.

◆ m_write

template<class T >
bool tools::hdf5::ntuple::std_vector_column_ref< T >::m_write
protected

Definition at line 350 of file ntuple.


The documentation for this class was generated from the following file:
tools::hdf5::pages::write_vlen
bool write_vlen(size_t a_size, const TYPE *a_array)
Definition: pages:155
tools::hdf5::ntuple::std_vector_column_ref::m_store
store & m_store
Definition: ntuple:348
tools::hdf5::ntuple::std_vector_column_ref::m_write
bool m_write
Definition: ntuple:350
tools::vec_data
const T * vec_data(const std::vector< T > &a_vec)
Definition: vdata:18
tools::hdf5::ntuple::std_vector_column_ref::m_branch
pages & m_branch
Definition: ntuple:349
tools::hdf5::pages::reset_pos
void reset_pos()
Definition: pages:102
tools::hdf5::store::out
std::ostream & out() const
Definition: store:154
tools::hdf5::ntuple::std_vector_column_ref::m_name
std::string m_name
Definition: ntuple:351
tools::hdf5::ntuple::std_vector_column_ref::id_class
static tools::cid id_class()
Definition: ntuple:284
tools::hdf5::ntuple::std_vector_column_ref::m_ref
std::vector< T > & m_ref
Definition: ntuple:352
tools::hdf5::pages::read_vlen
bool read_vlen(size_t &a_size, TYPE *&a_array)
Definition: pages:178