Jpp
Public Member Functions | Friends | List of all members
JROOT::JROOTClassSelection Struct Reference

Auxiliary class for ROOT class selection. More...

#include <JROOTClassSelector.hh>

Inheritance diagram for JROOT::JROOTClassSelection:
std::set< JROOTClassSelector >

Public Member Functions

 JROOTClassSelection ()
 Default contructor. More...
 
 JROOTClassSelection (const std::set< JROOTClassSelector > &selection)
 Copy contructor. More...
 
template<class T >
 JROOTClassSelection (const JType< T > &typelist)
 Contructor. More...
 
template<class T >
void operator() (const JType< T > &type)
 Add data type. More...
 
template<class T >
bool operator() (const JType< T > &type) const
 Get status of given data type. More...
 

Friends

std::istream & operator>> (std::istream &in, JROOTClassSelection &object)
 Read ROOT class selection from input. More...
 
std::ostream & operator<< (std::ostream &out, const JROOTClassSelection &object)
 Write ROOT class selection to output. More...
 

Detailed Description

Auxiliary class for ROOT class selection.

Definition at line 91 of file JROOTClassSelector.hh.

Constructor & Destructor Documentation

◆ JROOTClassSelection() [1/3]

JROOT::JROOTClassSelection::JROOTClassSelection ( )
inline

Default contructor.

Definition at line 97 of file JROOTClassSelector.hh.

98  {}

◆ JROOTClassSelection() [2/3]

JROOT::JROOTClassSelection::JROOTClassSelection ( const std::set< JROOTClassSelector > &  selection)
inline

Copy contructor.

Parameters
selectionselection

Definition at line 106 of file JROOTClassSelector.hh.

106  :
108  {}

◆ JROOTClassSelection() [3/3]

template<class T >
JROOT::JROOTClassSelection::JROOTClassSelection ( const JType< T > &  typelist)
inline

Contructor.

Parameters
typelisttype list

Definition at line 117 of file JROOTClassSelector.hh.

118  {
119  JLANG::for_each(*this, typelist);
120  }

Member Function Documentation

◆ operator()() [1/2]

template<class T >
void JROOT::JROOTClassSelection::operator() ( const JType< T > &  type)
inline

Add data type.

Parameters
typedata type

Definition at line 129 of file JROOTClassSelector.hh.

130  {
131  this->insert(JROOTClassSelector(type));
132  }

◆ operator()() [2/2]

template<class T >
bool JROOT::JROOTClassSelection::operator() ( const JType< T > &  type) const
inline

Get status of given data type.

Parameters
typedata type
Returns
true if valid class name; else false

Definition at line 142 of file JROOTClassSelector.hh.

143  {
144  return this->find(getClassname(getName(type))) != this->end();
145  }

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
JROOTClassSelection object 
)
friend

Read ROOT class selection from input.

Note that if the first character of the read class name is:

  • '+' the remainder of the class name is added; or
  • '-' the remainder of the class name is removed; otherwise
  • the complete class name is added.
Parameters
ininput stream
objectROOT class selection
Returns
input stream

Definition at line 160 of file JROOTClassSelector.hh.

161  {
162  for (std::string buffer; in >> buffer; ) {
163 
164  const TRegexp regexp(buffer.substr(1).c_str());
165 
166  switch (buffer[0]) {
167 
168  case '-':
169 
170  for (JROOTClassSelection::iterator i = object.begin(); i != object.end(); ) {
171 
172  if (TString(i->c_str()).Index(regexp) != -1)
173  object.erase(i++);
174  else
175  ++i;
176  }
177 
178  break;
179 
180  case '+':
181 
182  object.insert(buffer.substr(1));
183  break;
184 
185  default:
186 
187  object.insert(buffer);
188  break;
189  }
190  }
191 
192  return in;
193  }

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const JROOTClassSelection object 
)
friend

Write ROOT class selection to output.

Parameters
outoutput stream
objectROOT class selection
Returns
output stream

Definition at line 203 of file JROOTClassSelector.hh.

204  {
205  for (const_iterator i = object.begin(); i != object.end(); ++i) {
206  out << *i << std::endl;
207  }
208 
209  return out;
210  }

The documentation for this struct was generated from the following file:
std::set< JROOTClassSelector >
JROOT::JROOTClassSelector
Auxiliary class to select ROOT class based on class name.
Definition: JROOTClassSelector.hh:32
JLANG::for_each
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition: JTypeList.hh:572
JROOT::getName
const char * getName()
Get ROOT name of given data type.
Definition: JRootToolkit.hh:45
JEEP::getClassname
std::string getClassname(const std::string &type_name)
Get type name, i.e.
Definition: JeepToolkit.hh:242