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

Public Member Functions

virtual void * cast (cid a_class) const
 
virtual cid id_cls () const
 
virtual const std::string & store_cls () const
 
virtual bool stream (buffer &a_buffer) const
 
virtual bool fill_buffer (buffer &a_buffer) const
 
 leaf_ref (std::ostream &a_out, const std::string &a_name, const T &a_ref)
 
virtual ~leaf_ref ()
 
get_max () const
 
void set_max (const T &a_value)
 
const T & variable () const
 
T & variable ()
 
- Public Member Functions inherited from tools::wroot::base_leaf
 base_leaf (std::ostream &a_out, const std::string &a_name, const std::string &a_title)
 
virtual ~base_leaf ()
 
const std::string & name () const
 
void set_title (const std::string &a_value)
 
uint32 length () const
 
void set_length (uint32 a_value)
 
void set_is_range (bool a_value)
 
- Public Member Functions inherited from tools::wroot::ibo
virtual ~ibo ()
 

Static Public Member Functions

static cid id_class ()
 
- Static Public Member Functions inherited from tools::wroot::base_leaf
static cid id_class ()
 

Protected Member Functions

 leaf_ref (const leaf_ref &a_from)
 
leaf_refoperator= (const leaf_ref &)
 
- Protected Member Functions inherited from tools::wroot::base_leaf
 base_leaf (const base_leaf &a_from)
 
base_leafoperator= (const base_leaf &)
 

Protected Attributes

m_min
 
m_max
 
const T & m_ref
 
- Protected Attributes inherited from tools::wroot::base_leaf
std::ostream & m_out
 
std::string m_name
 
std::string m_title
 
uint32 m_length
 
uint32 m_length_type
 
ibom_leaf_count
 
bool m_is_range
 

Detailed Description

template<class T>
class tools::wroot::leaf_ref< T >

Definition at line 49 of file leaf.

Constructor & Destructor Documentation

◆ leaf_ref() [1/2]

template<class T >
tools::wroot::leaf_ref< T >::leaf_ref ( std::ostream &  a_out,
const std::string &  a_name,
const T &  a_ref 
)
inline

Definition at line 80 of file leaf.

81  :parent(a_out,a_name,a_name)
82  ,m_min(T()),m_max(T())
83  ,m_ref(a_ref)
84  {
85  m_length = 1;
86  m_length_type = sizeof(T);
87  }

◆ ~leaf_ref()

template<class T >
virtual tools::wroot::leaf_ref< T >::~leaf_ref ( )
inlinevirtual

Definition at line 88 of file leaf.

88 {}

◆ leaf_ref() [2/2]

template<class T >
tools::wroot::leaf_ref< T >::leaf_ref ( const leaf_ref< T > &  a_from)
inlineprotected

Definition at line 90 of file leaf.

90 :ibo(a_from),parent(a_from),m_ref(a_from.m_ref){}

Member Function Documentation

◆ cast()

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

Reimplemented from tools::wroot::base_leaf.

Reimplemented in tools::wroot::leaf< T >.

Definition at line 53 of file leaf.

53  {
54  if(void* p = cmp_cast<leaf_ref>(this,a_class)) {return p;}
55  return parent::cast(a_class);
56  }

◆ fill_buffer()

template<class T >
virtual bool tools::wroot::leaf_ref< T >::fill_buffer ( buffer a_buffer) const
inlinevirtual

Implements tools::wroot::base_leaf.

Definition at line 70 of file leaf.

70  {
71  if(m_is_range) {
72  if(m_ref>=m_max) {
73  leaf_ref& self = const_cast<leaf_ref&>(*this);
74  self.m_max = m_ref;
75  }
76  }
77  return a_buffer.write<T>(m_ref);
78  }

◆ get_max()

template<class T >
T tools::wroot::leaf_ref< T >::get_max ( ) const
inline

Definition at line 93 of file leaf.

93 {return m_max;}

◆ id_class()

template<class T >
static cid tools::wroot::leaf_ref< T >::id_class ( )
inlinestatic

Definition at line 52 of file leaf.

52 {return base_leaf_cid()+_cid(T())+10000;} //10000 same as in ntuple::column_ref.

◆ id_cls()

template<class T >
virtual cid tools::wroot::leaf_ref< T >::id_cls ( ) const
inlinevirtual

Reimplemented from tools::wroot::base_leaf.

Reimplemented in tools::wroot::leaf< T >.

Definition at line 57 of file leaf.

57 {return id_class();}

◆ operator=()

template<class T >
leaf_ref& tools::wroot::leaf_ref< T >::operator= ( const leaf_ref< T > &  )
inlineprotected

Definition at line 91 of file leaf.

91 {return *this;}

◆ set_max()

template<class T >
void tools::wroot::leaf_ref< T >::set_max ( const T &  a_value)
inline

Definition at line 94 of file leaf.

94 {m_max = a_value;}

◆ store_cls()

template<class T >
virtual const std::string& tools::wroot::leaf_ref< T >::store_cls ( ) const
inlinevirtual

Implements tools::wroot::ibo.

Definition at line 59 of file leaf.

59 {return leaf_store_class(T());}

◆ stream()

template<class T >
virtual bool tools::wroot::leaf_ref< T >::stream ( buffer a_buffer) const
inlinevirtual

Reimplemented from tools::wroot::base_leaf.

Definition at line 60 of file leaf.

60  {
61  unsigned int c;
62  if(!a_buffer.write_version(1,c)) return false;
63  if(!parent::stream(a_buffer)) return false;
64  if(!a_buffer.write(m_min)) return false;
65  if(!a_buffer.write(m_max)) return false;
66  if(!a_buffer.set_byte_count(c)) return false;
67  return true;
68  }

◆ variable() [1/2]

template<class T >
T& tools::wroot::leaf_ref< T >::variable ( )
inline

Definition at line 97 of file leaf.

97 {return const_cast<T&>(m_ref);}

◆ variable() [2/2]

template<class T >
const T& tools::wroot::leaf_ref< T >::variable ( ) const
inline

Definition at line 96 of file leaf.

96 {return m_ref;}

Member Data Documentation

◆ m_max

template<class T >
T tools::wroot::leaf_ref< T >::m_max
protected

Definition at line 100 of file leaf.

◆ m_min

template<class T >
T tools::wroot::leaf_ref< T >::m_min
protected

Definition at line 99 of file leaf.

◆ m_ref

template<class T >
const T& tools::wroot::leaf_ref< T >::m_ref
protected

Definition at line 101 of file leaf.


The documentation for this class was generated from the following file:
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::wroot::base_leaf_cid
cid base_leaf_cid()
Definition: cids:20
tools::wroot::leaf_ref::id_class
static cid id_class()
Definition: leaf:52
tools::wroot::base_leaf::cast
virtual void * cast(cid a_class) const
Definition: base_leaf:30
tools::wroot::leaf_store_class
const std::string & leaf_store_class(char)
Definition: leaf:15
tools::wroot::leaf_ref::leaf_ref
leaf_ref(std::ostream &a_out, const std::string &a_name, const T &a_ref)
Definition: leaf:80
tools::wroot::base_leaf::m_length
uint32 m_length
Definition: base_leaf:105
tools::wroot::leaf_ref::m_max
T m_max
Definition: leaf:100
tools::wroot::base_leaf::m_length_type
uint32 m_length_type
Definition: base_leaf:106
tools::wroot::base_leaf::stream
virtual bool stream(buffer &a_buffer) const
Definition: base_leaf:36
tools::wroot::base_leaf::m_is_range
bool m_is_range
Definition: base_leaf:108
tools::wroot::leaf_ref::m_ref
const T & m_ref
Definition: leaf:101
tools::wroot::leaf_ref::m_min
T m_min
Definition: leaf:99