Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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)
 Virtual destructor. 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 90 of file JROOTClassSelector.hh.

Constructor & Destructor Documentation

JROOT::JROOTClassSelection::JROOTClassSelection ( )
inline

Default contructor.

Definition at line 96 of file JROOTClassSelector.hh.

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

Copy contructor.

Parameters
selectionselection

Definition at line 105 of file JROOTClassSelector.hh.

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

Contructor.

Parameters
typelisttype list

Definition at line 116 of file JROOTClassSelector.hh.

117  {
118  JLANG::for_each(*this, typelist);
119  }
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition: JTypeList.hh:572

Member Function Documentation

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

Virtual destructor.

Add data type.

Parameters
typedata type

Definition at line 136 of file JROOTClassSelector.hh.

137  {
138  this->insert(JROOTClassSelector(type));
139  }
Auxiliary class to select ROOT class based on class name.
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 149 of file JROOTClassSelector.hh.

150  {
151  return this->find(getClassname(T::Class_Name())) != this->end();
152  }
std::string getClassname(const std::string &type_name)
Get type name, i.e.
Definition: JeepToolkit.hh:226

Friends And Related Function Documentation

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 167 of file JROOTClassSelector.hh.

168  {
169  for (std::string buffer; in >> buffer; ) {
170 
171  const TRegexp regexp(buffer.substr(1).c_str());
172 
173  switch (buffer[0]) {
174 
175  case '-':
176 
177  for (JROOTClassSelection::iterator i = object.begin(); i != object.end(); ) {
178 
179  if (TString(i->c_str()).Index(regexp) != -1)
180  object.erase(i++);
181  else
182  ++i;
183  }
184 
185  break;
186 
187  case '+':
188 
189  object.insert(buffer.substr(1));
190  break;
191 
192  default:
193 
194  object.insert(buffer);
195  break;
196  }
197  }
198 
199  return in;
200  }
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 210 of file JROOTClassSelector.hh.

211  {
212  for (const_iterator i = object.begin(); i != object.end(); ++i) {
213  out << *i << std::endl;
214  }
215 
216  return out;
217  }

The documentation for this struct was generated from the following file: