#include <counter.h>
Inheritance diagram for ucommon::counter:
Public Member Functions | |
counter (unsigned limit) | |
Initialize integer counter for a range of values. | |
counter () | |
Initialize integer counter of unknown size. | |
unsigned | get (void) |
Get the next counter value. | |
unsigned | operator * () |
Reference next counter value through pointer operation. | |
operator unsigned () | |
Reference next counter value by casting to integer. | |
void | operator= (unsigned value) |
Assign the value of the counter. | |
unsigned | range (void) |
Get the range of values before recycling. |
This is an automatic counting object that is used to retrieve a new integer value between 0 and n each time the object is referenced. When reaching the last n value, the object restarts at 0, and so is used to retrieve a sequence of values in order.
Definition at line 42 of file counter.h.
ucommon::counter::counter | ( | unsigned | limit | ) |
Initialize integer counter for a range of values.
limit | before recycling to zero. |
unsigned ucommon::counter::get | ( | void | ) |
Get the next counter value.
Reimplemented in ucommon::SeqCounter, and ucommon::sequence< T >.
unsigned ucommon::counter::operator * | ( | ) | [inline] |
Reference next counter value through pointer operation.
Reimplemented in ucommon::sequence< T >.
ucommon::counter::operator unsigned | ( | ) | [inline] |
void ucommon::counter::operator= | ( | unsigned | value | ) |
unsigned ucommon::counter::range | ( | void | ) | [inline] |