![]() |
Safir SDK Core
|
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::InstanceId & | GetInstanceId () 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. | |
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.
Safir::Dob::Typesystem::EntityId::EntityId | ( | ) |
Default constructor.
Safir::Dob::Typesystem::EntityId::EntityId | ( | const Dob::Typesystem::TypeId | typeId, |
const Dob::Typesystem::InstanceId & | instanceId ) |
const Dob::Typesystem::InstanceId & Safir::Dob::Typesystem::EntityId::GetInstanceId | ( | ) | const |
Get the Instance number out of the EntityId.
Referenced by Safir::Dob::Typesystem::hash_value().
Dob::Typesystem::TypeId Safir::Dob::Typesystem::EntityId::GetTypeId | ( | ) | const |
Get the type id out of the EntityId.
Referenced by Safir::Dob::Typesystem::hash_value().
bool Safir::Dob::Typesystem::EntityId::operator!= | ( | const EntityId & | other | ) | const |
Inequality operator.
Compares both the instance and the type id.
other | [in] - The EntityId to compare with. |
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.
other | [in] - The EntityId to compare with. |
bool Safir::Dob::Typesystem::EntityId::operator== | ( | const EntityId & | other | ) | const |
Equality operator.
Compares both the instance and the type id.
other | [in] - The EntityId to compare with. |
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().
void Safir::Dob::Typesystem::EntityId::SetInstanceId | ( | const Dob::Typesystem::InstanceId & | instanceId | ) |
Set the instance number of the EntityId.
instanceId | [in] - The new instance number. |
void Safir::Dob::Typesystem::EntityId::SetTypeId | ( | const Dob::Typesystem::TypeId | typeId | ) |
Set the type id of the EntityId.
typeId | [in] - The new type id. |
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.
Referenced by Safir::Dob::Typesystem::operator<<().
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.