decUniqueID Class Reference

Unique ID. More...

#include <decUniqueID.h>

List of all members.

Public Member Functions

Constructors and Destructors
 decUniqueID ()
 Creates a new unique id object with the value 0.
 decUniqueID (const decUniqueID &id)
 Creates a new unique id object with the value of another id.
 ~decUniqueID ()
 Cleans up unique id object.
Management
int GetBitCount () const
 Retrieves the bit count.
void SetBitCount (int bitCount)
 Sets the bit count.
int GetByteAt (int position) const
 Retrieves the byte at the given position in LSB.
void SetByteAt (int position, int value)
 Sets the byte at the given position in LSB to the given value.
void Increment ()
 Increment the id by 1.
void Reset ()
 Resets the id to 0 with a bit count of 8.
Operators
decUniqueIDoperator= (const decUniqueID &id)
 Sets this id to the value of another id.
bool operator== (const decUniqueID &id) const
 Determines if the ids are equal.
bool operator!= (const decUniqueID &id) const
 Determines if the ids are not equal.

Detailed Description

Unique ID.

Stores a unique id useful for identifying objects across the network or on persistent storage. The ID has a variable bit count which has to be a multiple of 8. Therefore you do not have to worry about id overflow or using too many data for few ids. The id can be incremented by one. This is useful if a counter id is kept that is used to initialize new ids with. Unique ids are stored as an array of bytes. You can retrieve and alter the bytes individually.

Author:
Plüss Roland.
Version:
1.0
Date:
2008

Constructor & Destructor Documentation

decUniqueID::decUniqueID (  )

Creates a new unique id object with the value 0.

decUniqueID::decUniqueID ( const decUniqueID id )

Creates a new unique id object with the value of another id.

decUniqueID::~decUniqueID (  )

Cleans up unique id object.


Member Function Documentation

int decUniqueID::GetBitCount (  ) const [inline]

Retrieves the bit count.

int decUniqueID::GetByteAt ( int  position ) const

Retrieves the byte at the given position in LSB.

void decUniqueID::Increment (  )

Increment the id by 1.

Increases the bit count by 8 if the new value does not fit anymore.

bool decUniqueID::operator!= ( const decUniqueID id ) const

Determines if the ids are not equal.

decUniqueID& decUniqueID::operator= ( const decUniqueID id )

Sets this id to the value of another id.

bool decUniqueID::operator== ( const decUniqueID id ) const

Determines if the ids are equal.

void decUniqueID::Reset (  )

Resets the id to 0 with a bit count of 8.

void decUniqueID::SetBitCount ( int  bitCount )

Sets the bit count.

The id is reset to 0 no matter if the bit count changed or not.

void decUniqueID::SetByteAt ( int  position,
int  value 
)

Sets the byte at the given position in LSB to the given value.


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