UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FAnalyticsPropertyStore Class Reference

#include <AnalyticsPropertyStore.h>

+ Inheritance diagram for FAnalyticsPropertyStore:

Public Member Functions

ANALYTICS_API FAnalyticsPropertyStore ()
 
virtual ANALYTICS_API ~FAnalyticsPropertyStore ()
 
 FAnalyticsPropertyStore (const FAnalyticsPropertyStore &)=delete
 
 FAnalyticsPropertyStore (FAnalyticsPropertyStore &&)=delete
 
FAnalyticsPropertyStoreoperator= (const FAnalyticsPropertyStore &)=delete
 
FAnalyticsPropertyStoreoperator= (FAnalyticsPropertyStore &&)=delete
 
ANALYTICS_API bool Create (const FString &Pathname, uint32 CapacityHint=4 *1024)
 
ANALYTICS_API bool Load (const FString &Pathname)
 
bool IsValid () const
 
virtual ANALYTICS_API uint32 Num () const override
 
virtual ANALYTICS_API bool Contains (const FString &Key) const override
 
virtual ANALYTICS_API bool Remove (const FString &Key) override
 
virtual ANALYTICS_API void RemoveAll () override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, int32 Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, uint32 Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, int64 Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, uint64 Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, float Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, double Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, bool Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, const FString &Value, uint32 CharCountCapacityHint=0) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, const FDateTime &Value) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, int32 Value, const TFunction< bool(const int32 *, const int32 &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, uint32 Value, const TFunction< bool(const uint32 *, const uint32 &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, int64 Value, const TFunction< bool(const int64 *, const int64 &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, uint64 Value, const TFunction< bool(const uint64 *, const uint64 &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, float Value, const TFunction< bool(const float *, const float &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, double Value, const TFunction< bool(const double *, const double &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, bool Value, const TFunction< bool(const bool *, const bool &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, const FString &Value, const TFunction< bool(const FString *, const FString &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Set (const FString &Key, const FDateTime &Value, const TFunction< bool(const FDateTime *, const FDateTime &)> &ConditionFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(int32 &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(uint32 &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(int64 &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(uint64 &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(float &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(double &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(bool &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(FString &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Update (const FString &Key, const TFunction< bool(FDateTime &)> &UpdateFn) override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, int32 &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, uint32 &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, int64 &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, uint64 &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, float &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, double &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, bool &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, FString &OutValue) const override
 
virtual ANALYTICS_API EStatusCode Get (const FString &Key, FDateTime &OutValue) const override
 
virtual ANALYTICS_API void VisitAll (const TFunction< void(FAnalyticsEventAttribute &&)> &VisitFn) const override
 
virtual ANALYTICS_API bool Flush (bool bAsync=false, const FTimespan &Timeout=FTimespan::MaxValue()) override
 
- Public Member Functions inherited from IAnalyticsPropertyStore
virtual ~IAnalyticsPropertyStore ()=default
 

Friends

class FFlushWorker
 

Additional Inherited Members

- Public Types inherited from IAnalyticsPropertyStore
enum class  EStatusCode : uint32 { Success , NotFound , BadType , Declined }
 

Detailed Description

Implements a fast key/value database to store the metrics gathered to create the session summary event. The store is buffered in memory until it is flushed to disk by calling Flush(). It is not designed to handle millions of key/value pairs, but rather a small subset that fits in memory. The implementation reserve disk space ahead of time and can usually perform in-place update. Setting or getting intrinsic types (int32, uint32, int64, uint64, float, double, bool as well as FDateTime) doesn't allocate memory. The string time is often updated in place if enough capacity was reserved. All store operations are thread safe and atomic from the caller perspective.

Constructor & Destructor Documentation

◆ FAnalyticsPropertyStore() [1/3]

FAnalyticsPropertyStore::FAnalyticsPropertyStore ( )

Create an empty store.

◆ ~FAnalyticsPropertyStore()

FAnalyticsPropertyStore::~FAnalyticsPropertyStore ( )
virtual

◆ FAnalyticsPropertyStore() [2/3]

FAnalyticsPropertyStore::FAnalyticsPropertyStore ( const FAnalyticsPropertyStore )
delete

◆ FAnalyticsPropertyStore() [3/3]

FAnalyticsPropertyStore::FAnalyticsPropertyStore ( FAnalyticsPropertyStore &&  )
delete

Member Function Documentation

◆ Contains()

bool FAnalyticsPropertyStore::Contains ( const FString &  Key) const
overridevirtual

Returns true if the store contains the specified key.

Implements IAnalyticsPropertyStore.

◆ Create()

bool FAnalyticsPropertyStore::Create ( const FString &  Pathname,
uint32  CapacityHint = 4 * 1024 
)

Create a new store, creating the file of the specified capacity and resetting the current state.

Parameters
PathnameThe path to the file to create.
CapacityHintThe desired file capacity. The implementation has a minimum and maximum capacity to reserve.
trueif the file was created and the store created, false otherwise.

◆ Flush()

bool FAnalyticsPropertyStore::Flush ( bool  bAsync = false,
const FTimespan Timeout = FTimespan::MaxValue() 
)
overridevirtual

Flushes cached values to disk. Only one thread can flush at a time, causing possible latency if a flush is alreary happenning.

Parameters
bAsyncWhether the data in flushed in a background thread or in the calling thread.
TimeoutMaximum time to wait before the flush starts (synchronous) or get scheduled (asynchronous). FTimespan::Zero() means no waiting.
Returns
True if the flush was executed (synchronous) or scheduled (asynchronous), false if the operation timed out.
Store.Flush(); // Flush in the calling thread, block until all threads has finished flushing.
Store.Flush(false, FTimespan::Zero()); // Flush in the calling thread if possible, return immediatedly if another thread is already flushing.
Store.Flush(true, FTimespan::Zero()); // Flush in a backgroud thread if no other thread is flushing, return immediatedly if another flushing task is running.
Store.Flush(true); // Flush in a background thread, might block if a thread is already flushing. (It doesn't queue several tasks).
static FTimespan Zero()
Definition Timespan.h:747

Implements IAnalyticsPropertyStore.

◆ Get() [1/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
bool OutValue 
) const
overridevirtual

◆ Get() [2/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
double OutValue 
) const
overridevirtual

◆ Get() [3/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
FDateTime OutValue 
) const
overridevirtual

◆ Get() [4/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
float OutValue 
) const
overridevirtual

◆ Get() [5/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
FString &  OutValue 
) const
overridevirtual

◆ Get() [6/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
int32 OutValue 
) const
overridevirtual

Reads the specified key value from the store.

Parameters
KeyThe name of the property to read.
OutValueThe value of the property if the function returns EStatusCode::Success, left unchanged otherwise.
Returns
One of the following code

Implements IAnalyticsPropertyStore.

◆ Get() [7/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
int64 OutValue 
) const
overridevirtual

◆ Get() [8/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
uint32 OutValue 
) const
overridevirtual

◆ Get() [9/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Get ( const FString &  Key,
uint64 OutValue 
) const
overridevirtual

◆ IsValid()

bool FAnalyticsPropertyStore::IsValid ( ) const
inline

Returns true is the store was successfully created or loaded.

◆ Load()

bool FAnalyticsPropertyStore::Load ( const FString &  Pathname)

Load the specified file in memory, resetting the current state.

Parameters
PathnameThe path to the file to open.
Returns
true if the file was loaded successuflly, false if the file doesn't exist, the file format/version is invalid or if the file is corrupted (failed checksum).

◆ Num()

uint32 FAnalyticsPropertyStore::Num ( ) const
overridevirtual

Returns the number of elements in the store.

Implements IAnalyticsPropertyStore.

◆ operator=() [1/2]

FAnalyticsPropertyStore & FAnalyticsPropertyStore::operator= ( const FAnalyticsPropertyStore )
delete

◆ operator=() [2/2]

FAnalyticsPropertyStore & FAnalyticsPropertyStore::operator= ( FAnalyticsPropertyStore &&  )
delete

◆ Remove()

bool FAnalyticsPropertyStore::Remove ( const FString &  Key)
overridevirtual

Removes the specified key from the store.

Returns
true if the key was removed.

Implements IAnalyticsPropertyStore.

◆ RemoveAll()

void FAnalyticsPropertyStore::RemoveAll ( )
overridevirtual

Removes all existing keys from the store.

Implements IAnalyticsPropertyStore.

◆ Set() [1/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
bool  Value 
)
overridevirtual

◆ Set() [2/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
bool  Value,
const TFunction< bool(const bool *, const bool &)> &  ConditionFn 
)
overridevirtual

◆ Set() [3/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
const FDateTime Value 
)
overridevirtual

◆ Set() [4/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
const FDateTime Value,
const TFunction< bool(const FDateTime *, const FDateTime &)> &  ConditionFn 
)
overridevirtual

◆ Set() [5/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
const FString &  Value,
const TFunction< bool(const FString *, const FString &)> &  ConditionFn 
)
overridevirtual

◆ Set() [6/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
const FString &  Value,
uint32  CharCountCapacityHint = 0 
)
overridevirtual

◆ Set() [7/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
double  Value 
)
overridevirtual

◆ Set() [8/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
double  Value,
const TFunction< bool(const double *, const double &)> &  ConditionFn 
)
overridevirtual

◆ Set() [9/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
float  Value 
)
overridevirtual

◆ Set() [10/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
float  Value,
const TFunction< bool(const float *, const float &)> &  ConditionFn 
)
overridevirtual

◆ Set() [11/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
int32  Value 
)
overridevirtual

Adds or updates the specified key/value pair. If the key doesn't exist, the key/value pair is added. If the key already exists, the value is updated if the stored value and the specified value types match.

Parameters
KeyThe property name to add or update.
ValueThe property value to add or update.
Returns
EStatusCode::Success if the key was added or updated, EStatusCode::BadType if the value type did not match the current value type.

Implements IAnalyticsPropertyStore.

◆ Set() [12/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
int32  Value,
const TFunction< bool(const int32 *, const int32 &)> &  ConditionFn 
)
overridevirtual

Conditionnnaly adds or updates the specified key/value pair. The operation is atomic from the caller perspective. The function reads the actual value (if it exists), invoke the ConditionFn callback and write the value back if the condition function returns true. If the key doesn't exist, the actual value passed back to the condition function is null. If the condition function returns true, the proposed value is set, otherwise, the operation is declined and the store remains unchanged.

Parameters
KeyThe name of the property to add or update.
ValueThe value proposed. This value is passed as the second parameter to the ConditionFn callback.
ConditionFnFunction invoked back with the actual value and the proposed value to let the caller decide whether the proposed value should be set or not. If the callback function returns true, the proposed value is added/updated, otherwise, nothing changes.
Returns
One of the following code

Implements IAnalyticsPropertyStore.

◆ Set() [13/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
int64  Value 
)
overridevirtual

◆ Set() [14/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
int64  Value,
const TFunction< bool(const int64 *, const int64 &)> &  ConditionFn 
)
overridevirtual

◆ Set() [15/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
uint32  Value 
)
overridevirtual

◆ Set() [16/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
uint32  Value,
const TFunction< bool(const uint32 *, const uint32 &)> &  ConditionFn 
)
overridevirtual

◆ Set() [17/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
uint64  Value 
)
overridevirtual

◆ Set() [18/18]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Set ( const FString &  Key,
uint64  Value,
const TFunction< bool(const uint64 *, const uint64 &)> &  ConditionFn 
)
overridevirtual

◆ Update() [1/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(bool &)> &  UpdateFn 
)
overridevirtual

◆ Update() [2/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(double &)> &  UpdateFn 
)
overridevirtual

◆ Update() [3/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(FDateTime &)> &  UpdateFn 
)
overridevirtual

◆ Update() [4/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(float &)> &  UpdateFn 
)
overridevirtual

◆ Update() [5/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(FString &)> &  UpdateFn 
)
overridevirtual

◆ Update() [6/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(int32 &)> &  UpdateFn 
)
overridevirtual

Updates an exiting value. The operation is atomic from the caller perspective. The function reads the actual value and invoke UpdateFn callback with the actual value. The callback can update the actual value or decline the operation. If the key is not found, the callback is not invoked.

Parameters
KeyThe name of the key to update.
UpdateFnThe function to invoke, passing the actual value.
Returns
One of the following code

Implements IAnalyticsPropertyStore.

◆ Update() [7/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(int64 &)> &  UpdateFn 
)
overridevirtual

◆ Update() [8/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(uint32 &)> &  UpdateFn 
)
overridevirtual

◆ Update() [9/9]

IAnalyticsPropertyStore::EStatusCode FAnalyticsPropertyStore::Update ( const FString &  Key,
const TFunction< bool(uint64 &)> &  UpdateFn 
)
overridevirtual

◆ VisitAll()

void FAnalyticsPropertyStore::VisitAll ( const TFunction< void(FAnalyticsEventAttribute &&)> &  VisitFn) const
overridevirtual

Iterates the keys currently stored and invokes the visitor function for each key, converting the value to its string representation.

Parameters
VisitFnThe callback invoked for each key/value pair visited.

Implements IAnalyticsPropertyStore.

Friends And Related Symbol Documentation

◆ FFlushWorker

friend class FFlushWorker
friend

The documentation for this class was generated from the following files: