Open 3D Engine AtomCore API Reference 26.05.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::Data::InstanceId Struct Reference

#include <InstanceId.h>

Public Types

using SubIdContainer = AZStd::fixed_vector< uint32_t, SubIdCapacity >
 

Public Member Functions

 AZ_TYPE_INFO (InstanceId, "{0E59A635-07E8-419F-A0F2-90E0CE9C0AD6}")
 
bool IsValid () const
 
bool operator< (const InstanceId &rhs) const
 
bool operator== (const InstanceId &rhs) const
 
bool operator!= (const InstanceId &rhs) const
 
template<class StringType >
StringType ToString () const
 
template<class StringType >
void ToString (StringType &result) const
 
const Uuid & GetGuid () const
 

Static Public Member Functions

static InstanceId CreateFromAsset (const Asset< AssetData > &asset, const SubIdContainer &subIds={})
 
static InstanceId CreateFromAssetId (const AssetId &assetId, const SubIdContainer &subIds={})
 
static InstanceId CreateName (const char *name, const SubIdContainer &subIds={})
 
static InstanceId CreateData (const void *data, size_t dataSize, const SubIdContainer &subIds={})
 
static InstanceId CreateUuid (const AZ::Uuid &guid, const SubIdContainer &subIds={})
 
static InstanceId CreateRandom ()
 

Static Public Attributes

static constexpr const int SubIdCapacity = 4
 

Detailed Description

InstanceId is a unique identifier for an Instance in an InstanceDatabase. Instances are used primarily to control de-duplication of 'instances' created from 'assets'. As a result, this class mirrors the structure of asset id (by including the sub-id) in order to make translation easy. However, the types are not related in order to add some type safety to the system.

Member Function Documentation

◆ CreateData()

static InstanceId AZ::Data::InstanceId::CreateData ( const void *  data,
size_t  dataSize,
const SubIdContainer &  subIds = {} 
)
static

Creates an InstanceId with a GUID constructed from the data buffer. Additional sub IDs can be provided by the system creating the instances.

◆ CreateFromAsset()

static InstanceId AZ::Data::InstanceId::CreateFromAsset ( const Asset< AssetData > &  asset,
const SubIdContainer &  subIds = {} 
)
static

Creates an instance id from an asset. The GUID will be copied from the asset id. The first sub id will be the asset id sub id. The second sub id will be the asset creation token, or AZ::Data::s_defaultCreationToken if it is not available. Any additional sub IDs will be added after that.

◆ CreateFromAssetId()

static InstanceId AZ::Data::InstanceId::CreateFromAssetId ( const AssetId &  assetId,
const SubIdContainer &  subIds = {} 
)
static

Creates an instance id from an asset id. The GUID will be copied from the asset id. The first sub id will be the asset id sub id. The second sub id will be AZ::Data::s_defaultCreationToken so that it is uniform with CreateFromAsset. Any additional sub IDs will be added after that.

◆ CreateName()

static InstanceId AZ::Data::InstanceId::CreateName ( const char *  name,
const SubIdContainer &  subIds = {} 
)
static

Creates an InstanceId with a GUID constructed from the name string. Additional sub IDs can be provided by the system creating the instances.

◆ CreateRandom()

static InstanceId AZ::Data::InstanceId::CreateRandom ( )
static

Creates a random InstanceId.

◆ CreateUuid()

static InstanceId AZ::Data::InstanceId::CreateUuid ( const AZ::Uuid &  guid,
const SubIdContainer &  subIds = {} 
)
static

Creates an InstanceId with a GUID constructed from the UUID. Additional sub IDs can be provided by the system creating the instances.

Member Data Documentation

◆ SubIdCapacity

constexpr const int AZ::Data::InstanceId::SubIdCapacity = 4
staticconstexpr

Support assigning multiple sub IDs for additional uniqueness between instances. For asset related instances, the first two sub IDs are reserved for the asset id sub id and the creation token, if available. Otherwise, any unreserved or unused sub IDs can be assigned according to the needs of the system managing instances.


The documentation for this struct was generated from the following file: