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

Public Member Functions

virtual void * cast (cid a_class) const
 
virtual cid id_cls () const
 
virtual const std::string & name () const
 
virtual bool fetch_entry () const
 
virtual bool get_entry (T &a_v) const
 
 column_ref (ifile &a_file, branch &a_branch, LEAF &a_leaf, int64 &a_index, T &a_ref)
 
virtual ~column_ref ()
 
- Public Member Functions inherited from tools::read::icolumn< T >
virtual ~icolumn ()
 
- Public Member Functions inherited from tools::read::icol
virtual ~icol ()
 
virtual void stop ()
 

Static Public Member Functions

static cid id_class ()
 
- Static Public Member Functions inherited from tools::read::icolumn< T >
static cid id_class ()
 

Protected Member Functions

 column_ref (const column_ref &a_from)
 
column_refoperator= (const column_ref &a_from)
 
bool _fetch_entry () const
 

Protected Attributes

ifilem_file
 
branchm_branch
 
LEAF & m_leaf
 
int64m_index
 
T & m_ref
 

Additional Inherited Members

- Public Types inherited from tools::read::icolumn< T >
typedef T entry_t
 

Detailed Description

template<class T, class LEAF>
class tools::rroot::ntuple::column_ref< T, LEAF >

Definition at line 52 of file ntuple.

Constructor & Destructor Documentation

◆ column_ref() [1/2]

template<class T , class LEAF >
tools::rroot::ntuple::column_ref< T, LEAF >::column_ref ( ifile a_file,
branch a_branch,
LEAF &  a_leaf,
int64 a_index,
T &  a_ref 
)
inline

Definition at line 72 of file ntuple.

73  :m_file(a_file)
74  ,m_branch(a_branch)
75  ,m_leaf(a_leaf)
76  ,m_index(a_index) //WARNING : we keep the ref !
77  ,m_ref(a_ref)
78  {}

◆ ~column_ref()

template<class T , class LEAF >
virtual tools::rroot::ntuple::column_ref< T, LEAF >::~column_ref ( )
inlinevirtual

Definition at line 79 of file ntuple.

79 {}

◆ column_ref() [2/2]

template<class T , class LEAF >
tools::rroot::ntuple::column_ref< T, LEAF >::column_ref ( const column_ref< T, LEAF > &  a_from)
inlineprotected

Definition at line 81 of file ntuple.

82  :read::icol(a_from)
83  ,parent(a_from)
84  ,m_file(a_from.m_file)
85  ,m_branch(a_from.m_branch)
86  ,m_leaf(a_from.m_leaf)
87  ,m_index(a_from.m_index)
88  ,m_ref(a_from.m_ref)
89  {}

Member Function Documentation

◆ _fetch_entry()

template<class T , class LEAF >
bool tools::rroot::ntuple::column_ref< T, LEAF >::_fetch_entry ( ) const
inlineprotected

Definition at line 96 of file ntuple.

96  {
97  unsigned int n;
98  if(!m_branch.find_entry(m_file,uint32(m_index),n)) {m_ref = T();return false;}
99  if(!m_leaf.num_elem()) {m_ref = T();return true;} //it is ok. It may be a vector from a row_wise ntuple column.
100  typename LEAF::value_t _tmp;
101  if(!m_leaf.value(0,_tmp)) return false;
102  m_ref = T(_tmp);
103  return true;
104  }

◆ cast()

template<class T , class LEAF >
virtual void* tools::rroot::ntuple::column_ref< T, LEAF >::cast ( cid  a_class) const
inlinevirtual

Reimplemented from tools::read::icolumn< T >.

Reimplemented in tools::rroot::ntuple::column< T, LEAF >.

Definition at line 57 of file ntuple.

57  {
58  if(void* p = cmp_cast<column_ref>(this,a_class)) return p;
59  return parent::cast(a_class);
60  }

◆ fetch_entry()

template<class T , class LEAF >
virtual bool tools::rroot::ntuple::column_ref< T, LEAF >::fetch_entry ( ) const
inlinevirtual

Reimplemented from tools::read::icol.

Definition at line 65 of file ntuple.

65 {return _fetch_entry();}

◆ get_entry()

template<class T , class LEAF >
virtual bool tools::rroot::ntuple::column_ref< T, LEAF >::get_entry ( T &  a_v) const
inlinevirtual

Implements tools::read::icolumn< T >.

Definition at line 66 of file ntuple.

66  {
67  if(!_fetch_entry()) {a_v = T();return false;}
68  a_v = m_ref;
69  return true;
70  }

◆ id_class()

template<class T , class LEAF >
static cid tools::rroot::ntuple::column_ref< T, LEAF >::id_class ( )
inlinestatic

Definition at line 55 of file ntuple.

55 {return 200+_cid(T())+10000;}

◆ id_cls()

template<class T , class LEAF >
virtual cid tools::rroot::ntuple::column_ref< T, LEAF >::id_cls ( ) const
inlinevirtual

Reimplemented from tools::read::icolumn< T >.

Reimplemented in tools::rroot::ntuple::column< T, LEAF >.

Definition at line 61 of file ntuple.

61 {return id_class();}

◆ name()

template<class T , class LEAF >
virtual const std::string& tools::rroot::ntuple::column_ref< T, LEAF >::name ( ) const
inlinevirtual

Implements tools::read::icol.

Definition at line 63 of file ntuple.

63 {return m_leaf.name();}

◆ operator=()

template<class T , class LEAF >
column_ref& tools::rroot::ntuple::column_ref< T, LEAF >::operator= ( const column_ref< T, LEAF > &  a_from)
inlineprotected

Definition at line 90 of file ntuple.

90  {
91  if(&a_from==this) return *this;
92  return *this;
93  }

Member Data Documentation

◆ m_branch

template<class T , class LEAF >
branch& tools::rroot::ntuple::column_ref< T, LEAF >::m_branch
protected

Definition at line 107 of file ntuple.

◆ m_file

template<class T , class LEAF >
ifile& tools::rroot::ntuple::column_ref< T, LEAF >::m_file
protected

Definition at line 106 of file ntuple.

◆ m_index

template<class T , class LEAF >
int64& tools::rroot::ntuple::column_ref< T, LEAF >::m_index
protected

Definition at line 109 of file ntuple.

◆ m_leaf

template<class T , class LEAF >
LEAF& tools::rroot::ntuple::column_ref< T, LEAF >::m_leaf
protected

Definition at line 108 of file ntuple.

◆ m_ref

template<class T , class LEAF >
T& tools::rroot::ntuple::column_ref< T, LEAF >::m_ref
protected

Definition at line 110 of file ntuple.


The documentation for this class was generated from the following file:
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::rroot::ntuple::column_ref::m_branch
branch & m_branch
Definition: ntuple:107
tools::rroot::ntuple::column_ref::m_leaf
LEAF & m_leaf
Definition: ntuple:108
tools::rroot::ntuple::column_ref::m_file
ifile & m_file
Definition: ntuple:106
tools::read::icolumn::cast
virtual void * cast(cid a_class) const
Definition: rntuple:44
tools::rroot::ntuple::column_ref::id_class
static cid id_class()
Definition: ntuple:55
tools::rroot::branch::find_entry
virtual bool find_entry(ifile &a_file, uint64 a_entry, uint32 &a_nbytes)
Definition: branch:537
tools::rroot::ntuple::column_ref::m_index
int64 & m_index
Definition: ntuple:109
tools::rroot::ntuple::column_ref::_fetch_entry
bool _fetch_entry() const
Definition: ntuple:96
tools::rroot::ntuple::column_ref::m_ref
T & m_ref
Definition: ntuple:110
tools::uint32
unsigned int uint32
Definition: typedefs:71