1 #ifndef GALAXY_GALAXY_ID_H
2 #define GALAXY_GALAXY_ID_H
22 #pragma pack( push, 1 )
56 assert(type != ID_TYPE_UNASSIGNED);
58 assert(
static_cast<IDType>(value >> 56) == ID_TYPE_UNASSIGNED);
59 return GalaxyID(
static_cast<uint64_t
>(type) << 56 | value);
113 return value < other.value;
124 return value == other.value;
135 return !(*
this == other);
172 return value & 0xffffffffffffff;
182 return static_cast<IDType>(value >> 56);
Represents the ID of an entity used by Galaxy Peer.
Definition: GalaxyID.h:30
static GalaxyID FromRealID(IDType type, uint64_t value)
Creates GalaxyID from real ID and type.
Definition: GalaxyID.h:54
GalaxyID(void)
Default constructor.
Definition: GalaxyID.h:67
bool operator<(const GalaxyID &other) const
The lower operator.
Definition: GalaxyID.h:110
bool operator==(const GalaxyID &other) const
The equality operator.
Definition: GalaxyID.h:122
static const uint64_t UNASSIGNED_VALUE
The numerical value used when the instance of GalaxyID is not valid.
Definition: GalaxyID.h:45
IDType GetIDType() const
Returns the type of the ID.
Definition: GalaxyID.h:180
uint64_t GetRealID() const
Returns the numerical value of the real ID, without any extra flags.
Definition: GalaxyID.h:170
IDType
The type of the ID.
Definition: GalaxyID.h:36
GalaxyID & operator=(const GalaxyID &other)
The assignment operator.
Definition: GalaxyID.h:97
bool IsValid() const
Checks if the ID is valid and is assigned to an entity.
Definition: GalaxyID.h:143
GalaxyID(uint64_t _value)
Creates an instance of GalaxyID of a specified value.
Definition: GalaxyID.h:76
GalaxyID(const GalaxyID &galaxyID)
Copy constructor.
Definition: GalaxyID.h:87
bool operator!=(const GalaxyID &other) const
The inequality operator.
Definition: GalaxyID.h:133
uint64_t ToUint64() const
Returns the numerical value of the ID.
Definition: GalaxyID.h:158