Jpp 20.0.0-195-g190c9e876
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 > JMATH::JMath< JFirst_t, JSecond_t >

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.
 
JROOTClassSelectionadd (const JROOTClassSelection &selection)
 Add selection.
 
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.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 

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

138 :
140 {}

◆ JROOTClassSelection() [2/3]

JROOT::JROOTClassSelection::JROOTClassSelection ( const std::set< JROOTClassSelector > & selection,
const bool option = false )
inline

Contructor.

Parameters
selectionselection
optioninclude namespace

Definition at line 149 of file JROOTClassSelector.hh.

149 :
152 {}

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

162 :
164 {
165 JLANG::for_each(*this, typelist);
166 }
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 174 of file JROOTClassSelector.hh.

175 {
176 return option;
177 }

◆ add() [1/2]

JROOTClassSelection & JROOT::JROOTClassSelection::add ( const JROOTClassSelection & selection)
inline

Add selection.

Parameters
selectionselection
Returns
this selection

Definition at line 186 of file JROOTClassSelector.hh.

187 {
188 for (const auto& i : selection) {
189 this->insert(i);
190 }
191
192 return *this;
193 }

◆ add() [2/2]

template<class T >
void JROOT::JROOTClassSelection::add ( )
inline

Add given data type.

Definition at line 200 of file JROOTClassSelector.hh.

201 {
202 this->insert(JROOTClassSelector(JType<T>(), option));
203 }

◆ remove()

template<class T >
void JROOT::JROOTClassSelection::remove ( )
inline

Remove data type.

Definition at line 210 of file JROOTClassSelector.hh.

211 {
212 this->erase(JROOTClassSelector(JType<T>(), option));
213 }

◆ operator()() [1/2]

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

Add data type.

Parameters
typedata type

Definition at line 222 of file JROOTClassSelector.hh.

223 {
224 add<T>();
225 }
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 235 of file JROOTClassSelector.hh.

236 {
237 const JROOTClassSelector selector(type, option);
238
239 for (const_iterator i = this->begin(); i != this->end(); ++i) {
240 if (*i == selector) {
241 return true;
242 }
243 }
244
245 return false;
246 }

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

256 {
257 return (*this)(JType<T>());
258 }

◆ mul()

template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

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

274 {
275 for (std::string buffer; in >> buffer; ) {
276
277 const TRegexp regexp(buffer.substr(1).c_str());
278
279 switch (buffer[0]) {
280
281 case '-':
282
283 for (JROOTClassSelection::iterator i = object.begin(); i != object.end(); ) {
284
285 if (TString(i->c_str()).Contains(regexp))
286 object.erase(i++);
287 else
288 ++i;
289 }
290
291 break;
292
293 case '+':
294
295 object.insert(buffer.substr(1));
296 break;
297
298 default:
299
300 object.insert(buffer);
301 break;
302 }
303 }
304
305 return in;
306 }

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

317 {
318 for (const_iterator i = object.begin(); i != object.end(); ++i) {
319 out << *i << std::endl;
320 }
321
322 return out;
323 }

Member Data Documentation

◆ option

bool JROOT::JROOTClassSelection::option
private

include namespace

Definition at line 326 of file JROOTClassSelector.hh.


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