Navigation
API > API/Plugins > API/Plugins/ConcertSyncClient > API/Plugins/ConcertSyncClient/FConcertClientLocalDataStore
Description
Exchanges the stored value to Desired if a stored value corresponding to Key exists, has the same type and its value is equal to Expected, otherwise, the operation fails.
| Name | CompareExchange |
| Type | function |
| Header File | /Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Public/ConcertClientLocalDataStore.h |
| Include Path | #include "ConcertClientLocalDataStore.h" |
template<typename T>
TConcertDataStoreResult < T > CompareExchange
(
const FName & Key,
const T & Expected,
const T & Desired
)
The operation result. The possible result codes are:
- EConcertDataStoreResultCode::Exchanged if the desired value was sucessfully exchanged and stored. The result holds a pointer on the newly stored value.
- EConcertDataStoreResultCode::Fetched if the stored value was not the expected one. The stored value was fetched instead. The result holds a pointer on the fetched value.
- EConcertDataStoreResultCode::NotFound if the key could not be found. The result holds a null pointer.
- EConcertDataStoreResultCode::TypeMismatch if the stored data type did not match the expected/desired type. The result holds a null pointer.
Parameters
| Name | Remarks |
|---|---|
| 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. |
| Expected | The value the caller expects to be stored. |
| Desired | The value the caller wants to store. |