Data Shard Plugin
Loading...
Searching...
No Matches
Helper Macros

Helper macros to work with C++. More...

Macros

#define RETURN_SHARD_MANAGER
 Returns the DataShardSubsystem.
 
#define RETURN_SHARD_DATA(Type, Key)
 Return a pointer to the data inside the shard.
 
#define RETURN_SHARD_DATA_CHECKED(Type, Key)
 Return a pointer to the data inside the shard.
 
#define RETURN_SHARD_DATA_COPY(Type, Key)
 Return a shard pointer to a copy of the current shard data.
 
#define RETURN_SHARD_DATA_COPY_CHECKED(Type, Key)
 Return a shard pointer to a copy of the current shard data.
 
#define GET_SHARD_DATA(Type, VarName, Key)
 Create a variable with the current shard data.
 
#define GET_SHARD_DATA_CHECKED(Type, VarName, Key)
 Create a variable with the current shard data.
 
#define GET_SHARD_DATA_PTR(Type, VarName, Key)
 Create a pointer variable pointing to the shard data.
 
#define GET_SHARD_DATA_PTR_CHECK(Type, VarName, Key)
 Create a pointer variable pointing to the shard data.
 
#define GET_SHARD_DATA_COPY(Type, VarName, Key)
 Create a shared pointer variable pointing to a copy of the current shard data.
 
#define GET_SHARD_DATA_COPY_CHECKED(Type, VarName, Key)
 Create a shared pointer variable pointing to a copy of the current shard data.
 

Detailed Description

Helper macros to work with C++.

Macro Definition Documentation

◆ GET_SHARD_DATA

#define GET_SHARD_DATA ( Type,
VarName,
Key )
Value:
const Type VarName = *(Key.GetValue<Type>(RETURN_SHARD_MANAGER, true));
#define RETURN_SHARD_MANAGER
Returns the DataShardSubsystem.
Definition DataShardMacros.h:19

Create a variable with the current shard data.

Parameters
TypeType of the data
VarNameName of the created variable
KeyKey to the shard
Note
Data will not update with the shard

◆ GET_SHARD_DATA_CHECKED

#define GET_SHARD_DATA_CHECKED ( Type,
VarName,
Key )
Value:
const Type VarName = *[&]() { \
const Type* Value = Key.GetValue<Type>(RETURN_SHARD_MANAGER); \
checkf(Value != nullptr, TEXT("Failed to find Shard for Key: %s"), *Key.ToString()); \
return Value; \
}();

Create a variable with the current shard data.

Parameters
TypeType of the data
VarNameName of the created variable
KeyKey to the shard
Note
Holds execution if data is nullptr

◆ GET_SHARD_DATA_COPY

#define GET_SHARD_DATA_COPY ( Type,
VarName,
Key )
Value:
const TSharedPtr<const Type> VarName = RETURN_SHARD_DATA_COPY(Type, Key);
#define RETURN_SHARD_DATA_COPY(Type, Key)
Return a shard pointer to a copy of the current shard data.
Definition DataShardMacros.h:62

Create a shared pointer variable pointing to a copy of the current shard data.

Parameters
TypeType of the data
VarNameName of the created shard pointer
KeyKey to the shard
Note
Data will not update with the shard

◆ GET_SHARD_DATA_COPY_CHECKED

#define GET_SHARD_DATA_COPY_CHECKED ( Type,
VarName,
Key )
Value:
const TSharedPtr<const Type> VarName = [&]() { \
const Type* Value = Key.GetValue<Type>(RETURN_SHARD_MANAGER); \
checkf(Value != nullptr, TEXT("Failed to find Shard for Key: %s"), *Key.ToString()); \
return Key.GetValueCopy<Type>(RETURN_SHARD_MANAGER); \
}();

Create a shared pointer variable pointing to a copy of the current shard data.

Parameters
TypeType of the data
VarNameName of the created shard pointer
KeyKey to the shard
Note
Data will not update with the shard
Holds execution if data is nullptr

◆ GET_SHARD_DATA_PTR

#define GET_SHARD_DATA_PTR ( Type,
VarName,
Key )
Value:
const Type* VarName = Key.GetValue<Type>(RETURN_SHARD_MANAGER);

Create a pointer variable pointing to the shard data.

Parameters
TypeType of the data
VarNameName of the created pointer
KeyKey to the shard

◆ GET_SHARD_DATA_PTR_CHECK

#define GET_SHARD_DATA_PTR_CHECK ( Type,
VarName,
Key )
Value:
const Type* VarName = [&]() { \
const Type* Value = Key.GetValue<Type>(RETURN_SHARD_MANAGER); \
checkf(Value != nullptr, TEXT("Failed to find Shard for Key: %s"), *Key.ToString()); \
return Value; \
}();

Create a pointer variable pointing to the shard data.

Parameters
TypeType of the data
VarNameName of the created pointer
KeyKey to the shard
Note
Holds execution if data is nullptr

◆ RETURN_SHARD_DATA

#define RETURN_SHARD_DATA ( Type,
Key )
Value:
Key.GetValue<Type>(RETURN_SHARD_MANAGER);

Return a pointer to the data inside the shard.

Parameters
TypeType of the data
KeyKey to the shard

◆ RETURN_SHARD_DATA_CHECKED

#define RETURN_SHARD_DATA_CHECKED ( Type,
Key )
Value:
[&]() { \
const Type* Value = Key.GetValue<Type>(RETURN_SHARD_MANAGER); \
checkf(Value != nullptr, TEXT("Failed to find Shard for Key: %s"), *Key.ToString()); \
return Value; \
}();

Return a pointer to the data inside the shard.

Parameters
TypeType of the data
KeyKey to the shard
Note
Holds execution if data is nullptr

◆ RETURN_SHARD_DATA_COPY

#define RETURN_SHARD_DATA_COPY ( Type,
Key )
Value:
Key.GetValueCopy<Type>(RETURN_SHARD_MANAGER);

Return a shard pointer to a copy of the current shard data.

Parameters
TypeThe of the data
KeyKey to the shard
Note
Data will not update with the shard

◆ RETURN_SHARD_DATA_COPY_CHECKED

#define RETURN_SHARD_DATA_COPY_CHECKED ( Type,
Key )
Value:
[&]() { \
const Type* Value = Key.GetValue<Type>(RETURN_SHARD_MANAGER); \
checkf(Value != nullptr, TEXT("Failed to find Shard for Key: %s"), *Key.ToString()); \
return Key.GetValueCopy<Type>(RETURN_SHARD_MANAGER); \
}();

Return a shard pointer to a copy of the current shard data.

Parameters
TypeType of the data
KeyKey to the shard
Note
Data will not update with the shard
Holds execution if data is nullptr

◆ RETURN_SHARD_MANAGER

#define RETURN_SHARD_MANAGER
Value:
[&]() { \
if(GEngine) \
if(GEngine->GameViewport) \
if(GEngine->GameViewport->GetGameInstance())\
{ \
const UDataShardSubsystem* Sub = GEngine->GameViewport->GetGameInstance()->GetSubsystem<UDataShardSubsystem>(); \
check(Sub) \
return Sub; \
} \
return static_cast<const UDataShardSubsystem*>(nullptr); \
} ()

Returns the DataShardSubsystem.