Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::Typesystem::EntityId Class Reference

Class containing the identity of an entity. More...

#include <Safir/Dob/Typesystem/EntityId.h>

Public Member Functions

 EntityId ()
 Default constructor.
 
 EntityId (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::InstanceId &instanceId)
 Constructor with type id and instance arguments.
 
void RemoveString ()
 Remove the included string from the instance id of the entity id.
 
const Dob::Typesystem::InstanceIdGetInstanceId () const
 Get the Instance number out of the EntityId.
 
void SetInstanceId (const Dob::Typesystem::InstanceId &instanceId)
 Set the instance number of the EntityId.
 
Dob::Typesystem::TypeId GetTypeId () const
 Get the type id out of the EntityId.
 
void SetTypeId (const Dob::Typesystem::TypeId typeId)
 Set the type id of the EntityId.
 
bool operator== (const EntityId &other) const
 Equality operator.
 
bool operator!= (const EntityId &other) const
 Inequality operator.
 
bool operator< (const EntityId &other) const
 Less-than operator.
 
DOTS_CPP_API const std::wstring ToString () const
 Convert an entity id to a string.
 
DOTS_CPP_API const std::wstring ToStringNumeric () const
 Convert an entity id to a string that has only numeric parts.
 

Detailed Description

Class containing the identity of an entity.

This class represents the identity of a DOB-entity. It consists of a type identifier (TypeId) and an instance number.

Constructor & Destructor Documentation

◆ EntityId() [1/2]

Safir::Dob::Typesystem::EntityId::EntityId ( )

Default constructor.

◆ EntityId() [2/2]

Safir::Dob::Typesystem::EntityId::EntityId ( const Dob::Typesystem::TypeId typeId,
const Dob::Typesystem::InstanceId & instanceId )

Constructor with type id and instance arguments.

Creates an EntityId with the given typeid and instance number.

Parameters
typeId[in] - The type id of the entity that the EntityId is to refer to.
instanceId[in] - The instance of the entity that the EntityId is to refer to.

Member Function Documentation

◆ GetInstanceId()

const Dob::Typesystem::InstanceId & Safir::Dob::Typesystem::EntityId::GetInstanceId ( ) const

Get the Instance number out of the EntityId.

Returns
The instance number.

Referenced by Safir::Dob::Typesystem::hash_value().

Here is the caller graph for this function:

◆ GetTypeId()

Dob::Typesystem::TypeId Safir::Dob::Typesystem::EntityId::GetTypeId ( ) const

Get the type id out of the EntityId.

Returns
The type id.

Referenced by Safir::Dob::Typesystem::hash_value().

Here is the caller graph for this function:

◆ operator!=()

bool Safir::Dob::Typesystem::EntityId::operator!= ( const EntityId & other) const

Inequality operator.

Compares both the instance and the type id.

Parameters
other[in] - The EntityId to compare with.

◆ operator<()

bool Safir::Dob::Typesystem::EntityId::operator< ( const EntityId & other) const

Less-than operator.

This is provided to allow EntityIds to be stored in STL containers that need strict weak ordering. Compares both the instance and the type id.

Parameters
other[in] - The EntityId to compare with.

◆ operator==()

bool Safir::Dob::Typesystem::EntityId::operator== ( const EntityId & other) const

Equality operator.

Compares both the instance and the type id.

Parameters
other[in] - The EntityId to compare with.

◆ RemoveString()

void Safir::Dob::Typesystem::EntityId::RemoveString ( )

Remove the included string from the instance id of the entity id.

This is meant to be used when this type is used as a member of a Dob object. Using this call before the object gets serialized to binary or xml (i.e. also before sending it anywhere) means that the string will not be included when the object is sent.

References Safir::Dob::Typesystem::InstanceId::RemoveString().

Here is the call graph for this function:

◆ SetInstanceId()

void Safir::Dob::Typesystem::EntityId::SetInstanceId ( const Dob::Typesystem::InstanceId & instanceId)

Set the instance number of the EntityId.

Parameters
instanceId[in] - The new instance number.

◆ SetTypeId()

void Safir::Dob::Typesystem::EntityId::SetTypeId ( const Dob::Typesystem::TypeId typeId)

Set the type id of the EntityId.

Parameters
typeId[in] - The new type id.

◆ ToString()

DOTS_CPP_API const std::wstring Safir::Dob::Typesystem::EntityId::ToString ( ) const

Convert an entity id to a string.

Will convert the entity id to a string on the form "(Safir.Dob.Entity, 10)". This is meant to be used for debug output only. If the type does not exist output will be on the form "(Unknown type: 32873478348, 10)" If the string representation of the instance exists, the numerical instance id may be replaced by that string.

The purpose of this function is for debug output and such. The resulting string can not reliably be parsed or passed to constructors to recreate the same entity id.

Returns
The entity id as a string.

Referenced by Safir::Dob::Typesystem::operator<<().

Here is the caller graph for this function:

◆ ToStringNumeric()

DOTS_CPP_API const std::wstring Safir::Dob::Typesystem::EntityId::ToStringNumeric ( ) const

Convert an entity id to a string that has only numeric parts.

Will convert the entity id to a string on the form "(10109232329848, 2884849309093)". Use the normal ToString method if you need something for debug output. This is intended to be used when a consistent string is needed.

Returns
The entity id as a string.