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...
#include <DataShardKey.h>
|
| FDataShardKey () |
|
| FDataShardKey (const FString &InName) |
|
| FDataShardKey (UObject *InOwner, const FString &InName) |
|
template<typename T> |
const T * | GetValue (const UDataShardSubsystem *Subsystem, const bool bCheck=false) const |
|
template<typename T> |
TSharedPtr< const T > | GetValueCopy (const UDataShardSubsystem *Subsystem, const bool bCheck=false) const |
|
bool | SetValue (const UDataShardSubsystem *Subsystem, const UObject *Container, const FName &PropertyName) const |
|
bool | Invalidate (UDataShardSubsystem *Subsystem) const |
|
bool | Remove (UDataShardSubsystem *Subsystem) const |
|
bool | IsValid (const UDataShardSubsystem *Subsystem) const |
|
FString | ToString () const |
|
AActor * | GetActor () const |
|
UObject * | GetObject () const |
|
FString | GetName () const |
|
bool | operator== (const FDataShardKey &Other) const |
|
bool | IsValid () const |
|
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.
◆ FDataShardKey() [1/3]
DataShardKey::FDataShardKey |
( |
| ) |
|
|
inline |
◆ FDataShardKey() [2/3]
DataShardKey::FDataShardKey |
( |
const FString & | InName | ) |
|
Creates a global key with a name
- Parameters
-
InName | - A unique name for this key within global scope |
◆ FDataShardKey() [3/3]
DataShardKey::FDataShardKey |
( |
UObject * | InOwner, |
|
|
const FString & | InName ) |
|
inline |
Creates a key with the specified owner and name
- Parameters
-
InOwner | - The UObject that owns this key (typically an Actor) |
InName | - A unique name for this key within the scope of the owner |
◆ GetActor()
AActor * DataShardKey::GetActor |
( |
| ) |
const |
|
inline |
Returns the owner as an AActor if it is one, otherwise nullptr
◆ GetName()
FString DataShardKey::GetName |
( |
| ) |
const |
|
inline |
Returns the name portion of this key
◆ GetObject()
UObject * DataShardKey::GetObject |
( |
| ) |
const |
|
inline |
Returns the owner object of this key
◆ GetValue()
template<typename T>
const T * DataShardKey::GetValue |
( |
const UDataShardSubsystem * | Subsystem, |
|
|
const bool | bCheck = false ) const |
Gets the value stored in the shard associated with this key
- Template Parameters
-
T | - The expected data type of the shard value |
- Parameters
-
Subsystem | - The DataShardSubsystem to retrieve the value from |
bCheck | - If true, will verify the data type matches before returning |
- Returns
- Pointer to the typed value, or nullptr if key is invalid or type mismatch
- Warning
- You need to include DataShardTemplates.h for this function to compile!
◆ GetValueCopy()
template<typename T>
TSharedPtr< const T > DataShardKey::GetValueCopy |
( |
const UDataShardSubsystem * | Subsystem, |
|
|
const bool | bCheck = false ) const |
Gets a copy of the value stored in the shard associated with this key
- Template Parameters
-
T | - The expected data type of the shard value |
- Parameters
-
Subsystem | - The DataShardSubsystem to retrieve the value from |
bCheck | - If true, will verify the data type matches before copying |
- Returns
- Shared pointer to a copy of the value, or nullptr if key is invalid or type mismatch
- Note
- The copy will not be updated if the original value changes
- Warning
- You need to include DataShardTemplates.h for this function to compile!
◆ Invalidate()
bool DataShardKey::Invalidate |
( |
UDataShardSubsystem * | Subsystem | ) |
const |
Invalidates this key in the subsystem by removing it Decreases the reference count for the associated shard
- Parameters
-
- Returns
- true if the key was successfully removed, false otherwise
◆ IsValid() [1/2]
bool DataShardKey::IsValid |
( |
| ) |
const |
|
inline |
Checks if this key has a valid structure (non-null owner and non-empty name).
- Warning
- This does not check if the key exists in a subsystem!
- Returns
- true if the key has a valid structure, false otherwise
◆ IsValid() [2/2]
bool DataShardKey::IsValid |
( |
const UDataShardSubsystem * | Subsystem | ) |
const |
Checks if this key exists in the subsystem and points to a valid shard
- Parameters
-
- Returns
- true if the key exists and points to a valid shard, false otherwise
◆ operator==()
bool DataShardKey::operator== |
( |
const FDataShardKey & | Other | ) |
const |
|
inline |
Compares this key with another for equality
- Parameters
-
Other | - The key to compare with |
- Returns
- true if both keys have the same owner and name, false otherwise
◆ Remove()
bool DataShardKey::Remove |
( |
UDataShardSubsystem * | Subsystem | ) |
const |
Removes this key from the subsystem (alias for Invalidate)
- Parameters
-
- Returns
- true if the key was successfully removed, false otherwise
◆ SetValue()
bool DataShardKey::SetValue |
( |
const UDataShardSubsystem * | Subsystem, |
|
|
const UObject * | Container, |
|
|
const FName & | PropertyName ) const |
Sets the value of the shard associated with this key using a property from a UObject
- Parameters
-
Subsystem | - The DataShardSubsystem to set the value in |
Container | - The UObject containing the property to copy from |
PropertyName | - The name of the property within the Container to use |
- Returns
- true if the value was successfully set, false otherwise
◆ ToString()
FString DataShardKey::ToString |
( |
| ) |
const |
|
inline |
Returns a string representation of this key
- Returns
- String with owner and name information, formatted for debugging