BankAndCustomer
Loading...
Searching...
No Matches
glo::ObjID Class Reference

An object ID consists of the class ID, a database ID and the actual unique object number (all unsigned long). More...

#include <GloObjID.h>

Classes

struct  HashFunction
 

Public Member Functions

 ObjID ()
 
 ObjID (unsigned long ulClassID, unsigned long ulBaseID, unsigned long ulObjCounter)
 
 ObjID (const std::string &sObjId, const std::string &sSeparator=".")
 
 ObjID (const ObjID &rT)
 
virtual ~ObjID ()
 
bool isNULL () const
 
void setNULL ()
 
void setID (unsigned long ulClassID, unsigned long ulBaseID, unsigned long ulObjCounter)
 
int setID (const std::string &sObjId, const std::string &sSeparator=".")
 
void setClassID (unsigned long ulClassID)
 
void setBaseID (unsigned long ulBaseID)
 
void setObjCounter (unsigned long ulObjCounter)
 
unsigned long getClassID () const
 
unsigned long getBaseID () const
 
unsigned long getObjCounter () const
 
std::string toString () const
 
ObjIDoperator= (const ObjID &rT)
 
bool operator== (const ObjID &rT) const
 Comparison operator.
 
bool operator!= (const ObjID &rT) const
 Comparison operator.
 
bool operator> (const ObjID &rT) const
 The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.
 
bool operator>= (const ObjID &rT) const
 The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.
 
bool operator< (const ObjID &rT) const
 The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.
 
bool operator<= (const ObjID &rT) const
 The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.
 

Static Public Member Functions

static bool IsValidObjID (const std::string &rsObjID, const std::string &sSeparator=".")
 

Private Attributes

unsigned long m_ulClassID
 
unsigned long m_ulBaseID
 
unsigned long m_ulObjCounter
 

Friends

std::ostream & operator<< (std::ostream &rOStream, const ObjID &rObjID)
 
std::istream & operator>> (std::istream &rIStream, ObjID &rObjID)
 

Detailed Description

An object ID consists of the class ID, a database ID and the actual unique object number (all unsigned long).

Each persistent object gets an object ID and is therefore uniquely identifiable in the database. An object ID is assigned by GlobalObjects when a persistent object is registered in the database. An object ID is unique and is not reused when a persistent object is deleted.

References in the database are made using the object ID.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ ObjID() [1/4]

glo::ObjID::ObjID ( )

Standard constructor.

◆ ObjID() [2/4]

glo::ObjID::ObjID ( unsigned long ulClassID,
unsigned long ulBaseID,
unsigned long ulObjCounter )

Constructor with parameter passing sets the object ID.

Parameters
[in]ulClassIDThe class ID.
[in]ulBaseIDThe database ID.
[in]ulObjCounterThe object counter.
See also

◆ ObjID() [3/4]

glo::ObjID::ObjID ( const std::string & sObjId,
const std::string & sSeparator = "." )

Constructor with parameter passing.
Takes the class ID, database ID and object counter from a string.
For example, if this is in the following form: "2.0.123" is the results:

  • Class ID = 2
  • Database ID = 0
  • object counter = 123.

Leading and following spaces are ignored.

Parameters
[in]sObjIdClass ID, database ID and object counter in one string.
[in]sSeparatorThe separator character (default ".").
Exceptions
eut::ErrorNExceptionAn exception is thrown if an error occurs.

◆ ObjID() [4/4]

glo::ObjID::ObjID ( const ObjID & rT)

Copy constructor.

Parameters
[in]rTThe data is copied from this object.

◆ ~ObjID()

virtual glo::ObjID::~ObjID ( )
virtual

Destructor

Member Function Documentation

◆ getBaseID()

unsigned long glo::ObjID::getBaseID ( ) const

Returns the database ID.

Returns
See above.
See also
m_ulBaseID

◆ getClassID()

unsigned long glo::ObjID::getClassID ( ) const

Returns the class ID.

Returns
See above.
See also
m_ulClassID

◆ getObjCounter()

unsigned long glo::ObjID::getObjCounter ( ) const

Returns the object counter.

Returns
See above.
See also
m_ulObjCounter

◆ isNULL()

bool glo::ObjID::isNULL ( ) const

Checks if the class ID has a value, i.e. is valid.

Returns
If true, then the class ID == 0.

◆ IsValidObjID()

static bool glo::ObjID::IsValidObjID ( const std::string & rsObjID,
const std::string & sSeparator = "." )
static

Checks the passed string whether it represents a valid Object ID.

Parameters
[in]rsObjIDReference to the string to be checked.
[in]sSeparatorThe separator character (default ".").
Returns
If 'true', sthe passed string represents a valid Object ID.

◆ operator!=()

bool glo::ObjID::operator!= ( const ObjID & rT) const

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ operator<()

bool glo::ObjID::operator< ( const ObjID & rT) const

The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.

The ObjID 999.1.1 is greater than 888,999,999.

Parameters
[in]rTThe object to be compared with this one.

◆ operator<=()

bool glo::ObjID::operator<= ( const ObjID & rT) const

The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.

The ObjID 999.1.1 is greater than 888,999,999.

Parameters
[in]rTThe object to be compared with this one.

◆ operator=()

ObjID & glo::ObjID::operator= ( const ObjID & rT)

Assignment operator.

Parameters
[in]rTThe data is transferred from this object.

◆ operator==()

bool glo::ObjID::operator== ( const ObjID & rT) const

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ operator>()

bool glo::ObjID::operator> ( const ObjID & rT) const

The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.

The ObjID 999.1.1 is greater than 888,999,999.

Parameters
[in]rTThe object to be compared with this one.

◆ operator>=()

bool glo::ObjID::operator>= ( const ObjID & rT) const

The size comparison is made from the m_ulClassID via the m_ulBaseID to the m_ulObjCounter in this order.

The ObjID 999.1.1 is greater than 888,999,999.

Parameters
[in]rTThe object to be compared with this one.

◆ setBaseID()

void glo::ObjID::setBaseID ( unsigned long ulBaseID)

Sets the database ID.

Parameters
[in]ulBaseIDThe database ID.
See also
m_ulBaseID

◆ setClassID()

void glo::ObjID::setClassID ( unsigned long ulClassID)

Sets the class ID.

Parameters
[in]ulClassIDThe class ID.
See also
m_ulClassID

◆ setID() [1/2]

int glo::ObjID::setID ( const std::string & sObjId,
const std::string & sSeparator = "." )

Takes the class ID, database ID and object counter from a string.
For example, if this is in the following form: "2.0.123" is the results:

  • Class ID = 2
  • Database ID = 0
  • object counter = 123.

Leading and following spaces are ignored.

Parameters
[in]sObjIdClass ID, database ID and object counter in one string.
[in]sSeparatorThe separator character (default ".").
Returns
A return < 0 indicates an error.

◆ setID() [2/2]

void glo::ObjID::setID ( unsigned long ulClassID,
unsigned long ulBaseID,
unsigned long ulObjCounter )

Sets the object ID.

Parameters
[in]ulClassIDThe class ID.
[in]ulBaseIDThe database ID.
[in]ulObjCounterThe object counter.
See also

◆ setNULL()

void glo::ObjID::setNULL ( )

Sets all attributes to 0.

◆ setObjCounter()

void glo::ObjID::setObjCounter ( unsigned long ulObjCounter)

Sets the object counter.

Parameters
[in]ulObjCounterThe object counter.
See also
m_ulObjCounter

◆ toString()

std::string glo::ObjID::toString ( ) const

Returns the object ID in a string. The separator is the default value ".

Returns
The object ID in a string.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & rOStream,
const ObjID & rObjID )
friend

◆ operator>>

std::istream & operator>> ( std::istream & rIStream,
ObjID & rObjID )
friend

Member Data Documentation

◆ m_ulBaseID

unsigned long glo::ObjID::m_ulBaseID
private

The database ID.

Note
In order to write applications that manage their data on different GloServer instances, it is essential that each database has a unique ID in order to have a unique object id.

◆ m_ulClassID

unsigned long glo::ObjID::m_ulClassID
private

The class ID.

◆ m_ulObjCounter

unsigned long glo::ObjID::m_ulObjCounter
private

The object counter.


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