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

Public Member Functions

virtual void * cast (cid a_class) const
 
virtual cid id_cls () const
 
virtual bool stream (buffer &a_buffer) const
 
virtual bool fill_buffer (buffer &) const =0
 
 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 ()
 
virtual const std::string & store_cls () const =0
 

Static Public Member Functions

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
 
std::string m_name
 
std::string m_title
 
uint32 m_length
 
uint32 m_length_type
 
ibom_leaf_count
 
bool m_is_range
 

Detailed Description

Definition at line 19 of file base_leaf.

Constructor & Destructor Documentation

◆ base_leaf() [1/2]

tools::wroot::base_leaf::base_leaf ( std::ostream &  a_out,
const std::string &  a_name,
const std::string &  a_title 
)
inline

Definition at line 64 of file base_leaf.

65  :m_out(a_out)
66  ,m_name(a_name)
67  ,m_title(a_title)
68 
69  ,m_length(0)
70  ,m_length_type(0)
71  ,m_leaf_count(0)
72  ,m_is_range(false)
73  {
74 #ifdef TOOLS_MEM
75  mem::increment(s_class().c_str());
76 #endif
77  }

◆ ~base_leaf()

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

Definition at line 78 of file base_leaf.

78  {
79 #ifdef TOOLS_MEM
80  mem::decrement(s_class().c_str());
81 #endif
82  }

◆ base_leaf() [2/2]

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

Definition at line 84 of file base_leaf.

85  :ibo(a_from)
86  ,m_out(a_from.m_out)
87  ,m_length(0)
88  ,m_length_type(0)
89  ,m_leaf_count(0)
90  ,m_is_range(false)
91  {}

Member Function Documentation

◆ cast()

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

Reimplemented in tools::wroot::leaf_object, tools::wroot::leaf_element, tools::wroot::leaf_std_vector_ref< T >, tools::wroot::leaf_string, tools::wroot::leaf_string_ref, tools::wroot::leaf< T >, and tools::wroot::leaf_ref< 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  }

◆ fill_buffer()

virtual bool tools::wroot::base_leaf::fill_buffer ( buffer ) const
pure virtual

◆ id_class()

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

Definition at line 29 of file base_leaf.

29 {return base_leaf_cid();}

◆ id_cls()

virtual cid tools::wroot::base_leaf::id_cls ( ) const
inlinevirtual

◆ length()

uint32 tools::wroot::base_leaf::length ( ) const
inline

Definition at line 97 of file base_leaf.

97 {return m_length;}

◆ name()

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

Definition at line 94 of file base_leaf.

94 {return m_name;}

◆ operator=()

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

Definition at line 92 of file base_leaf.

92 {return *this;}

◆ set_is_range()

void tools::wroot::base_leaf::set_is_range ( bool  a_value)
inline

Definition at line 99 of file base_leaf.

99 {m_is_range = a_value;}

◆ set_length()

void tools::wroot::base_leaf::set_length ( uint32  a_value)
inline

Definition at line 98 of file base_leaf.

98 {m_length = a_value;}

◆ set_title()

void tools::wroot::base_leaf::set_title ( const std::string &  a_value)
inline

Definition at line 96 of file base_leaf.

96 {m_title = a_value;}

◆ stream()

virtual bool tools::wroot::base_leaf::stream ( buffer a_buffer) const
inlinevirtual

Implements tools::wroot::ibo.

Reimplemented in tools::wroot::leaf_object, tools::wroot::leaf_element, tools::wroot::leaf_std_vector_ref< T >, tools::wroot::leaf_string_ref, and tools::wroot::leaf_ref< T >.

Definition at line 36 of file base_leaf.

36  {
37  //::printf("debug : base_leaf::stream %s\n",m_name.c_str());
38  //::printf("debug : m_length %d\n",m_length);
39  //::printf("debug : m_is_range %d\n",m_is_range);
40  //::printf("debug : m_leaf_count %lu\n",m_leaf_count);
41  unsigned int c;
42  if(!a_buffer.write_version(2,c)) return false;
43  if(!Named_stream(a_buffer,m_name,m_title)) return false;
44  if(!a_buffer.write(m_length)) return false;
45  if(!a_buffer.write(m_length_type)) return false;
46  uint32 fOffset = 0;
47  if(!a_buffer.write(fOffset)) return false;
48  if(!a_buffer.write(m_is_range)) return false;
49  bool fIsUnsigned = false;
50  if(!a_buffer.write(fIsUnsigned)) return false;
51 
52  if(m_leaf_count) {
53  if(!a_buffer.write_object(*m_leaf_count)) return false;
54  } else {
55  if(!a_buffer.write(kNullTag())) return false;
56  }
57 
58  if(!a_buffer.set_byte_count(c)) return false;
59  return true;
60  }

Member Data Documentation

◆ m_is_range

bool tools::wroot::base_leaf::m_is_range
protected

Definition at line 108 of file base_leaf.

◆ m_leaf_count

ibo* tools::wroot::base_leaf::m_leaf_count
protected

Definition at line 107 of file base_leaf.

◆ m_length

uint32 tools::wroot::base_leaf::m_length
protected

Definition at line 105 of file base_leaf.

◆ m_length_type

uint32 tools::wroot::base_leaf::m_length_type
protected

Definition at line 106 of file base_leaf.

◆ m_name

std::string tools::wroot::base_leaf::m_name
protected

Definition at line 103 of file base_leaf.

◆ m_out

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

Definition at line 101 of file base_leaf.

◆ m_title

std::string tools::wroot::base_leaf::m_title
protected

Definition at line 104 of file base_leaf.


The documentation for this class was generated from the following file:
tools::wroot::base_leaf::m_name
std::string m_name
Definition: base_leaf:103
tools::wroot::base_leaf::id_class
static cid id_class()
Definition: base_leaf:29
tools::wroot::base_leaf_cid
cid base_leaf_cid()
Definition: cids:20
tools::wroot::Named_stream
bool Named_stream(buffer &a_buffer, const std::string &a_name, const std::string &a_title)
Definition: named:23
tools::wroot::base_leaf::m_length
uint32 m_length
Definition: base_leaf:105
tools::wroot::base_leaf::m_out
std::ostream & m_out
Definition: base_leaf:101
tools::wroot::base_leaf::m_length_type
uint32 m_length_type
Definition: base_leaf:106
tools::wroot::base_leaf::m_is_range
bool m_is_range
Definition: base_leaf:108
tools::uint32
unsigned int uint32
Definition: typedefs:71
tools::wroot::base_leaf::m_leaf_count
ibo * m_leaf_count
Definition: base_leaf:107
tools::wroot::base_leaf::m_title
std::string m_title
Definition: base_leaf:104