Yate
Public Member Functions | List of all members
SignallingCounter Class Reference

A counter class. More...

#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
 

Detailed Description

A counter class.

Counter management class. Keep a value between 0 and a given maximum one

Constructor & Destructor Documentation

◆ SignallingCounter()

SignallingCounter ( u_int32_t  maxVal)
inline

Constructor

Parameters
maxValThe maximum value for the counter

Member Function Documentation

◆ count()

u_int32_t count ( ) const
inline

Get the current value of the counter

Returns
The current value of the counter

◆ dec()

bool dec ( )
inline

Decrement the counter's value if it can

Returns
False if the counter is empty (reached 0)

◆ empty()

bool empty ( ) const
inline

Check if the counter is empty (the value is 0)

Returns
True if the counter is empty

◆ full()

bool full ( ) const
inline

Check if the counter is full (the value reached the maximum)

Returns
True if the counter is full

◆ inc()

bool inc ( )
inline

Increment the counter's value if it can

Returns
False if the counter is full (reached the maximum value)

◆ maxVal() [1/2]

u_int32_t maxVal ( ) const
inline

Get the maximum value for the counter

Returns
The maximum value for the counter

◆ maxVal() [2/2]

void maxVal ( u_int32_t  value)
inline

Set the maximum value for the counter

Parameters
valueThe new maximum value for the counter

◆ reset()

void reset ( bool  down = true)
inline

Reset the counter's value

Parameters
downTrue to reset to 0, false to reset to maxVal()

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