3.2 Chronometer::Unit

The Chronometer::Unit class is an enumeration class for chronometer time granularity measure units. Table 3.1 gives the possible enumerated values this class can hold. The Chronometer class must be initialised using a time unit.




ValueMeaning


usec micro seconds, millionst of a second
msec milli seconds, thousandst of a second
hsec hundredst seconds, hundredst of a second
tsec tenthst seconds, tenthst of a second
sec seconds, plain second



Table 3.1: Chronometer units, their value and their meaning.


Synopsis


  #include <lyric/Chronometer.hpp>
  
  class Chronometer::Unit
  {
  public:
    enum Val { usec, msec, hsec, tsec, sec };
    ~Unit ();
    Unit ();
    Unit (Val val);
    Unit (const Unit& unit);
    Unit& operator = (const Unit& unit);
    operator int () const;
    bool operator == (const Unit& unit) const;
    bool operator != (const Unit& unit) const;
    bool operator == (Val val) const;
    bool operator != (Val val) const;
  };


Description


˜Chronometer::Unit ()
Destroys this chronometer unit. Does pretty nothing.

Chronometer::Unit ()
Sets this chronometer unit to msec.

Chronometer::Unit (Chronometer::Unit::Val val)
Sets this chronometer unit to to val.

Chronometer::Unit (const Chronometer::Unit& unit)
Clones unit into this chronometer unit.

Chronometer::Unit& operator = (const Chronometer::Unit& unit)
Clones unit into this chronometer unit.

operator int () const
Returns this chronometer unit as an int. Thus Chronometer::Unit objects can be used as switch expressions.

bool operator == (const Chronometer::Unit& unit) const
Returns true if unit and this unit are the same, false if not.

bool operator != (const Chronometer::Unit& unit) const
Returns false if unit and this unit are the same, true if not.

bool operator == (Chronometer::Unit::Val& val) const
Returns true if this stores a chronometer unit matching the given value, false if not.

bool operator != (const Chronometer::Unit::Val& val) const
Returns false if this does not store a chronometer unit matching the given value, true if it does.