Open 3D Engine SaveData Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
SaveData::SaveDataSystemComponent::Implementation Class Referenceabstract

Base class for platform specific implementations of the save data system component. More...

#include <SaveDataSystemComponent.h>

Inherits AZ::TickBus::Handler.

Classes

struct  ThreadCompletionPair
 Pairing of a save/load thread with an atomic bool indicating whether it is complete. More...
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (Implementation, AZ::SystemAllocator)
 
 Implementation (SaveDataSystemComponent &saveDataSystemComponent)
 
 AZ_DISABLE_COPY_MOVE (Implementation)
 
virtual ~Implementation ()
 Default destructor.
 
virtual void SaveDataBuffer (const SaveDataBufferParams &saveDataBufferParams)=0
 
virtual void LoadDataBuffer (const LoadDataBufferParams &loadDataBufferParams)=0
 
virtual void SetSaveDataDirectoryPath (const char *saveDataDirectoryPath)=0
 

Static Public Member Functions

static ImplementationCreate (SaveDataSystemComponent &saveDataSystemComponent)
 

Protected Member Functions

void SaveDataBufferToFileSystem (const SaveDataBufferParams &saveDataBufferParams, const AZStd::string &absoluteFilePath, bool waitForCompletion=false, bool useTemporaryFile=true)
 
void LoadDataBufferFromFileSystem (const LoadDataBufferParams &loadDataBufferParams, const AZStd::string &absoluteFilePath, bool waitForCompletion=false)
 
void OnTick (float deltaTime, AZ::ScriptTimePoint scriptTimePoint) override
 AZ::TickEvents::OnTick
 
void JoinAllActiveThreads ()
 Convenience function to join all threads that are active.
 
void JoinAllCompletedThreads ()
 Convenience function to join all threads that have been marked as completed.
 

Static Protected Member Functions

static void OnSaveDataBufferComplete (const AZStd::string &dataBufferName, const AzFramework::LocalUserId localUserId, const SaveDataRequests::OnDataBufferSaved &callback, const SaveDataNotifications::Result &result)
 
static void OnLoadDataBufferComplete (SaveDataNotifications::DataBuffer dataBuffer, AZ::u64 dataBufferSize, const AZStd::string &dataBufferName, const AzFramework::LocalUserId localUserId, const SaveDataRequests::OnDataBufferLoaded &callback, const SaveDataNotifications::Result &result)
 

Protected Attributes

AZStd::mutex m_activeThreadsMutex
 
AZStd::list< ThreadCompletionPairm_activeThreads
 Mutex to restrict access to the active threads.
 
SaveDataSystemComponentm_saveDataSystemComponent
 Reference to the parent.
 

Detailed Description

Base class for platform specific implementations of the save data system component.

Constructor & Destructor Documentation

◆ Implementation()

SaveData::SaveDataSystemComponent::Implementation::Implementation ( SaveDataSystemComponent saveDataSystemComponent)

Constructor

Parameters
[in]saveDataSystemComponentReference to the parent being implemented

Member Function Documentation

◆ Create()

static Implementation * SaveData::SaveDataSystemComponent::Implementation::Create ( SaveDataSystemComponent saveDataSystemComponent)
static

Default factory create function

Parameters
[in]saveDataSystemComponentReference to the parent being implemented

◆ LoadDataBuffer()

virtual void SaveData::SaveDataSystemComponent::Implementation::LoadDataBuffer ( const LoadDataBufferParams &  loadDataBufferParams)
pure virtual

Load a data buffer.

Parameters
[in]loadDataBufferParamsThe load data buffer request parameters.

◆ LoadDataBufferFromFileSystem()

void SaveData::SaveDataSystemComponent::Implementation::LoadDataBufferFromFileSystem ( const LoadDataBufferParams &  loadDataBufferParams,
const AZStd::string &  absoluteFilePath,
bool  waitForCompletion = false 
)
protected

Load a data buffer from the file system.

Parameters
[in]loadDataBufferParamsThe load data buffer request parameters.
[in]absoluteFilePathThe absolute file path from where to load the data buffer.
[in]waitForCompletionShould we wait until the load data thread completes?

◆ OnLoadDataBufferComplete()

static void SaveData::SaveDataSystemComponent::Implementation::OnLoadDataBufferComplete ( SaveDataNotifications::DataBuffer  dataBuffer,
AZ::u64  dataBufferSize,
const AZStd::string &  dataBufferName,
const AzFramework::LocalUserId  localUserId,
const SaveDataRequests::OnDataBufferLoaded &  callback,
const SaveDataNotifications::Result result 
)
staticprotected

Convenience function to broadcast SaveDataNotifications::OnDataBufferLoaded events in addition to any callback specified when SaveDataRequests::LoadDataBuffer was called.

Parameters
[in]dataBufferThe data buffer that was loaded.
[in]dataBufferSizeThe size of the data buffer that was loaded.
[in]dataBufferNameThe name of the data buffer that was loaded.
[in]localUserIdThe local user id the data that was loaded is associated with.
[in]resultThe result of the load data buffer request.
[in]callbackThe data buffer loaded callback to invoke.

◆ OnSaveDataBufferComplete()

static void SaveData::SaveDataSystemComponent::Implementation::OnSaveDataBufferComplete ( const AZStd::string &  dataBufferName,
const AzFramework::LocalUserId  localUserId,
const SaveDataRequests::OnDataBufferSaved callback,
const SaveDataNotifications::Result result 
)
staticprotected

Convenience function to broadcast SaveDataNotifications::OnDataBufferSaved events in addition to any callback specified when SaveDataRequests::SaveDataBuffer was called.

Parameters
[in]dataBufferNameThe name of the data buffer that was saved.
[in]localUserIdThe local user id the data that was saved is associated with.
[in]resultThe result of the save data buffer request.
[in]callbackThe data buffer saved callback to invoke.

◆ SaveDataBuffer()

virtual void SaveData::SaveDataSystemComponent::Implementation::SaveDataBuffer ( const SaveDataBufferParams &  saveDataBufferParams)
pure virtual

Save a data buffer.

Parameters
[in]saveDataBufferRequestParamsThe save data buffer request parameters.

◆ SaveDataBufferToFileSystem()

void SaveData::SaveDataSystemComponent::Implementation::SaveDataBufferToFileSystem ( const SaveDataBufferParams &  saveDataBufferParams,
const AZStd::string &  absoluteFilePath,
bool  waitForCompletion = false,
bool  useTemporaryFile = true 
)
protected

Save a data buffer to the file system.

Parameters
[in]saveDataBufferRequestParamsThe save data buffer request parameters.
[in]absoluteFilePathThe absolute file path where to save the data buffer.
[in]waitForCompletionShould we wait until the save data thread completes?
[in]useTemporaryFileShould we write to a temporary file that gets renamed?

◆ SetSaveDataDirectoryPath()

virtual void SaveData::SaveDataSystemComponent::Implementation::SetSaveDataDirectoryPath ( const char *  saveDataDirectoryPath)
pure virtual

Set the path to the application's save data dircetory. Does nothing on some systems.

Parameters
[in]saveDataDirectoryPathThe path to the application's save data dircetory.

Member Data Documentation

◆ m_activeThreads

AZStd::list<ThreadCompletionPair> SaveData::SaveDataSystemComponent::Implementation::m_activeThreads
protected

Mutex to restrict access to the active threads.

A container of active threads


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