Module |
|
Header |
/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Public/ConcertClientLocalDataStore.h |
Include |
#include "ConcertClientLocalDataStore.h" |
template<typename T>
TConcertDataStoreResult< T > FetchOrAdd
(
const FName & Key,
const T & InitialValue
)
Searches the store for the specified key, if not found, adds a new key/value pair, otherwise, if the stored value type matches the initial value type, fetches the stored value. The function accepts a USTRUCT() type or a supported basic type directly. To store complex types such as TArray<> TMap<> or TSet<>, wrap the type in a USTRUCT().
The operation result. The possible result codes are:
EConcertDataStoreResultCode::Added if the key/value was added. The result holds a pointer on the newly added value.
EConcertDataStoreResultCode::Fetched if the key was already taken and type matched. The result holds a pointer on the fetched value.
EConcertDataStoreResultCode::TypeMismatch if the key was already taken but the types did not match. The result holds a null pointer.
Parameter |
Description |
---|---|
T |
Any USTRUCT() struct or a supported basic types (int8, uint8, int16, uint16, int32, uint32, int64, uint64, float, double, bool, FName, FText, FString). |
Key |
The value name to fetch or add. |
InitialValue |
The value to store if the key doesn't already exist. |