FConcertDataStore

Maintains a type-safe key/value map where the values are USTRUCT() structs serialized into a [FConcertDataStore_StoreValue](API\Plugins\ConcertSyncCore\FConcertDataStore_StoreValue).

Windows
MacOS
Linux

References

Module

ConcertSyncCore

Header

/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncCore/Source/ConcertSyncCore/Public/ConcertDataStore.h

Include

#include "ConcertDataStore.h"

Syntax

class FConcertDataStore

Remarks

Maintains a type-safe key/value map where the values are USTRUCT() structs serialized into a FConcertDataStore_StoreValue. Each key/value pair has a version, starting at 1 which incremented every times the value change.

The implementation is not thread safe. It is left to the user to synchronize access to the store.How to set up a value in the store.template<typenameT>voidMyClass::Store(constFName&Key,constT&Value){//WrapsTintoitscorrespondingUSTRUCT()ifthisisnotalreadyaUSTRUCT()consttypenameTConcertDataStoreType<T>::StructType&StructWrappedValue=TConcertDataStoreType<T>::AsStructType(Value);//Serializethevalue.FConcertSessionSerializedPayloadSerializedValue;SerializedValue.SetPayload(TConcertDataStoreType<T>::StructType::StaticStruct(),&StructWrappedValue);//Storethevalueatversion1.DataStore.Store(Key,TConcertDataStoreType::GetFName(),SerializedValue);}

How to read a value from the store.template<typenameT>TOptional<T>MyClass::Fetch(constFName&Key){FConcertDataStoreResultResult=DataStore.Fetch(Key,TConcertDataStoreType<T>::GetFName());if(Result.Code==EConcertDataStoreResultCode::Fetched){returnResult.Value->DeserializeUnchecked<T>();}returnTOptional<T>();}

Constructors

Name Description

Public function

FConcertDataStore

(
    EUpdatePolicy InUpdatePolicy
)

Construct the store.

Functions

Name Description

Public function Const

FConcertData...

 

Fetch

(
    const FName& Key,
    const FName& TypeName
)

Looks up the specified key, if found and types match, fetches the corresponding value.

Public function

FConcertData...

 

FetchOrAdd

(
    const FName& Key,
    const FName& TypeName,
    const FConcertSessionSerializedPayl...
)

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.

Public function Const

int32

 

GetSize()

Returns the number of key/value pairs currently stored.

Public function Const

TOptional< u...

 

GetVersion

(
    const FName& Key
)

Returns the version of the specified key if found.

Public function

FConcertData...

 

Store

(
    const FName& Key,
    const FName& TypeName,
    const FConcertSessionSerializedPayl...,
    const TOptional< uint32 >& Version
)

Looks up the specified key, if it doesn't exist yet, adds new key/value pair, else, if the stored value type matches the specified value type, updates the value.

Public function Const

void

 

Visit

(
    const TFunctionRef< void...
)

Visits all the key/value currently stored.

Enums

Name

Description

Public enum

EUpdatePolicy

Defines how the store updates an existing value.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss