Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
 JROOTClassSelection (const std::set< JROOTClassSelector > &selection, const bool option=false)
 Contructor.
 
template<class T >
 JROOTClassSelection (const JType< T > &typelist, const bool option=false)
 Contructor.
 
bool getOption () const
 Get option to include name space.
 
template<class T >
void add ()
 Add given data type.
 
template<class T >
void remove ()
 Remove data type.
 
template<class T >
void operator() (const JType< T > &type)
 Add data type.
 
template<class T >
bool operator() (const JType< T > &type) const
 Get status of given data type.
 
template<class T >
bool is_valid () const
 Get status of given data type.
 

Private Attributes

bool option
 include namespace
 

Friends

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

Detailed Description

Auxiliary class for ROOT class selection.

Definition at line 127 of file JROOTClassSelector.hh.

Constructor & Destructor Documentation

◆ JROOTClassSelection() [1/3]

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

Contructor.

Parameters
optioninclude namespace

Definition at line 135 of file JROOTClassSelector.hh.

135 :
137 {}

◆ JROOTClassSelection() [2/3]

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 :
149 {}

◆ JROOTClassSelection() [3/3]

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 :
161 {
162 JLANG::for_each(*this, typelist);
163 }
void for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Definition JTypeList.hh:414

Member Function Documentation

◆ getOption()

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 }

◆ add()

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 }

◆ remove()

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 }

◆ operator()() [1/2]

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 }
void add()
Add given data type.

◆ 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 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 }

◆ is_valid()

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 Symbol 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:

  • 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 }

◆ 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 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

◆ option

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: