g4tools  5.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::waxml::ntuple::sub_ntuple Class Reference
Inheritance diagram for tools::waxml::ntuple::sub_ntuple:
Inheritance graph
[legend]
Collaboration diagram for tools::waxml::ntuple::sub_ntuple:
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 const std::string & aida_type () const
 
 sub_ntuple (const std::string &a_name, const std::string &a_spaces)
 
virtual ~sub_ntuple ()
 
template<class T >
column< T > * create_column (const std::string &a_name, const T &a_def=T())
 
sub_ntuplecreate_sub_ntuple (const std::string &a_name)
 
const std::vector< iobj * > & columns () const
 
std::string booking (bool a_xml_esc) const
 
void reset ()
 
const std::string & value () const
 
bool add_row ()
 
- Public Member Functions inherited from tools::waxml::ntuple::iobj
virtual ~iobj ()
 

Static Public Member Functions

static cid id_class ()
 

Protected Member Functions

 sub_ntuple (const sub_ntuple &a_from)
 
sub_ntupleoperator= (const sub_ntuple &)
 

Protected Attributes

std::string m_name
 
std::string m_spaces
 
std::vector< iobj * > m_cols
 
std::string m_tmp
 

Detailed Description

Definition at line 127 of file ntuple.

Constructor & Destructor Documentation

◆ sub_ntuple() [1/2]

tools::waxml::ntuple::sub_ntuple::sub_ntuple ( const std::string &  a_name,
const std::string &  a_spaces 
)
inline

Definition at line 140 of file ntuple.

141  :m_name(a_name),m_spaces(a_spaces){}

◆ ~sub_ntuple()

virtual tools::waxml::ntuple::sub_ntuple::~sub_ntuple ( )
inlinevirtual

Definition at line 142 of file ntuple.

142 {}

◆ sub_ntuple() [2/2]

tools::waxml::ntuple::sub_ntuple::sub_ntuple ( const sub_ntuple a_from)
inlineprotected

Definition at line 144 of file ntuple.

145  :iobj(a_from),m_name(a_from.m_name){}

Member Function Documentation

◆ add_row()

bool tools::waxml::ntuple::sub_ntuple::add_row ( )
inline

Definition at line 178 of file ntuple.

178  {
179  if(m_cols.empty()) return false;
180  std::ostringstream sout;
181  sout << m_spaces << "<row>" << std::endl;
182  tools_vforcit(iobj*,m_cols,it) {
183  if(sub_ntuple* sub = id_cast<iobj,sub_ntuple>(*(*it))) {
184  sout << m_spaces << " <entryITuple>" << std::endl;
185  sout << sub->value();
186  sout << m_spaces << " </entryITuple>" << std::endl;
187  sub->reset();
188  } else if(leaf* lf = id_cast<iobj,leaf>(*(*it))){
189  std::string _sv;
190  lf->s_value(_sv);
191  sout << m_spaces << " <entry"
192  << " value=\"" << _sv
193  << "\"/>" << std::endl;
194  }
195  }
196  sout << m_spaces << "</row>" << std::endl;
197 
198  m_tmp += sout.str();
199 
200  return true;
201  }

◆ aida_type()

virtual const std::string& tools::waxml::ntuple::sub_ntuple::aida_type ( ) const
inlinevirtual

Implements tools::waxml::ntuple::iobj.

Definition at line 138 of file ntuple.

138 {return s_aida_type_ituple();}

◆ booking()

std::string tools::waxml::ntuple::sub_ntuple::booking ( bool  a_xml_esc) const
inline

Definition at line 170 of file ntuple.

170  {
171  std::string s;
172  get_booking(m_cols,a_xml_esc,s);
173  return s;
174  }

◆ cast()

virtual void* tools::waxml::ntuple::sub_ntuple::cast ( cid  a_class) const
inlinevirtual

Implements tools::waxml::ntuple::iobj.

Definition at line 131 of file ntuple.

131  {
132  if(void* p = cmp_cast<sub_ntuple>(this,a_class)) {return p;}
133  return 0;
134  }

◆ columns()

const std::vector<iobj*>& tools::waxml::ntuple::sub_ntuple::columns ( ) const
inline

Definition at line 168 of file ntuple.

168 {return m_cols;}

◆ create_column()

template<class T >
column<T>* tools::waxml::ntuple::sub_ntuple::create_column ( const std::string &  a_name,
const T &  a_def = T() 
)
inline

Definition at line 149 of file ntuple.

149  {
150  if(find_named<iobj>(m_cols,a_name)) return 0;
151  column<T>* col = new column<T>(a_name,a_def);
152  if(!col) return 0;
153  m_cols.push_back(col);
154  return col;
155  }

◆ create_sub_ntuple()

sub_ntuple* tools::waxml::ntuple::sub_ntuple::create_sub_ntuple ( const std::string &  a_name)
inline

Definition at line 157 of file ntuple.

157  {
158  if(find_named<iobj>(m_cols,a_name)) return 0;
159  std::string spaces;
160  for(unsigned int i=0;i<4;i++) spaces += " ";
161  sub_ntuple* col = new sub_ntuple(a_name,m_spaces+spaces);
162  if(!col) return 0;
163  m_cols.push_back(col);
164  return col;
165  }

◆ id_class()

static cid tools::waxml::ntuple::sub_ntuple::id_class ( )
inlinestatic

Definition at line 129 of file ntuple.

129 {return 300;}

◆ id_cls()

virtual cid tools::waxml::ntuple::sub_ntuple::id_cls ( ) const
inlinevirtual

Implements tools::waxml::ntuple::iobj.

Definition at line 135 of file ntuple.

135 {return id_class();}

◆ name()

virtual const std::string& tools::waxml::ntuple::sub_ntuple::name ( ) const
inlinevirtual

Implements tools::waxml::ntuple::iobj.

Definition at line 137 of file ntuple.

137 {return m_name;}

◆ operator=()

sub_ntuple& tools::waxml::ntuple::sub_ntuple::operator= ( const sub_ntuple )
inlineprotected

Definition at line 146 of file ntuple.

146 {return *this;}

◆ reset()

void tools::waxml::ntuple::sub_ntuple::reset ( )
inline

Definition at line 175 of file ntuple.

175 {m_tmp.clear();}

◆ value()

const std::string& tools::waxml::ntuple::sub_ntuple::value ( ) const
inline

Definition at line 176 of file ntuple.

176 {return m_tmp;}

Member Data Documentation

◆ m_cols

std::vector<iobj*> tools::waxml::ntuple::sub_ntuple::m_cols
protected

Definition at line 205 of file ntuple.

◆ m_name

std::string tools::waxml::ntuple::sub_ntuple::m_name
protected

Definition at line 203 of file ntuple.

◆ m_spaces

std::string tools::waxml::ntuple::sub_ntuple::m_spaces
protected

Definition at line 204 of file ntuple.

◆ m_tmp

std::string tools::waxml::ntuple::sub_ntuple::m_tmp
protected

Definition at line 206 of file ntuple.


The documentation for this class was generated from the following file:
tools::sub
bool sub(std::vector< T > &a_vec, const std::vector< T > &a_v)
Definition: vmanip:283
tools::waxml::ntuple::s_aida_type_ituple
static const std::string & s_aida_type_ituple()
Definition: ntuple:78
tools::waxml::ntuple::get_booking
static void get_booking(const std::vector< iobj * > &a_cols, bool a_xml_esc, std::string &a_string)
Definition: ntuple:469
tools::waxml::ntuple::sub_ntuple::sub_ntuple
sub_ntuple(const std::string &a_name, const std::string &a_spaces)
Definition: ntuple:140
tools::waxml::ntuple::sub_ntuple::m_spaces
std::string m_spaces
Definition: ntuple:204
tools::waxml::ntuple::sub_ntuple::m_cols
std::vector< iobj * > m_cols
Definition: ntuple:205
tools::waxml::ntuple::sub_ntuple::id_class
static cid id_class()
Definition: ntuple:129
tools::waxml::ntuple::sub_ntuple::m_tmp
std::string m_tmp
Definition: ntuple:206
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::waxml::ntuple::sub_ntuple::m_name
std::string m_name
Definition: ntuple:203