Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | Friends | List of all members
JPARSER::JCounter Class Reference

Auxiliary class to handle multiple boolean-like I/O. More...

#include <JParser.hh>

Inheritance diagram for JPARSER::JCounter:
JLANG::JAbstractObjectStatus JLANG::JComparable< JFirst_t, JSecond_t > JLANG::JComparable< JFirst_t, JSecond_t >

Public Member Functions

 JCounter ()
 Default constructor. More...
 
virtual bool getStatus () const
 Get status of this counter. More...
 
bool less (const JCounter &value) const
 Compare value. More...
 
bool less (const int value) const
 Compare value. More...
 
bool more (const int value) const
 Compare value. More...
 
int getCounter () const
 Get counter. More...
 
const JCounteroperator= (const bool value)
 Set value. More...
 
 operator bool () const
 Type conversion operator. More...
 
bool operator! () const
 Negated status of this object. More...
 

Protected Attributes

int counter
 

Friends

std::istream & operator>> (std::istream &in, JCounter &object)
 Read option from input. More...
 
std::ostream & operator<< (std::ostream &out, const JCounter &object)
 Write options to output. More...
 

Detailed Description

Auxiliary class to handle multiple boolean-like I/O.

Definition at line 218 of file JParser.hh.

Constructor & Destructor Documentation

JPARSER::JCounter::JCounter ( )
inline

Default constructor.

Definition at line 227 of file JParser.hh.

227  :
228  counter(0)
229  {}

Member Function Documentation

virtual bool JPARSER::JCounter::getStatus ( ) const
inlinevirtual

Get status of this counter.

Returns
true if counter not zero; else false

Implements JLANG::JAbstractObjectStatus.

Definition at line 237 of file JParser.hh.

238  {
239  return (this->counter != 0);
240  }
bool JPARSER::JCounter::less ( const JCounter value) const
inline

Compare value.

Parameters
valuevalue
Returns
true if this counter is less than given value; else false

Definition at line 249 of file JParser.hh.

250  {
251  return this->counter < value.counter;
252  }
bool JPARSER::JCounter::less ( const int  value) const
inline

Compare value.

Parameters
valuevalue
Returns
true if this counter is less than given value; else false

Definition at line 261 of file JParser.hh.

262  {
263  return this->counter < value;
264  }
bool JPARSER::JCounter::more ( const int  value) const
inline

Compare value.

Parameters
valuevalue
Returns
true if this counter is more than given value; else false

Definition at line 273 of file JParser.hh.

274  {
275  return this->counter > value;
276  }
int JPARSER::JCounter::getCounter ( ) const
inline

Get counter.

Returns
counter

Definition at line 284 of file JParser.hh.

285  {
286  return counter;
287  }
const JCounter& JPARSER::JCounter::operator= ( const bool  value)
inline

Set value.

Note that no assignment actually takes place but the internal counter is set to one.

Parameters
valuevalue
Returns
this object

Definition at line 298 of file JParser.hh.

299  {
300  counter = 1;
301 
302  return *this;
303  }
JLANG::JAbstractObjectStatus::operator bool ( ) const
inlineinherited

Type conversion operator.

Returns
status of this object

Definition at line 33 of file JAbstractObjectStatus.hh.

34  {
35  return this->getStatus();
36  }
virtual bool getStatus() const =0
Get status of object.
bool JLANG::JAbstractObjectStatus::operator! ( ) const
inlineinherited

Negated status of this object.

Returns
negated status of this object

Definition at line 44 of file JAbstractObjectStatus.hh.

45  {
46  return !(this->getStatus());
47  }
virtual bool getStatus() const =0
Get status of object.

Friends And Related Function Documentation

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

Read option from input.

Note that no value actually is read, only the internal counter is incremented.

Parameters
ininput stream
objectoption
Returns
input stream

Definition at line 315 of file JParser.hh.

316  {
317  ++object.counter;
318 
319  return in;
320  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
std::ostream& operator<< ( std::ostream &  out,
const JCounter object 
)
friend

Write options to output.

Parameters
outoutput stream
objectoption
Returns
output stream

Definition at line 330 of file JParser.hh.

331  {
332  out << object.counter;
333 
334  return out;
335  }

Member Data Documentation

int JPARSER::JCounter::counter
protected

Definition at line 338 of file JParser.hh.


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