g4tools  5.4.0
Public Member Functions | Static Public Member Functions | List of all members
tools::read::intuple Class Referenceabstract
Inheritance diagram for tools::read::intuple:
Inheritance graph
[legend]

Public Member Functions

virtual ~intuple ()
 
virtual void start ()=0
 
virtual bool next ()=0
 
virtual icolfind_icol (const std::string &)=0
 
virtual const std::vector< icol * > & columns () const =0
 
virtual const std::string & title () const =0
 
virtual bool number_of_entries (uint64 &) const =0
 
virtual void stop ()
 
size_t number_of_columns () const
 
void column_names (std::vector< std::string > &a_names) const
 
icolfind_icol_case_insensitive (const std::string &a_name)
 
template<class T >
icolumn< T > * find_column (const std::string &a_name)
 
template<class T >
bool find_column (const std::string &a_name, icolumn< T > *&a_col, bool a_case_sensitive=true)
 
template<class T >
bool column_is_of_type (const std::string &a_name, bool &a_is, bool a_case_sensitive=true)
 
template<class T >
bool column_min (unsigned int a_col, T &a_value)
 
template<class T >
bool column_max (unsigned int a_col, T &a_value)
 

Static Public Member Functions

static const std::string & s_class ()
 

Detailed Description

Definition at line 55 of file rntuple.

Constructor & Destructor Documentation

◆ ~intuple()

virtual tools::read::intuple::~intuple ( )
inlinevirtual

Definition at line 62 of file rntuple.

62 {}

Member Function Documentation

◆ column_is_of_type()

template<class T >
bool tools::read::intuple::column_is_of_type ( const std::string &  a_name,
bool &  a_is,
bool  a_case_sensitive = true 
)
inline

Definition at line 110 of file rntuple.

110  {
111  icol* col = a_case_sensitive ? find_icol(a_name) : find_icol_case_insensitive(a_name);
112  if(!col) {a_is = false;return false;}
113  a_is = id_cast<icol, icolumn<T> >(*col)?true:false;
114  return true;
115  }

◆ column_max()

template<class T >
bool tools::read::intuple::column_max ( unsigned int  a_col,
T &  a_value 
)
inline

Definition at line 143 of file rntuple.

143  {
144  a_value = T();
145  const std::vector<icol*>& cols = columns();
146  if(cols.empty()) return false;
147  if(a_col>=cols.size()) return false;
148  icol* _base_col = cols[a_col];
149  icolumn<T>* _col = id_cast<icol, icolumn<T> >(*_base_col);
150  if(!_col) return false;
151  uint64 _rows;
152  if(!number_of_entries(_rows)) return false;
153  start();
154  T v;
155  {for(uint64 row=0;row<_rows;row++) {
156  if(!next()) {a_value = T();return false;}
157  if(!_col->get_entry(v)) {}
158  if(!row) {
159  a_value = v;
160  } else {
161  a_value = mx<T>(a_value,v);
162  }
163  }}
164  return true;
165  }

◆ column_min()

template<class T >
bool tools::read::intuple::column_min ( unsigned int  a_col,
T &  a_value 
)
inline

Definition at line 118 of file rntuple.

118  {
119  a_value = T();
120  const std::vector<icol*>& cols = columns();
121  if(cols.empty()) return false;
122  if(a_col>=cols.size()) return false;
123  icol* _base_col = cols[a_col];
124  icolumn<T>* _col = id_cast<icol, icolumn<T> >(*_base_col);
125  if(!_col) return false;
126  uint64 _rows;
127  if(!number_of_entries(_rows)) return false;
128  start();
129  T v;
130  {for(uint64 row=0;row<_rows;row++) {
131  if(!next()) {a_value = T();return false;}
132  if(!_col->get_entry(v)) {}
133  if(!row) {
134  a_value = v;
135  } else {
136  a_value = mn<T>(a_value,v);
137  }
138  }}
139  return true;
140  }

◆ column_names()

void tools::read::intuple::column_names ( std::vector< std::string > &  a_names) const
inline

Definition at line 75 of file rntuple.

75  {
76  a_names.clear();
77  const std::vector<icol*>& _cols = columns();
78  tools_vforcit(icol*,_cols,it) a_names.push_back((*it)->name());
79  }

◆ columns()

virtual const std::vector<icol*>& tools::read::intuple::columns ( ) const
pure virtual

◆ find_column() [1/2]

template<class T >
icolumn<T>* tools::read::intuple::find_column ( const std::string &  a_name)
inline

Definition at line 95 of file rntuple.

95  {
96  icol* col = find_icol(a_name);
97  if(!col) return 0;
98  return id_cast<icol, icolumn<T> >(*col);
99  }

◆ find_column() [2/2]

template<class T >
bool tools::read::intuple::find_column ( const std::string &  a_name,
icolumn< T > *&  a_col,
bool  a_case_sensitive = true 
)
inline

Definition at line 102 of file rntuple.

102  { //for gopaw and exlib::evaluator.
103  icol* col = a_case_sensitive ? find_icol(a_name) : find_icol_case_insensitive(a_name);
104  if(!col) {a_col = 0;return false;}
105  a_col = id_cast<icol, icolumn<T> >(*col);
106  return a_col?true:false;
107  }

◆ find_icol()

virtual icol* tools::read::intuple::find_icol ( const std::string &  )
pure virtual

◆ find_icol_case_insensitive()

icol* tools::read::intuple::find_icol_case_insensitive ( const std::string &  a_name)
inline

Definition at line 81 of file rntuple.

81  { //for gopaw and exlib::evaluator.
82  std::string low_a_name = a_name;
83  tolowercase(low_a_name);
84  std::string low_name;
85  const std::vector<icol*>& _cols = columns();
86  tools_vforcit(icol*,_cols,it) {
87  low_name = (*it)->name();
88  tolowercase(low_name);
89  if(low_name==low_a_name) return *it;
90  }
91  return 0;
92  }

◆ next()

virtual bool tools::read::intuple::next ( )
pure virtual

◆ number_of_columns()

size_t tools::read::intuple::number_of_columns ( ) const
inline

Definition at line 73 of file rntuple.

73 {return columns().size();}

◆ number_of_entries()

virtual bool tools::read::intuple::number_of_entries ( uint64 ) const
pure virtual

◆ s_class()

static const std::string& tools::read::intuple::s_class ( )
inlinestatic

Definition at line 57 of file rntuple.

57  {
58  static const std::string s_v("tools::read::intuple");
59  return s_v;
60  }

◆ start()

virtual void tools::read::intuple::start ( )
pure virtual

◆ stop()

virtual void tools::read::intuple::stop ( )
inlinevirtual

Definition at line 71 of file rntuple.

71 {}

◆ title()

virtual const std::string& tools::read::intuple::title ( ) const
pure virtual

The documentation for this class was generated from the following file:
tools::uint64
unsigned long long uint64
Definition: typedefs:72
tools::tolowercase
void tolowercase(std::string &a_string)
Definition: touplow:11
tools::read::intuple::number_of_entries
virtual bool number_of_entries(uint64 &) const =0
tools::read::intuple::find_icol
virtual icol * find_icol(const std::string &)=0
tools::read::intuple::next
virtual bool next()=0
tools::read::intuple::columns
virtual const std::vector< icol * > & columns() const =0
tools::read::intuple::start
virtual void start()=0
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::read::intuple::find_icol_case_insensitive
icol * find_icol_case_insensitive(const std::string &a_name)
Definition: rntuple:81