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

Public Member Functions

virtual const std::string & store_cls () const
 
virtual bool stream (buffer &aBuffer) const
 
virtual streamer_elementcopy () const =0
 
virtual void out (std::ostream &aOut) const
 
 streamer_element (const std::string &aName, const std::string &aTitle, int aOffset, int aType, const std::string &aTypeName)
 
virtual ~streamer_element ()
 
virtual void setArrayDimension (int aDimension)
 
virtual void setMaxIndex (int aDimension, int aMaximum)
 
virtual void fullName (std::string &a_s) const
 
- Public Member Functions inherited from tools::wroot::ibo
virtual ~ibo ()
 

Protected Member Functions

 streamer_element (const streamer_element &a_from)
 
streamer_elementoperator= (const streamer_element &a_from)
 

Protected Attributes

std::string fName
 
std::string fTitle
 
int fType
 
int fSize
 
int fArrayLength
 
int fArrayDim
 
int fMaxIndex [5]
 
int fOffset
 
std::string fTypeName
 element offset in class More...
 

Detailed Description

Definition at line 54 of file element.

Constructor & Destructor Documentation

◆ streamer_element() [1/2]

tools::wroot::streamer_element::streamer_element ( const std::string &  aName,
const std::string &  aTitle,
int  aOffset,
int  aType,
const std::string &  aTypeName 
)
inline

Definition at line 88 of file element.

90  :fName(aName),fTitle(aTitle),fType(aType)
91  ,fSize(0),fArrayLength(0),fArrayDim(0),fOffset(aOffset)
92  ,fTypeName(aTypeName){
93 #ifdef TOOLS_MEM
94  mem::increment(s_class().c_str());
95 #endif
96  for(int i=0;i<5;i++) fMaxIndex[i] = 0;
97  }

◆ ~streamer_element()

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

Definition at line 98 of file element.

98  {
99 #ifdef TOOLS_MEM
100  mem::decrement(s_class().c_str());
101 #endif
102  }

◆ streamer_element() [2/2]

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

Definition at line 104 of file element.

105  :ibo(a_from)
106  ,fName(a_from.fName),fTitle(a_from.fTitle)
107  ,fType(a_from.fType),fSize(a_from.fSize)
108  ,fArrayLength(a_from.fArrayLength)
109  ,fArrayDim(a_from.fArrayDim),fOffset(a_from.fOffset)
110  ,fTypeName(a_from.fTypeName){
111 #ifdef TOOLS_MEM
112  mem::increment(s_class().c_str());
113 #endif
114  for(int i=0;i<5;i++) fMaxIndex[i] = a_from.fMaxIndex[i];
115  }

Member Function Documentation

◆ copy()

virtual streamer_element* tools::wroot::streamer_element::copy ( ) const
pure virtual

◆ fullName()

virtual void tools::wroot::streamer_element::fullName ( std::string &  a_s) const
inlinevirtual

Definition at line 142 of file element.

142  {
143  a_s = fName;
144  for (int i=0;i<fArrayDim;i++) {
145  char cdim[32];
146  snpf(cdim,sizeof(cdim),"[%d]",fMaxIndex[i]);
147  a_s += cdim;
148  }
149  }

◆ operator=()

streamer_element& tools::wroot::streamer_element::operator= ( const streamer_element a_from)
inlineprotected

Definition at line 116 of file element.

116  {
117  fName = a_from.fName;
118  fTitle = a_from.fTitle;
119  fType = a_from.fType;
120  fSize = a_from.fSize;
121  fArrayLength = a_from.fArrayLength;
122  fArrayDim = a_from.fArrayDim;
123  fOffset = a_from.fOffset;
124  fTypeName = a_from.fTypeName;
125  for(int i=0;i<5;i++) fMaxIndex[i] = a_from.fMaxIndex[i];
126  return *this;
127  }

◆ out()

virtual void tools::wroot::streamer_element::out ( std::ostream &  aOut) const
inlinevirtual

Definition at line 80 of file element.

80  {
81  std::string _fname;
82  fullName(_fname);
83  char s[256];
84  snpf(s,sizeof(s)," %-14s%-15s offset=%3d type=%2d %-20s",fTypeName.c_str(),_fname.c_str(),fOffset,fType,fTitle.c_str());
85  aOut << s << std::endl;
86  }

◆ setArrayDimension()

virtual void tools::wroot::streamer_element::setArrayDimension ( int  aDimension)
inlinevirtual

Definition at line 129 of file element.

129  {
130  fArrayDim = aDimension;
131  if(aDimension) fType += streamer__info::ARRAY;
132  //fNewType = fType;
133  }

◆ setMaxIndex()

virtual void tools::wroot::streamer_element::setMaxIndex ( int  aDimension,
int  aMaximum 
)
inlinevirtual

Definition at line 134 of file element.

134  {
135  //set maximum index for array with dimension dim
136  if (aDimension < 0 || aDimension > 4) return;
137  fMaxIndex[aDimension] = aMaximum;
138  if (fArrayLength == 0) fArrayLength = aMaximum;
139  else fArrayLength *= aMaximum;
140  }

◆ store_cls()

virtual const std::string& tools::wroot::streamer_element::store_cls ( ) const
inlinevirtual

◆ stream()

virtual bool tools::wroot::streamer_element::stream ( buffer aBuffer) const
inlinevirtual

Implements tools::wroot::ibo.

Reimplemented in tools::wroot::streamer_STL, tools::wroot::streamer_object_any, tools::wroot::streamer_object_pointer, tools::wroot::streamer_object, tools::wroot::streamer_string, tools::wroot::streamer_basic_pointer, tools::wroot::streamer_basic_type, and tools::wroot::streamer_base.

Definition at line 64 of file element.

64  {
65  unsigned int c;
66  if(!aBuffer.write_version(2,c)) return false;
67  if(!Named_stream(aBuffer,fName,fTitle)) return false;
68  if(!aBuffer.write(fType)) return false;
69  if(!aBuffer.write(fSize)) return false;
70  if(!aBuffer.write(fArrayLength)) return false;
71  if(!aBuffer.write(fArrayDim)) return false;
72  if(!aBuffer.write_fast_array<int>(fMaxIndex,5)) return false;
73  if(!aBuffer.write(fTypeName)) return false;
74  if(!aBuffer.set_byte_count(c)) return false;
75  return true;
76  }

Member Data Documentation

◆ fArrayDim

int tools::wroot::streamer_element::fArrayDim
protected

Definition at line 157 of file element.

◆ fArrayLength

int tools::wroot::streamer_element::fArrayLength
protected

Definition at line 156 of file element.

◆ fMaxIndex

int tools::wroot::streamer_element::fMaxIndex[5]
protected

Definition at line 158 of file element.

◆ fName

std::string tools::wroot::streamer_element::fName
protected

Definition at line 151 of file element.

◆ fOffset

int tools::wroot::streamer_element::fOffset
protected

Definition at line 159 of file element.

◆ fSize

int tools::wroot::streamer_element::fSize
protected

Definition at line 155 of file element.

◆ fTitle

std::string tools::wroot::streamer_element::fTitle
protected

Definition at line 152 of file element.

◆ fType

int tools::wroot::streamer_element::fType
protected

Definition at line 154 of file element.

◆ fTypeName

std::string tools::wroot::streamer_element::fTypeName
protected

element offset in class

Definition at line 161 of file element.


The documentation for this class was generated from the following file:
tools::wroot::streamer_element::fTitle
std::string fTitle
Definition: element:152
tools::wroot::streamer_element::fArrayDim
int fArrayDim
Definition: element:157
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::streamer__info::ARRAY
@ ARRAY
Definition: element:18
tools::snpf
int snpf(char *a_s, size_t a_n, const char *a_fmt,...)
Definition: snpf:27
tools::wroot::streamer_element::fOffset
int fOffset
Definition: element:159
tools::wroot::streamer_element::fType
int fType
Definition: element:154
tools::wroot::streamer_element::fMaxIndex
int fMaxIndex[5]
Definition: element:158
tools::wroot::streamer_element::fName
std::string fName
Definition: element:151
tools::wroot::streamer_element::fSize
int fSize
Definition: element:155
tools::wroot::streamer_element::fullName
virtual void fullName(std::string &a_s) const
Definition: element:142
tools::wroot::streamer_element::fArrayLength
int fArrayLength
Definition: element:156
tools::wroot::streamer_element::fTypeName
std::string fTypeName
element offset in class
Definition: element:161