TrueReality  v0.1.1912
trBase::UniqueId Class Reference

This class creates a GUID, or a Unique ID that is used through out TR to identify and distinguish one object from another. More...

#include <UniqueId.h>

Inheritance diagram for trBase::UniqueId:
Collaboration diagram for trBase::UniqueId:

Public Types

using BaseClass = trBase::SmrtClass
 
- Public Types inherited from trBase::SmrtClass
using BaseClass = osg::Referenced
 

Public Member Functions

 UniqueId (bool createNewId=true)
 Holds the class type name for efficient comparisons. More...
 
 UniqueId (const UniqueId &toCopy)
 Makes a copy of the passed in Unique ID GUID. More...
 
 UniqueId (const std::string &toCopy)
 Makes the Unique ID equal to the ID in the passes in string. More...
 
virtual ~UniqueId ()
 dtor More...
 
virtual const std::string & GetType () const override
 Returns the class type. More...
 
const std::string ToString () const
 Convert the current GUID into a string. More...
 
void FromString (const std::string &idString)
 Assign the GUID value to this instance from a string. More...
 
bool IsNull () const
 Returns true if the GUID is equal to 00000000-0000-0000-0000-000000000000. More...
 
UniqueIdoperator= (const UniqueId &id)
 Copy the GUID from another unique id. More...
 
UniqueIdoperator= (const UniqueId *id)
 Copy the GUID from another unique id. More...
 
UniqueIdoperator= (const std::string &id)
 Copy the GUID form a string. More...
 
bool operator== (const UniqueId &id) const
 Equality operator. More...
 
bool operator!= (const UniqueId &id) const
 Inequality operator. More...
 
bool operator< (const UniqueId &id) const
 Less-than comparison operator. More...
 
bool operator> (const UniqueId &id) const
 Greater-than comparison operator. More...
 
- Public Member Functions inherited from trBase::SmrtClass
 SmrtClass ()
 Adds an easy and swappable access to the base class. More...
 
 SmrtClass (bool threadSafeRefUnref)
 Constructor. More...
 
 SmrtClass (const SmrtClass &inst)
 Copy constructor. More...
 
virtual bool GetThreadSafeRefUnref ()
 Get whether a mutex is used to ensure Ref() and UnRef() are thread safe. More...
 
OpenThreads::Mutex * GetRefMutex () const
 Get the mutex used to ensure thread safety of Ref()/UnRef(). More...
 
int Ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int Unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int UnRefNoDelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int ReferenceCount () const
 Return the number of pointers currently referencing this object. More...
 

Static Public Attributes

static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trBase::UniqueId")
 Adds an easy and swappable access to the base class. More...
 

Protected Attributes

implIdmGUIDPtr = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from trBase::SmrtClass
static OpenThreads::Mutex * GetGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all trBase::SmrtClass. More...
 
- Protected Member Functions inherited from trBase::SmrtClass
 ~SmrtClass ()
 

Detailed Description

This class creates a GUID, or a Unique ID that is used through out TR to identify and distinguish one object from another.

Definition at line 42 of file UniqueId.h.

Member Typedef Documentation

◆ BaseClass

Definition at line 47 of file UniqueId.h.

Constructor & Destructor Documentation

◆ UniqueId() [1/3]

trBase::UniqueId::UniqueId ( bool  createNewId = true)
explicit

Holds the class type name for efficient comparisons.

Parameters
createNewIdif true, generates a new id. If not, it sets the id to empty.

Definition at line 254 of file UniqueId.cpp.

References trBase::implId::implId().

Here is the call graph for this function:

◆ UniqueId() [2/3]

trBase::UniqueId::UniqueId ( const UniqueId toCopy)

Makes a copy of the passed in Unique ID GUID.

Definition at line 260 of file UniqueId.cpp.

References trBase::implId::GetData(), and mGUIDPtr.

Here is the call graph for this function:

◆ UniqueId() [3/3]

trBase::UniqueId::UniqueId ( const std::string &  toCopy)
explicit

Makes the Unique ID equal to the ID in the passes in string.

The string should be in 00000000-0000-0000-0000-000000000000 format.

Definition at line 272 of file UniqueId.cpp.

References mGUIDPtr.

◆ ~UniqueId()

trBase::UniqueId::~UniqueId ( )
virtual

dtor

Definition at line 278 of file UniqueId.cpp.

References mGUIDPtr.

Member Function Documentation

◆ FromString()

void trBase::UniqueId::FromString ( const std::string &  idString)

Assign the GUID value to this instance from a string.

The = operator can be used to accomplish the same thing. The string should be in 00000000-0000-0000-0000-000000000000 format.

Definition at line 300 of file UniqueId.cpp.

References trBase::implId::FromString(), and mGUIDPtr.

Here is the call graph for this function:

◆ GetType()

const std::string & trBase::UniqueId::GetType ( ) const
overridevirtual

Returns the class type.

Implements trBase::SmrtClass.

Definition at line 288 of file UniqueId.cpp.

References CLASS_TYPE.

◆ IsNull()

bool trBase::UniqueId::IsNull ( ) const

Returns true if the GUID is equal to 00000000-0000-0000-0000-000000000000.

Definition at line 306 of file UniqueId.cpp.

References trBase::implId::IsNull(), and mGUIDPtr.

Here is the call graph for this function:

◆ operator!=()

bool trBase::UniqueId::operator!= ( const UniqueId id) const

Inequality operator.

Parameters
idThe identifier.
Returns
True if the parameters are not considered equivalent.

Definition at line 339 of file UniqueId.cpp.

References mGUIDPtr.

◆ operator<()

bool trBase::UniqueId::operator< ( const UniqueId id) const

Less-than comparison operator.

Parameters
idThe identifier.
Returns
True if the first parameter is less than the second.

Definition at line 345 of file UniqueId.cpp.

References mGUIDPtr.

◆ operator=() [1/3]

UniqueId & trBase::UniqueId::operator= ( const UniqueId id)

Copy the GUID from another unique id.

The assignment operator is public so that unique id's can be changed if they are member variables. Use const to control when they are changed.

Definition at line 312 of file UniqueId.cpp.

References mGUIDPtr.

◆ operator=() [2/3]

UniqueId & trBase::UniqueId::operator= ( const UniqueId id)

Copy the GUID from another unique id.

The assignment operator is public so that unique id's can be changed if they are member variables. Use const to control when they are changed.

Definition at line 319 of file UniqueId.cpp.

References mGUIDPtr.

◆ operator=() [3/3]

UniqueId & trBase::UniqueId::operator= ( const std::string &  id)

Copy the GUID form a string.

The assignment operator is public so that unique id's can be changed if they are member variables. Use const to control when they are changed.

Definition at line 326 of file UniqueId.cpp.

References mGUIDPtr.

◆ operator==()

bool trBase::UniqueId::operator== ( const UniqueId id) const

Equality operator.

Parameters
idThe identifier.
Returns
True if the parameters are considered equivalent.

Definition at line 333 of file UniqueId.cpp.

References mGUIDPtr.

◆ operator>()

bool trBase::UniqueId::operator> ( const UniqueId id) const

Greater-than comparison operator.

Parameters
idThe identifier.
Returns
True if the first parameter is greater than to the second.

Definition at line 351 of file UniqueId.cpp.

References mGUIDPtr.

◆ ToString()

const std::string trBase::UniqueId::ToString ( ) const

Convert the current GUID into a string.

Definition at line 294 of file UniqueId.cpp.

References mGUIDPtr, and trBase::implId::ToString().

Referenced by trManager::MessageBase::MessageBase(), and trManager::MessageBase::~MessageBase().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ CLASS_TYPE

const trUtil::RefStr trBase::UniqueId::CLASS_TYPE = trUtil::RefStr("trBase::UniqueId")
static

Adds an easy and swappable access to the base class.

Definition at line 49 of file UniqueId.h.

Referenced by GetType().

◆ mGUIDPtr

implId* trBase::UniqueId::mGUIDPtr = nullptr
protected

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