GCS::GElementID Class Reference

Provides unique identification for elements. More...

#include <GElementID.h>

Collaboration diagram for GCS::GElementID:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GElementID ()
 GElementID (unsigned long ID)
 GElementID (const GElementID &original)
unsigned long getID () const
QString toString () const
bool operator== (const GElementID &id) const
bool operator!= (const GElementID &id) const
bool operator> (const GElementID &id) const
bool operator< (const GElementID &id) const
bool operator>= (const GElementID &id) const
bool operator<= (const GElementID &id) const

Static Public Member Functions

static GElementID getFreeID ()
static GIDContainer getFreeIDRange (unsigned long amount)
static void addFreeIDRange (unsigned long lower_bound, unsigned long upper_bound)
static unsigned long countFreeIDs ()

Private Attributes

unsigned long ID

Static Private Attributes

static GIDContainer FreeIDs

Detailed Description

Provides unique identification for elements.

Author:
Raphael Langerhorst
Do NOT use ID 0 for elements, it represents "no ID".

Todo:
Add support for element ID observers, they should be notified when running low on IDs


Constructor & Destructor Documentation

GCS::GElementID::GElementID (  ) 

DO NOT USE THIS CONSTRUCTOR!!!

For some reason QValueListNode requires a default constructor. to avoid instantiation without a value everywhere else this constructor is private.

Todo:
This is a workaround and should be removed as soon as Qt

does not depend on such a constructor for QValueList anymore.

Note:
looks like QMap depends on it as well, changed to public.

GCS::GElementID::GElementID ( unsigned long  ID  ) 

Public constructor initializes to given ID.

GCS::GElementID::GElementID ( const GElementID original  ) 

Copy constructor.


Member Function Documentation

void GCS::GElementID::addFreeIDRange ( unsigned long  lower_bound,
unsigned long  upper_bound 
) [static]

Adds given range of element IDs to storage.

unsigned long GCS::GElementID::countFreeIDs (  )  [static]

Returns:
the total number of available free GElementIDs.

GElementID GCS::GElementID::getFreeID (  )  [static]

The returned ID is removed from storage.

Returns:
the a free element ID

GIDContainer GCS::GElementID::getFreeIDRange ( unsigned long  amount  )  [static]

The returned IDs are removed from GElementID::FreeIDs.

Returns:
a GIDContainer with desired amount of free IDs.

unsigned long GCS::GElementID::getID (  )  const

Returns:
copy of the ID.

bool GCS::GElementID::operator!= ( const GElementID id  )  const

This enables comparing of element IDs.

Returns:
true when both GElementID objects have different IDs.

bool GCS::GElementID::operator< ( const GElementID id  )  const

This enables comparing of element IDs.

Returns:
true when this element has a lower ID than compared element.

bool GCS::GElementID::operator<= ( const GElementID id  )  const

This enables comparing of element IDs.

Returns:
true when this element has a lower or equal ID than compared element.

bool GCS::GElementID::operator== ( const GElementID id  )  const

This enables comparing of element IDs.

Returns:
true when both GElementID objects have the same ID.

bool GCS::GElementID::operator> ( const GElementID id  )  const

This enables comparing of element IDs.

Returns:
true when this element has a higher ID than compared element.

bool GCS::GElementID::operator>= ( const GElementID id  )  const

This enables comparing of element IDs.

Returns:
true when this element has a higher or equal ID than compared element.

QString GCS::GElementID::toString (  )  const

Returns:
id as string;


Member Data Documentation

GIDContainer GCS::GElementID::FreeIDs [static, private]

The Container with all available free Element IDs.

unsigned long GCS::GElementID::ID [private]

The ID is represented by an unsigned long integer.


The documentation for this class was generated from the following files:
Generated on Thu Nov 16 07:49:33 2006 for G System by  doxygen 1.4.7