Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | 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 (const bool option=false)
 Contructor. More...
 
 JROOTClassSelection (const std::set< JROOTClassSelector > &selection, const bool option=false)
 Contructor. More...
 
template<class T >
 JROOTClassSelection (const JType< T > &typelist, const bool option=false)
 Contructor. More...
 
bool getOption () const
 Get option to include name space. More...
 
template<class T >
void add ()
 Add given data type. More...
 
template<class T >
void remove ()
 Remove data type. 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...
 
template<class T >
bool is_valid () const
 Get status of given data type. More...
 

Private Attributes

bool option
 include namespace 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 127 of file JROOTClassSelector.hh.

Constructor & Destructor Documentation

JROOT::JROOTClassSelection::JROOTClassSelection ( const bool  option = false)
inline

Contructor.

Parameters
optioninclude namespace

Definition at line 135 of file JROOTClassSelector.hh.

135  :
136  option(option)
137  {}
bool option
include namespace
JROOT::JROOTClassSelection::JROOTClassSelection ( const std::set< JROOTClassSelector > &  selection,
const bool  option = false 
)
inline

Contructor.

Parameters
selectionselection
optioninclude namespace

Definition at line 146 of file JROOTClassSelector.hh.

146  :
147  std::set<JROOTClassSelector>(selection),
148  option(option)
149  {}
bool option
include namespace
template<class T >
JROOT::JROOTClassSelection::JROOTClassSelection ( const JType< T > &  typelist,
const bool  option = false 
)
inline

Contructor.

Parameters
typelisttype list
optioninclude namespace

Definition at line 159 of file JROOTClassSelector.hh.

159  :
160  option(option)
161  {
162  JLANG::for_each(*this, typelist);
163  }
bool option
include namespace
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition: JTypeList.hh:415

Member Function Documentation

bool JROOT::JROOTClassSelection::getOption ( ) const
inline

Get option to include name space.

Returns
option

Definition at line 171 of file JROOTClassSelector.hh.

172  {
173  return option;
174  }
bool option
include namespace
template<class T >
void JROOT::JROOTClassSelection::add ( )
inline

Add given data type.

Definition at line 181 of file JROOTClassSelector.hh.

182  {
183  this->insert(JROOTClassSelector(JType<T>(), option));
184  }
Auxiliary class to select ROOT class based on class name.
bool option
include namespace
template<class T >
void JROOT::JROOTClassSelection::remove ( )
inline

Remove data type.

Definition at line 191 of file JROOTClassSelector.hh.

192  {
193  this->erase(JROOTClassSelector(JType<T>(), option));
194  }
Auxiliary class to select ROOT class based on class name.
bool option
include namespace
template<class T >
void JROOT::JROOTClassSelection::operator() ( const JType< T > &  type)
inline

Add data type.

Parameters
typedata type

Definition at line 203 of file JROOTClassSelector.hh.

204  {
205  add<T>();
206  }
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 216 of file JROOTClassSelector.hh.

217  {
218  const JROOTClassSelector selector(type, option);
219 
220  for (const_iterator i = this->begin(); i != this->end(); ++i) {
221  if (*i == selector) {
222  return true;
223  }
224  }
225 
226  return false;
227  }
Auxiliary class to select ROOT class based on class name.
bool option
include namespace
then set_variable DETECTOR set_variable OUTPUT_FILE set_variable DAQ_FILE set_variable PMT_FILE else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
template<class T >
bool JROOT::JROOTClassSelection::is_valid ( ) const
inline

Get status of given data type.

Returns
true if valid class name; else false

Definition at line 236 of file JROOTClassSelector.hh.

237  {
238  return (*this)(JType<T>());
239  }

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:

  • a '+', the remainder of the class name is added; or
  • a '-', 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 254 of file JROOTClassSelector.hh.

255  {
256  for (std::string buffer; in >> buffer; ) {
257 
258  const TRegexp regexp(buffer.substr(1).c_str());
259 
260  switch (buffer[0]) {
261 
262  case '-':
263 
264  for (JROOTClassSelection::iterator i = object.begin(); i != object.end(); ) {
265 
266  if (TString(i->c_str()).Contains(regexp))
267  object.erase(i++);
268  else
269  ++i;
270  }
271 
272  break;
273 
274  case '+':
275 
276  object.insert(buffer.substr(1));
277  break;
278 
279  default:
280 
281  object.insert(buffer);
282  break;
283  }
284  }
285 
286  return in;
287  }
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
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 297 of file JROOTClassSelector.hh.

298  {
299  for (const_iterator i = object.begin(); i != object.end(); ++i) {
300  out << *i << std::endl;
301  }
302 
303  return out;
304  }

Member Data Documentation

bool JROOT::JROOTClassSelection::option
private

include namespace

Definition at line 307 of file JROOTClassSelector.hh.


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