Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Counter Class Reference

An incrementing counter that wraps around to the beginning when it goes past its maximum value. More...

#include <Counter.h>

Inheritance diagram for Counter::

BasicObject List of all members.

Public Methods

 Counter ()
 Start the counter a 1, the min is 1, the max is 2^16. More...

 Counter (int maxNumber)
 Start the counter at 1. More...

 Counter (int minNumber, int maxNumber)
 Start the counter at minNumber, go up to maxNumber. More...

 Counter (int minNumber, int maxNumber, int startValue)
 Start the counter at startValue, with the range of numbers being [minNumber, maxNumber]. More...

 Counter (const Counter &)
 Copy constructor. More...

int getCount ()
 Return the current value of the counter. More...

int increment ()
 Add one to the counter value. More...

int decrement ()
 Subtract one from the counter value. More...

void setTo (int value)
 Set the counter to the value specified. More...

void setMin (int min)
void setMax (int max)
void toStream (std::ostream &out)

Private Attributes

int m_count
int m_minValue
int m_maxValue

Detailed Description

An incrementing counter that wraps around to the beginning when it goes past its maximum value.

Definition at line 10 of file Counter.h.


Constructor & Destructor Documentation

Counter::Counter
 

Start the counter a 1, the min is 1, the max is 2^16.

Definition at line 13 of file Counter.cpp.

Counter::Counter int maxNumber
 

Start the counter at 1.

Parameters:
maxNumber   The maximum number that this counter can get to. Only positive values allowed.

Definition at line 25 of file Counter.cpp.

Counter::Counter int minNumber,
int maxNumber
 

Start the counter at minNumber, go up to maxNumber.

Only positive values allowed.

Definition at line 36 of file Counter.cpp.

Counter::Counter int minNumber,
int maxNumber,
int startValue
 

Start the counter at startValue, with the range of numbers being [minNumber, maxNumber].

Only positive values allowed.

Definition at line 48 of file Counter.cpp.

Counter::Counter const Counter & c
 

Copy constructor.

Definition at line 59 of file Counter.cpp.


Member Function Documentation

int Counter::decrement
 

Subtract one from the counter value.

This will automatically wrap the counter around to the highest value if it goes past the lowest value.

Definition at line 87 of file Counter.cpp.

Referenced by SendWindow::onAckRecvd().

int Counter::getCount
 

Return the current value of the counter.

Definition at line 142 of file Counter.cpp.

Referenced by SendWindow::onAckRecvd(), and SendWindow::segment().

int Counter::increment
 

Add one to the counter value.

This will automatically wrap the counter around to the lowest value if it goes past the highest value.

Definition at line 71 of file Counter.cpp.

Referenced by ServiceTable::generateConnectionDescriptor(), ServiceTable::generateServiceNumber(), and SendWindow::segment().

void Counter::setMax int max
 

Definition at line 117 of file Counter.cpp.

Referenced by Counter().

void Counter::setMin int min
 

Definition at line 128 of file Counter.cpp.

Referenced by Counter().

void Counter::setTo int value
 

Set the counter to the value specified.

If above the max value, it will set it to the max value. If below the min value, it will set it to the min value.

Definition at line 102 of file Counter.cpp.

Referenced by Counter(), and ServiceTable::ServiceTable().

void Counter::toStream std::ostream & out [virtual]
 

Reimplemented from BasicObject.

Definition at line 149 of file Counter.cpp.


Member Data Documentation

int Counter::m_count [private]
 

Definition at line 28 of file Counter.h.

int Counter::m_maxValue [private]
 

Definition at line 30 of file Counter.h.

int Counter::m_minValue [private]
 

Definition at line 29 of file Counter.h.


The documentation for this class was generated from the following files:
Generated at Thu Jul 11 13:31:56 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001