These are the core classes.
More...
|
struct | DataShardKey |
| A key that uniquely identifies and provides access to data shards in the DataShard system.
DataShardKey combines an object reference (owner) and a string name to form a unique identifier, that can be used to access and manage data within the DataShardSubsystem. More...
|
|
class | DataShardObject |
| DataShardObject is the core container class for data in the DataShard system.
This class provides a flexible data storage mechanism that can hold any Unreal property type.
It uses a type-erased byte buffer approach with a property reference to correctly interpret the stored data.
The system maintains these objects in a pool (DataShardPool) for efficient reuse.
Key capabilities: More...
|
|
class | DataShardSubsystem |
| DataShardSubsystem manages the creation, access, and lifecycle of DataShards.
DataShards are a flexible data-sharing system that allows game objects to store and access type-safe data throughout the game. More...
|
|
|
bool | DataShardSubsystem::CreateShard (const FDataShardKey &Key, const FProperty *InProperty, const void *InData=nullptr) |
|
bool | DataShardSubsystem::CreateShard (const FDataShardKey &Key, const UObject *Container, const FName &PropertyName) |
|
bool | DataShardSubsystem::GetShardData (const FDataShardKey &Key, const void *&OutData) const |
|
template<typename T> |
const T * | DataShardSubsystem::GetShardData (const FDataShardKey &Key, const bool bCheck=false) const |
|
template<typename T> |
const T * | DataShardSubsystem::GetShardData (const int32 &ID, const bool bCheck=false) const |
|
template<typename T> |
TSharedPtr< const T > | DataShardSubsystem::GetShardDataCopy (const FDataShardKey &Key, const bool bCheck=false) const |
|
template<typename T> |
TSharedPtr< const T > | DataShardSubsystem::GetShardDataCopy (const int32 &ID, const bool bCheck=false) const |
|
bool | DataShardSubsystem::SetShardData (const FDataShardKey &Key, const void *InData, const FProperty *InProperty) const |
|
bool | DataShardSubsystem::SetShardData (const FDataShardKey &Key, const UObject *Container, const FName &PropertyName) const |
|
bool | DataShardSubsystem::RemoveKey (const FDataShardKey &Key) |
|
bool | DataShardSubsystem::CreateBoundKey (const FDataShardKey &Parent, const FDataShardKey &KeyInfo, FDataShardKey &OutKey) |
|
FDataShardKey | DataShardSubsystem::CreateBoundKey (const FDataShardKey &Parent, const FDataShardKey &KeyInfo) |
|
These are the core classes.
◆ CreateBoundKey() [1/2]
FDataShardKey DataShardSubsystem::CreateBoundKey |
( |
const FDataShardKey & | Parent, |
|
|
const FDataShardKey & | KeyInfo ) |
Creates and returns a new key that references the same shard as an existing key This allows multiple actors to share the same data
- Parameters
-
Parent | - The existing key that points to the shard |
KeyInfo | - Information for the new key (object owner and name) |
- Returns
- The newly created key (will be invalid if creation failed)
◆ CreateBoundKey() [2/2]
bool DataShardSubsystem::CreateBoundKey |
( |
const FDataShardKey & | Parent, |
|
|
const FDataShardKey & | KeyInfo, |
|
|
FDataShardKey & | OutKey ) |
Creates a new key that references the same shard as an existing key This allows multiple actors to share the same data
- Parameters
-
Parent | - The existing key that points to the shard |
KeyInfo | - Information for the new key (object owner and name) |
OutKey | - [Out] The newly created key if successful |
- Returns
- true if the new bound key was created successfully, false if the parent key is invalid
◆ CreateShard() [1/2]
bool DataShardSubsystem::CreateShard |
( |
const FDataShardKey & | Key, |
|
|
const FProperty * | InProperty, |
|
|
const void * | InData = nullptr ) |
Creates a new data shard and initializes it with the specified property and data
- Parameters
-
Key | - The key used to access and identify the shard. Contains owner object and name |
InProperty | - The property that defines the data type and structure (will be copied) |
InData | - Pointer to initial data to copy into the shard. If nullptr, the shard is created with default values |
- Returns
- true if the shard was successfully created, false if invalid parameters or if the key already exists
◆ CreateShard() [2/2]
bool DataShardSubsystem::CreateShard |
( |
const FDataShardKey & | Key, |
|
|
const UObject * | Container, |
|
|
const FName & | PropertyName ) |
Creates a new data shard using values from a property in a UObject
- Parameters
-
Key | - The key used to access and identify the shard. Contains owner object and name |
Container | - The UObject containing the property to copy data from |
PropertyName | - The name of the property within the Container to source data from |
- Returns
- true if the shard was successfully created, false if invalid parameters or if the key already exists
◆ GetShardData() [1/3]
template<typename T>
const T * DataShardSubsystem::GetShardData |
( |
const FDataShardKey & | Key, |
|
|
const bool | bCheck = false ) const |
Template function to get typed data from a shard
- Template Parameters
-
T | - The data type expected to be stored in the shard |
- Parameters
-
Key | - The key of the shard to access |
bCheck | - If true, will check the shard exist |
- Returns
- Pointer to the typed data (nullptr if not found or type mismatch)
- Note
- The returned pointer is owned by the shard and should not be deleted by the caller
◆ GetShardData() [2/3]
bool DataShardSubsystem::GetShardData |
( |
const FDataShardKey & | Key, |
|
|
const void *& | OutData ) const |
Retrieves a pointer to the raw data stored in a shard
- Parameters
-
Key | - The key of the shard to access |
OutData | - [Out] Reference to a void pointer that will be set to point to the shard data |
- Returns
- true if the data was found and OutData was set, false otherwise
- Note
- The caller is responsible for casting the data to the correct type
◆ GetShardData() [3/3]
template<typename T>
const T * DataShardSubsystem::GetShardData |
( |
const int32 & | ID, |
|
|
const bool | bCheck = false ) const |
Template function to get typed data from a shard
- Template Parameters
-
T | - The data type expected to be stored in the shard |
- Parameters
-
ID | - The ID of the shard to access |
bCheck | - If true, will check the shard exist |
- Returns
- Pointer to the typed data (nullptr if not found or type mismatch)
- Note
- The returned pointer is owned by the shard and should not be deleted by the caller
◆ GetShardDataCopy() [1/2]
template<typename T>
TSharedPtr< const T > DataShardSubsystem::GetShardDataCopy |
( |
const FDataShardKey & | Key, |
|
|
const bool | bCheck = false ) const |
Creates and returns a copy of data stored in a shard
- Template Parameters
-
T | - The data type expected to be stored in the shard |
- Parameters
-
Key | - The key of the shard to access |
bCheck | - If true, will verify the shard contains the expected data type |
- Returns
- Shared pointer to a copy of the data (nullptr if not found or type mismatch)
- Note
- The returned copy will not be updated if the original shard data changes
◆ GetShardDataCopy() [2/2]
template<typename T>
TSharedPtr< const T > DataShardSubsystem::GetShardDataCopy |
( |
const int32 & | ID, |
|
|
const bool | bCheck = false ) const |
Creates and returns a copy of data stored in a shard
- Template Parameters
-
T | - The data type expected to be stored in the shard |
- Parameters
-
ID | - The ID of the shard to access |
bCheck | - If true, will verify the shard contains the expected data type |
- Returns
- Shared pointer to a copy of the data (nullptr if not found or type mismatch)
- Note
- The returned copy will not be updated if the original shard data changes
◆ RemoveKey()
bool DataShardSubsystem::RemoveKey |
( |
const FDataShardKey & | Key | ) |
|
Removes a key and decrements the reference count for its associated shard If the reference count reaches zero, the shard will be marked for garbage collection
- Parameters
-
- Returns
- true if the key was found and removed successfully, false otherwise
◆ SetShardData() [1/2]
bool DataShardSubsystem::SetShardData |
( |
const FDataShardKey & | Key, |
|
|
const UObject * | Container, |
|
|
const FName & | PropertyName ) const |
Updates the data stored in an existing shard using values from a property in a UObject
- Parameters
-
Key | - The key of the shard to update |
Container | - The UObject containing the property to copy data from |
PropertyName | - The name of the property within the Container to source data from |
- Returns
- true if the data was successfully updated, false if the shard wasn't found or the property type doesn't match
◆ SetShardData() [2/2]
bool DataShardSubsystem::SetShardData |
( |
const FDataShardKey & | Key, |
|
|
const void * | InData, |
|
|
const FProperty * | InProperty ) const |
Updates the data stored in an existing shard
- Parameters
-
Key | - The key of the shard to update |
InData | - Pointer to the new data to copy into the shard |
InProperty | - The property that defines the data type and structure (must match the shard's existing property type) |
- Returns
- true if the data was successfully updated, false if the shard wasn't found or the property type doesn't match