ucc::counter Class Reference

Automatic integer counting class. More...

#include <counter.h>

Inheritance diagram for ucc::counter:
Inheritance graph
[legend]

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.
 operator unsigned ()
 Reference next counter value by casting to integer.
unsigned operator* ()
 Reference next counter value through pointer operation.
void operator= (unsigned value)
 Assign the value of the counter.
unsigned range (void)
 Get the range of values before recycling.

Detailed Description

Automatic integer counting class.

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.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 42 of file counter.h.


Constructor & Destructor Documentation

ucc::counter::counter ( unsigned  limit  ) 

Initialize integer counter for a range of values.

Parameters:
limit before recycling to zero.

Member Function Documentation

unsigned ucc::counter::get ( void   ) 

Get the next counter value.

Returns:
next counter value.

Reimplemented in ucc::SeqCounter, and ucc::sequence< T >.

ucc::counter::operator unsigned (  )  [inline]

Reference next counter value by casting to integer.

Returns:
next counter value.

Definition at line 83 of file counter.h.

unsigned ucc::counter::operator* (  )  [inline]

Reference next counter value through pointer operation.

Returns:
next counter value.

Reimplemented in ucc::sequence< T >.

Definition at line 76 of file counter.h.

void ucc::counter::operator= ( unsigned  value  ) 

Assign the value of the counter.

Parameters:
value to assign.

Reimplemented in ucc::SeqCounter.

unsigned ucc::counter::range ( void   )  [inline]

Get the range of values before recycling.

Returns:
counter limit.

Definition at line 69 of file counter.h.


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208