Jpp  18.1.0
the software that should make you happy
 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 override
 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 238 of file JParser.hh.

Constructor & Destructor Documentation

JPARSER::JCounter::JCounter ( )
inline

Default constructor.

Definition at line 247 of file JParser.hh.

247  :
248  counter(0)
249  {}

Member Function Documentation

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

Get status of this counter.

Returns
true if counter not zero; else false

Implements JLANG::JAbstractObjectStatus.

Definition at line 257 of file JParser.hh.

258  {
259  return (this->counter != 0);
260  }
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 269 of file JParser.hh.

270  {
271  return this->counter < value.counter;
272  }
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 281 of file JParser.hh.

282  {
283  return this->counter < value;
284  }
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 293 of file JParser.hh.

294  {
295  return this->counter > value;
296  }
int JPARSER::JCounter::getCounter ( ) const
inline

Get counter.

Returns
counter

Definition at line 304 of file JParser.hh.

305  {
306  return counter;
307  }
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 318 of file JParser.hh.

319  {
320  counter = 1;
321 
322  return *this;
323  }
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 335 of file JParser.hh.

336  {
337  ++object.counter;
338 
339  return in;
340  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] 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:46
std::ostream& operator<< ( std::ostream &  out,
const JCounter object 
)
friend

Write options to output.

Parameters
outoutput stream
objectoption
Returns
output stream

Definition at line 350 of file JParser.hh.

351  {
352  out << object.counter;
353 
354  return out;
355  }

Member Data Documentation

int JPARSER::JCounter::counter
protected

Definition at line 358 of file JParser.hh.


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