CIdentifier Class Reference

Globally used identification classThis class is the basic class to use in order to identify objects in the OpenViBE platform. It can be used for class identification, for object identification and any user needed identification process. More...

Public Member Functions

OpenViBE::CString toString (void) const
 Converts this identifier into an OpenViBE string. More...
 
OpenViBE::boolean fromString (const OpenViBE::CString &rString)
 Reads a an OpenViBE string to extract this identifier. More...
 
OpenViBE::uint64 toUInteger (void) const
 Converts this identifier into an unsigned 64 bits integer. More...
 
Constructors
 CIdentifier (void)
 Default constructor. More...
 
 CIdentifier (const OpenViBE::uint32 ui32Identifier1, const OpenViBE::uint32 ui32Identifier2)
 32 bits integer based constructor More...
 
 CIdentifier (const OpenViBE::uint64 ui64Identifier)
 64 bits integer based constructor More...
 
 CIdentifier (const OpenViBE::CIdentifier &rIdentifier)
 Copy constructor. More...
 

Static Public Member Functions

static OpenViBE::CIdentifier random (void)
 Creates a random identifier. More...
 

Protected Attributes

OpenViBE::uint64 m_ui64Identifier
 the 64 bit identifier value
 

Operators

OpenViBE::CIdentifieroperator= (const OpenViBE::CIdentifier &rIdentifier)
 Affectation operator. More...
 
OpenViBE::CIdentifieroperator++ (void)
 Increments this identifier by 1. More...
 
OpenViBE::CIdentifieroperator-- (void)
 Decrements this identifier by 1. More...
 
OV_API OpenViBE::boolean operator== (const OpenViBE::CIdentifier &rIdentifier1, const OpenViBE::CIdentifier &rIdentifier2)
 Equality test operator. More...
 
OV_API OpenViBE::boolean operator!= (const OpenViBE::CIdentifier &rIdentifier1, const OpenViBE::CIdentifier &rIdentifier2)
 Difference test operator. More...
 
OV_API OpenViBE::boolean operator< (const OpenViBE::CIdentifier &rIdentifier1, const OpenViBE::CIdentifier &rIdentifier2)
 Order test operator. More...
 
OV_API OpenViBE::boolean operator> (const OpenViBE::CIdentifier &rIdentifier1, const OpenViBE::CIdentifier &rIdentifier2)
 Order test operator. More...
 
OV_API OpenViBE::boolean operator<= (const OpenViBE::CIdentifier &rIdentifier1, const OpenViBE::CIdentifier &rIdentifier2)
 Order test operator. More...
 
OV_API OpenViBE::boolean operator>= (const OpenViBE::CIdentifier &rIdentifier1, const OpenViBE::CIdentifier &rIdentifier2)
 Order test operator. More...
 

Detailed Description

Globally used identification class

This class is the basic class to use in order to identify objects in the OpenViBE platform. It can be used for class identification, for object identification and any user needed identification process.

Author
Yann Renard (INRIA/IRISA)
Date
2006-06-16 The identification of the OpenViBE platform is based on 64 bits integers. This allows more than 1 800 000 000 000 000 000 identifiers to exist... I won't write that this should be enough ;) (this is (c) Bill Gates) but at least... it may fit our today needs !

This class is heavily used in the OpenViBE::IObject class. Also, the OpenViBE specification gives serveral already defined class identifiers the developer should know of. For this, let you have a look to the documentation of ov_defines.h !

See also
ov_defines.h

Constructor & Destructor Documentation

CIdentifier ( void  )

Default constructor.

Builds up the 64 bits identifier initialized to OV_UndefinedIdentifier.

References CIdentifier::m_ui64Identifier.

Referenced by CIdentifier::random().

CIdentifier ( const OpenViBE::uint32  ui32Identifier1,
const OpenViBE::uint32  ui32Identifier2 
)

32 bits integer based constructor

Parameters
ui32Identifier1[in] : the first part of the identifier
ui32Identifier2[in] : the second part of the identifier

Builds up the 64 bits identifier given its two 32 bits components.

CIdentifier ( const OpenViBE::uint64  ui64Identifier)

64 bits integer based constructor

Parameters
ui64Identifier[in] : The identifier
CIdentifier ( const OpenViBE::CIdentifier rIdentifier)

Copy constructor.

Parameters
rIdentifier[in] : the identifier to initialize this identifier from

Builds up the 64 bits identifier exacly the same as given rIdentifier parameter.

Member Function Documentation

CIdentifier & operator= ( const OpenViBE::CIdentifier rIdentifier)

Affectation operator.

Parameters
rIdentifier[in] : the identifier to initialize this identifier from
Returns
this identifier

Reinitializes the 64 bits identifier exactly the same as given rIdentifier parameter.

References CIdentifier::m_ui64Identifier.

CIdentifier & operator++ ( void  )

Increments this identifier by 1.

Returns
this identifier
Note
if this identifier is OV_UndefinedIdentifier, it is not incremented
if this idenfitier is not OV_UndefinedIdentifier, it can not becomre OV_UndefinedIdentifier after being incremented

References CIdentifier::m_ui64Identifier.

CIdentifier & operator-- ( void  )

Decrements this identifier by 1.

Returns
this identifier
Note
if this identifier is OV_UndefinedIdentifier, it is not decremented
if this idenfitier is not OV_UndefinedIdentifier, it can not becomre OV_UndefinedIdentifier after being decremented

References CIdentifier::m_ui64Identifier.

CString toString ( void  ) const

Converts this identifier into an OpenViBE string.

Returns
This identifier represented as an OpenViBE string

References CIdentifier::m_ui64Identifier.

boolean fromString ( const OpenViBE::CString rString)

Reads a an OpenViBE string to extract this identifier.

Parameters
rString[in] : the string to convert
Returns
true in case of success.
false in case of error.

References CIdentifier::m_ui64Identifier.

uint64 toUInteger ( void  ) const

Converts this identifier into an unsigned 64 bits integer.

Returns
The unsigned integer converted identifier
Warning
Use this function with care, identifiers should not be considered as integers. Actually, the internal 64 bits representation may change, resulting in code port needs if you use this function

References CIdentifier::m_ui64Identifier.

CIdentifier random ( void  )
static

Creates a random identifier.

Returns
a random identifier
Note
The returned identifier can not be OV_UndefinedIdentifier

References CIdentifier::CIdentifier().

Friends And Related Function Documentation

OV_API OpenViBE::boolean operator== ( const OpenViBE::CIdentifier rIdentifier1,
const OpenViBE::CIdentifier rIdentifier2 
)
friend

Equality test operator.

Parameters
rIdentifier1[in] : the first identifier to compare
rIdentifier2[in] : the second identifier to compare
Returns
true if the two identifiers are equal,
false if the two identifiers are different

Compares both 32 bits parts of the two identifiers and checks if those are equal or not.

See also
operator!=
OV_API OpenViBE::boolean operator!= ( const OpenViBE::CIdentifier rIdentifier1,
const OpenViBE::CIdentifier rIdentifier2 
)
friend

Difference test operator.

Parameters
rIdentifier1[in] : the first identifier to compare
rIdentifier2[in] : the second identifier to compare
Returns
true if the two identifiers are different,
false if the two identifiers are equal

Compares both 32 bits parts of the two identifiers and checks if those are equal or not.

See also
operator==
OV_API OpenViBE::boolean operator< ( const OpenViBE::CIdentifier rIdentifier1,
const OpenViBE::CIdentifier rIdentifier2 
)
friend

Order test operator.

Parameters
rIdentifier1[in] : the first identifier to compare
rIdentifier2[in] : the second identifier to compare
Returns
true if the first identifier is less than the second one
false if the first identifier is greater or equal to the second one

Compares both 32 bits parts of the two identifiers.

See also
operator>
operator==
OV_API OpenViBE::boolean operator> ( const OpenViBE::CIdentifier rIdentifier1,
const OpenViBE::CIdentifier rIdentifier2 
)
friend

Order test operator.

Parameters
rIdentifier1[in] : the first identifier to compare
rIdentifier2[in] : the second identifier to compare
Returns
true if the first identifier is greater than the second one
false if the first identifier is less or equal to the second one

Compares both 32 bits parts of the two identifiers.

See also
operator<
operator==
OV_API OpenViBE::boolean operator<= ( const OpenViBE::CIdentifier rIdentifier1,
const OpenViBE::CIdentifier rIdentifier2 
)
friend

Order test operator.

Parameters
rIdentifier1[in] : the first identifier to compare
rIdentifier2[in] : the second identifier to compare
Returns
true if the first identifier is less or equal than the second one
false if the first identifier is greater to the second one

Compares both 32 bits parts of the two identifiers.

See also
operator>
operator==
OV_API OpenViBE::boolean operator>= ( const OpenViBE::CIdentifier rIdentifier1,
const OpenViBE::CIdentifier rIdentifier2 
)
friend

Order test operator.

Parameters
rIdentifier1[in] : the first identifier to compare
rIdentifier2[in] : the second identifier to compare
Returns
true if the first identifier is greater or equal than the second one
false if the first identifier is less to the second one

Compares both 32 bits parts of the two identifiers.

See also
operator<
operator==