g4tools  5.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::rroot::base_leaf Class Referenceabstract
Inheritance diagram for tools::rroot::base_leaf:
Inheritance graph
[legend]
Collaboration diagram for tools::rroot::base_leaf:
Collaboration graph
[legend]

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const
 
virtual void * cast (cid a_class) const
 
virtual bool stream (buffer &a_buffer)
 
virtual bool read_buffer (buffer &)=0
 
virtual bool print_value (std::ostream &, uint32) const =0
 
virtual uint32 num_elem () const =0
 
 base_leaf (std::ostream &a_out, ifac &a_fac)
 
virtual ~base_leaf ()
 
const std::string & name () const
 
const std::string & title () const
 
const base_leafleaf_count () const
 
- Public Member Functions inherited from tools::rroot::iro
virtual ~iro ()
 
virtual irocopy () const =0
 

Static Public Member Functions

static const std::string & s_class ()
 
static cid id_class ()
 

Protected Member Functions

 base_leaf (const base_leaf &a_from)
 
base_leafoperator= (const base_leaf &)
 

Protected Attributes

std::ostream & m_out
 
ifacm_fac
 
std::string m_name
 
std::string m_title
 
uint32 m_length
 
uint32 m_length_type
 
bool m_is_range
 
base_leafm_leaf_count
 
bool m_own_leaf_count
 

Detailed Description

Definition at line 16 of file base_leaf.

Constructor & Destructor Documentation

◆ base_leaf() [1/2]

tools::rroot::base_leaf::base_leaf ( std::ostream &  a_out,
ifac a_fac 
)
inline

Definition at line 105 of file base_leaf.

106  :m_out(a_out)
107  ,m_fac(a_fac)
108  ,m_name("")
109  ,m_title("")
110 
111  //,fIndirectAddress(false)
112  //,fNewValue(false)
113  //,m_ndata(0)
114  ,m_length(0)
115  ,m_length_type(0)
116 //,fOffset(0)
117  ,m_is_range(false)
118 //,fIsUnsigned(false)
119  ,m_leaf_count(0)
120  ,m_own_leaf_count(false)
121  {
122 #ifdef TOOLS_MEM
123  mem::increment(s_class().c_str());
124 #endif
125  }

◆ ~base_leaf()

virtual tools::rroot::base_leaf::~base_leaf ( )
inlinevirtual

Definition at line 126 of file base_leaf.

126  {
127  if(m_own_leaf_count) delete m_leaf_count;
128 #ifdef TOOLS_MEM
129  mem::decrement(s_class().c_str());
130 #endif
131  }

◆ base_leaf() [2/2]

tools::rroot::base_leaf::base_leaf ( const base_leaf a_from)
inlineprotected

Definition at line 133 of file base_leaf.

134  :iro(a_from)
135  ,m_out(a_from.m_out)
136  ,m_fac(a_from.m_fac)
137  //,m_ndata(0)
138  ,m_length(0)
139  ,m_length_type(0)
140  ,m_is_range(false)
141  ,m_leaf_count(0)
142  ,m_own_leaf_count(false)
143  {}

Member Function Documentation

◆ cast() [1/2]

virtual void* tools::rroot::base_leaf::cast ( cid  a_class) const
inlinevirtual

Implements tools::rroot::iro.

Reimplemented in tools::rroot::leaf_object, tools::rroot::leaf_element, tools::rroot::leaf_string, and tools::rroot::leaf< T >.

Definition at line 30 of file base_leaf.

30  {
31  if(void* p = cmp_cast<base_leaf>(this,a_class)) {return p;}
32  else return 0;
33  }

◆ cast() [2/2]

virtual void* tools::rroot::base_leaf::cast ( const std::string &  a_class) const
inlinevirtual

Implements tools::rroot::iro.

Reimplemented in tools::rroot::leaf_object, tools::rroot::leaf_element, tools::rroot::leaf_string, and tools::rroot::leaf< T >.

Definition at line 23 of file base_leaf.

23  {
24  if(void* p = cmp_cast<base_leaf>(this,a_class)) return p;
25  return 0;
26  }

◆ id_class()

static cid tools::rroot::base_leaf::id_class ( )
inlinestatic

Definition at line 29 of file base_leaf.

29 {return base_leaf_cid();}

◆ leaf_count()

const base_leaf* tools::rroot::base_leaf::leaf_count ( ) const
inline

Definition at line 148 of file base_leaf.

148 {return m_leaf_count;}

◆ name()

const std::string& tools::rroot::base_leaf::name ( ) const
inline

Definition at line 146 of file base_leaf.

146 {return m_name;}

◆ num_elem()

virtual uint32 tools::rroot::base_leaf::num_elem ( ) const
pure virtual

◆ operator=()

base_leaf& tools::rroot::base_leaf::operator= ( const base_leaf )
inlineprotected

Definition at line 144 of file base_leaf.

144 {return *this;}

◆ print_value()

virtual bool tools::rroot::base_leaf::print_value ( std::ostream &  ,
uint32   
) const
pure virtual

◆ read_buffer()

virtual bool tools::rroot::base_leaf::read_buffer ( buffer )
pure virtual

◆ s_class()

static const std::string& tools::rroot::base_leaf::s_class ( )
inlinestatic

Definition at line 18 of file base_leaf.

18  {
19  static const std::string s_v("tools::rroot::base_leaf");
20  return s_v;
21  }

◆ s_cls()

virtual const std::string& tools::rroot::base_leaf::s_cls ( ) const
inlinevirtual

Implements tools::rroot::iro.

Reimplemented in tools::rroot::leaf_object, tools::rroot::leaf_element, tools::rroot::leaf_string, and tools::rroot::leaf< T >.

Definition at line 27 of file base_leaf.

27 {return s_class();}

◆ stream()

virtual bool tools::rroot::base_leaf::stream ( buffer a_buffer)
inlinevirtual

Implements tools::rroot::iro.

Reimplemented in tools::rroot::leaf_object, tools::rroot::leaf_element, tools::rroot::leaf_string, and tools::rroot::leaf< T >.

Definition at line 35 of file base_leaf.

35  {
36  if(m_own_leaf_count) {
37  if(a_buffer.map_objs()) a_buffer.remove_in_map(m_leaf_count);
38  delete m_leaf_count;
39  }
40  m_leaf_count = 0;
41  m_own_leaf_count = false;
42 
43  int fOffset;
44  bool fIsUnsigned;
45 
46  short v;
47  unsigned int s,c;
48  if(!a_buffer.read_version(v,s,c)) return false;
49  //FIXME if (v > 1) {
50  //TLeaf::Class()->ReadBuffer(b, this, R__v, R__s, R__c);
51  //FIXME } else {
52  //====process old versions before automatic schema evolution
53  if(!Named_stream(a_buffer,m_name,m_title)) return false;
54 
55  // Ok with v 1 & 2
56  if(!a_buffer.read(m_length)) return false;
57  if(!a_buffer.read(m_length_type)) return false;
58  if(!a_buffer.read(fOffset)) return false;
59  if(!a_buffer.read(m_is_range)) return false;
60  if(!a_buffer.read(fIsUnsigned)) return false;
61 
62  {ifac::args args;
63  iro* obj;
64  bool created;
65  if(!a_buffer.read_object(m_fac,args,obj,created)) {
66  m_out << "tools::rroot::base_leaf::stream :"
67  << " can't read object."
68  << std::endl;
69  return false;
70  }
71  if(!obj) {
72  //m_out << "tools::rroot::base_leaf::stream :"
73  // << " null leaf count object."
74  // << std::endl;
75  } else {
76  m_leaf_count = safe_cast<iro,base_leaf>(*obj);
77  if(!m_leaf_count) {
78  m_out << "tools::rroot::base_leaf::stream :"
79  << " can't cast base_leaf."
80  << std::endl;
81  m_leaf_count = 0;
82  if(created) {
83  if(a_buffer.map_objs()) a_buffer.remove_in_map(obj);
84  delete obj;
85  }
86  return false;
87  }
88  if(created) m_own_leaf_count = true;
89  }}
90 
91  if(!a_buffer.check_byte_count(s,c,"TLeaf")) return false;
92 
93  if(!m_length) m_length = 1;
94 /*
95  fNewValue = false;
96  if(!setAddress(0)) return false;
97 */
98  return true;
99  }

◆ title()

const std::string& tools::rroot::base_leaf::title ( ) const
inline

Definition at line 147 of file base_leaf.

147 {return m_title;}

Member Data Documentation

◆ m_fac

ifac& tools::rroot::base_leaf::m_fac
protected

Definition at line 175 of file base_leaf.

◆ m_is_range

bool tools::rroot::base_leaf::m_is_range
protected

Definition at line 185 of file base_leaf.

◆ m_leaf_count

base_leaf* tools::rroot::base_leaf::m_leaf_count
protected

Definition at line 187 of file base_leaf.

◆ m_length

uint32 tools::rroot::base_leaf::m_length
protected

Definition at line 182 of file base_leaf.

◆ m_length_type

uint32 tools::rroot::base_leaf::m_length_type
protected

Definition at line 183 of file base_leaf.

◆ m_name

std::string tools::rroot::base_leaf::m_name
protected

Definition at line 177 of file base_leaf.

◆ m_out

std::ostream& tools::rroot::base_leaf::m_out
protected

Definition at line 174 of file base_leaf.

◆ m_own_leaf_count

bool tools::rroot::base_leaf::m_own_leaf_count
protected

Definition at line 188 of file base_leaf.

◆ m_title

std::string tools::rroot::base_leaf::m_title
protected

Definition at line 178 of file base_leaf.


The documentation for this class was generated from the following file:
tools::rroot::base_leaf::s_class
static const std::string & s_class()
Definition: base_leaf:18
tools::rroot::base_leaf::m_out
std::ostream & m_out
Definition: base_leaf:174
tools::rroot::Named_stream
bool Named_stream(buffer &a_buffer, std::string &a_name, std::string &a_title)
Definition: named:15
tools::rroot::base_leaf::m_is_range
bool m_is_range
Definition: base_leaf:185
tools::rroot::base_leaf::m_name
std::string m_name
Definition: base_leaf:177
tools::rroot::base_leaf::m_title
std::string m_title
Definition: base_leaf:178
tools::rroot::base_leaf_cid
cid base_leaf_cid()
Definition: cids:45
tools::rroot::base_leaf::m_leaf_count
base_leaf * m_leaf_count
Definition: base_leaf:187
tools::rroot::base_leaf::m_length
uint32 m_length
Definition: base_leaf:182
tools::rroot::base_leaf::m_fac
ifac & m_fac
Definition: base_leaf:175
tools::rroot::base_leaf::m_length_type
uint32 m_length_type
Definition: base_leaf:183
tools::rroot::ifac::args
std::map< char, void * > args
Definition: ifac:21
tools::rroot::base_leaf::m_own_leaf_count
bool m_own_leaf_count
Definition: base_leaf:188