Singleton for generating unique numbers. More...
#include <SequenceNumber.h>
Public Member Functions | |
unsigned long | getSequenceNumber () |
virtual | ~SequenceNumber () |
Static Public Member Functions | |
static SequenceNumber * | getInstance () |
Private Member Functions | |
SequenceNumber () | |
Private Attributes | |
unsigned long | m_NextValue |
Mutex | m_NextValueMutex |
Static Private Attributes | |
static SequenceNumber * | instance = 0 |
Singleton for generating unique numbers.
Definition at line 24 of file SequenceNumber.h.
SequenceNumber::~SequenceNumber | ( | ) | [virtual] |
Destructor
Definition at line 41 of file SequenceNumber.cpp.
SequenceNumber::SequenceNumber | ( | ) | [private] |
Private default Constructor (-->Singleton)
Definition at line 27 of file SequenceNumber.cpp.
SequenceNumber * SequenceNumber::getInstance | ( | ) | [static] |
Returns instance of the singleton
Definition at line 18 of file SequenceNumber.cpp.
unsigned long SequenceNumber::getSequenceNumber | ( | ) |
Returns system-wide unique IDs for any kind of objects which than can be distinguished. This method is protected with a mutex and thus only allows one thread at a time to enter it.
Definition at line 32 of file SequenceNumber.cpp.
SequenceNumber * SequenceNumber::instance = 0 [static, private] |
Single instance of the SequenceNumber
Definition at line 57 of file SequenceNumber.h.
unsigned long SequenceNumber::m_NextValue [private] |
Number, that will be the next unique ID for a new message
Definition at line 62 of file SequenceNumber.h.
Mutex SequenceNumber::m_NextValueMutex [private] |
Mutex which is needed for incrementing m_NextValue
Definition at line 67 of file SequenceNumber.h.