shark::Counter Class Reference

Models a counter that can be incremented and decremented and prevents from overflowing. More...

#include <shark/Core/Counter.h>

List of all members.

Public Member Functions

 Counter ()
 Default c'tor.
 Counter (const Counter &rhs)
 Constructs a counter from the given one.
Counteroperator= (const Counter &rhs)
 Assignment operator.
template<typename Scalar >
bool operator== (const Scalar &rhs) const
 Equality comparator.
template<typename Scalar >
bool operator< (const Scalar &rhs) const
 Equality comparator.
const Counteroperator++ () const
 Preincrement operator.
Counter operator++ (int) const
 Postincrement operator.
void operator-- () const
Counteroperator++ ()
 Preincrement operator.
Counter operator++ (int)
 Postincrement operator.
void operator-- ()
void reset () const
 Resets this instance to 0.
 operator unsigned int () const
 Casts this instance to unsigned int.

Protected Attributes

unsigned int m_counter
 Counter value, default:0.

Detailed Description

Models a counter that can be incremented and decremented and prevents from overflowing.

Definition at line 45 of file Counter.h.


Constructor & Destructor Documentation

Default c'tor.

Definition at line 51 of file Counter.h.

shark::Counter::Counter ( const Counter rhs) [inline]

Constructs a counter from the given one.

Definition at line 56 of file Counter.h.


Member Function Documentation

shark::Counter::operator unsigned int ( ) const [inline]

Casts this instance to unsigned int.

Definition at line 145 of file Counter.h.

References m_counter.

const Counter& shark::Counter::operator++ ( ) const [inline]

Preincrement operator.

Returns:
An immutable reference to this object.

Definition at line 93 of file Counter.h.

References m_counter.

Counter shark::Counter::operator++ ( int  ) const [inline]

Postincrement operator.

Returns:
An incremented copy of this instance.

Definition at line 102 of file Counter.h.

References m_counter.

Counter& shark::Counter::operator++ ( ) [inline]

Preincrement operator.

Returns:
A mutable reference to this object.

Definition at line 116 of file Counter.h.

References m_counter.

Counter shark::Counter::operator++ ( int  ) [inline]

Postincrement operator.

Returns:
An incremented copy of this instance.

Definition at line 125 of file Counter.h.

References m_counter.

void shark::Counter::operator-- ( ) const [inline]

Definition at line 108 of file Counter.h.

References m_counter.

void shark::Counter::operator-- ( ) [inline]

Definition at line 131 of file Counter.h.

References m_counter.

template<typename Scalar >
bool shark::Counter::operator< ( const Scalar &  rhs) const [inline]

Equality comparator.

Parameters:
[in]rhsThe scalar to compare with.
Returns:
true if this counter values is smaller than the supplied scalar, false otherwise.

Definition at line 85 of file Counter.h.

References m_counter.

Counter& shark::Counter::operator= ( const Counter rhs) [inline]

Assignment operator.

Parameters:
[in]rhsThe instance to assign from.
Returns:
A mutable reference to this instance.

Definition at line 64 of file Counter.h.

References m_counter.

template<typename Scalar >
bool shark::Counter::operator== ( const Scalar &  rhs) const [inline]

Equality comparator.

Parameters:
[in]rhsThe instance to compare with.
Returns:
true if both counter values are equal, false otherwise.

Definition at line 75 of file Counter.h.

References m_counter.

void shark::Counter::reset ( ) const [inline]

Resets this instance to 0.

Definition at line 138 of file Counter.h.

References m_counter.


Member Data Documentation

unsigned int shark::Counter::m_counter [mutable, protected]

Counter value, default:0.

Definition at line 150 of file Counter.h.

Referenced by operator unsigned int(), operator++(), operator--(), operator<(), operator=(), operator==(), and reset().


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