#include <yatesig.h>
Public Member Functions | |
SignallingCounter (u_int32_t maxVal) | |
void | maxVal (u_int32_t value) |
u_int32_t | maxVal () const |
u_int32_t | count () const |
void | reset (bool down=true) |
bool | inc () |
bool | dec () |
bool | empty () const |
bool | full () const |
Counter management class. Keep a value between 0 and a given maximum one
SignallingCounter | ( | u_int32_t | maxVal | ) | [inline] |
Constructor
maxVal | The maximum value for the counter |
void maxVal | ( | u_int32_t | value | ) | [inline] |
Set the maximum value for the counter
value | The new maximum value for the counter |
u_int32_t maxVal | ( | ) | const [inline] |
Get the maximum value for the counter
u_int32_t count | ( | ) | const [inline] |
Get the current value of the counter
void reset | ( | bool | down = true |
) | [inline] |
Reset the counter's value
down | True to reset to 0, false to reset to maxVal() |
bool inc | ( | ) | [inline] |
Increment the counter's value if it can
bool dec | ( | ) | [inline] |
Decrement the counter's value if it can
bool empty | ( | ) | const [inline] |
Check if the counter is empty (the value is 0)
bool full | ( | ) | const [inline] |
Check if the counter is full (the value reached the maximum)