GOG GALAXY SDK Documentation
GalaxyID Class Reference

Represents the ID of an entity used by Galaxy Peer. More...

#include <GalaxyID.h>

Public Types

enum  IDType { ID_TYPE_UNASSIGNED , ID_TYPE_LOBBY , ID_TYPE_USER }
 The type of the ID.
 

Public Member Functions

 GalaxyID (void)
 Default constructor. More...
 
 GalaxyID (uint64_t _value)
 Creates an instance of GalaxyID of a specified value. More...
 
 GalaxyID (const GalaxyID &galaxyID)
 Copy constructor. More...
 
GalaxyIDoperator= (const GalaxyID &other)
 The assignment operator. More...
 
bool operator< (const GalaxyID &other) const
 The lower operator. More...
 
bool operator== (const GalaxyID &other) const
 The equality operator. More...
 
bool operator!= (const GalaxyID &other) const
 The inequality operator. More...
 
bool IsValid () const
 Checks if the ID is valid and is assigned to an entity. More...
 
uint64_t ToUint64 () const
 Returns the numerical value of the ID. More...
 
uint64_t GetRealID () const
 Returns the numerical value of the real ID, without any extra flags. More...
 
IDType GetIDType () const
 Returns the type of the ID. More...
 

Static Public Member Functions

static GalaxyID FromRealID (IDType type, uint64_t value)
 Creates GalaxyID from real ID and type. More...
 

Static Public Attributes

static const uint64_t UNASSIGNED_VALUE = 0
 The numerical value used when the instance of GalaxyID is not valid.
 

Detailed Description

Represents the ID of an entity used by Galaxy Peer.

This can be the ID of either a lobby or a Galaxy user.

Constructor & Destructor Documentation

◆ GalaxyID() [1/3]

GalaxyID ( void  )
inline

Default constructor.

Creates an instance of GalaxyID that is invalid and of unknown kind.

◆ GalaxyID() [2/3]

GalaxyID ( uint64_t  _value)
inline

Creates an instance of GalaxyID of a specified value.

Parameters
[in]_valueThe numerical value of the ID.

◆ GalaxyID() [3/3]

GalaxyID ( const GalaxyID galaxyID)
inline

Copy constructor.

Creates a copy of another instance of GalaxyID.

Parameters
[in]galaxyIDThe instance of GalaxyID to copy from.

Member Function Documentation

◆ FromRealID()

static GalaxyID FromRealID ( IDType  type,
uint64_t  value 
)
inlinestatic

Creates GalaxyID from real ID and type.

Parameters
[in]typeThe type of the ID.
[in]valueThe real ID value.
Returns
The GalaxyID.

◆ GetIDType()

IDType GetIDType ( ) const
inline

Returns the type of the ID.

Returns
The type of the ID.

◆ GetRealID()

uint64_t GetRealID ( ) const
inline

Returns the numerical value of the real ID, without any extra flags.

Remarks
The value is of the same form as the one used in Galaxy web services.
Returns
The numerical value of the ID, valid only when the ID is valid.

◆ IsValid()

bool IsValid ( ) const
inline

Checks if the ID is valid and is assigned to an entity.

Returns
true if the ID is valid, false otherwise.

◆ operator!=()

bool operator!= ( const GalaxyID other) const
inline

The inequality operator.

The opposite to the equality operator.

Parameters
[in]otherAnother instance of GalaxyID to compare to.
Returns
false if the instances are equal, true otherwise.

◆ operator<()

bool operator< ( const GalaxyID other) const
inline

The lower operator.

It is supposed to be used to compare only valid instances of GalaxyID that are assigned to entities of the same type.

Parameters
[in]otherAnother instance of GalaxyID to compare to.
Returns
true if this instance is lower, false otherwise.

◆ operator=()

GalaxyID& operator= ( const GalaxyID other)
inline

The assignment operator.

Makes the ID equal to another ID.

Parameters
[in]otherThe instance of GalaxyID to copy from.
Returns
A reference to this ID.

◆ operator==()

bool operator== ( const GalaxyID other) const
inline

The equality operator.

Might be used to compare all sorts of GalaxyID.

Parameters
[in]otherAnother instance of GalaxyID to compare to.
Returns
true if the instances are equal, false otherwise.

◆ ToUint64()

uint64_t ToUint64 ( ) const
inline

Returns the numerical value of the ID.

Remarks
The value comprises the real ID and possibly some extra flags that can be used e.g. for type-checking, which can be changed in the future. If you need the value in the same form as the one used in Galaxy web services, i.e. without any additional flags, use the GetRealID() method instead.
Returns
The numerical value of the ID, valid only when the ID is valid.