Open 3D Engine AzCore 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.
AZ::SerializeContext::ClassBuilder Class Reference

Public Member Functions

ClassBuilderoperator-> ()
 
template<class ClassType , class FieldType >
ClassBuilderField (const char *name, FieldType ClassType::*address, AZStd::initializer_list< AttributePair > attributeIds={})
 Declare class field with address of the variable in the class.
 
template<class FromT , class ToT >
ClassBuilderTypeChange (AZStd::string_view fieldName, unsigned int fromVersion, unsigned int toVersion, AZStd::function< ToT(const FromT &)> upgradeFunc)
 
ClassBuilderNameChange (unsigned int fromVersion, unsigned int toVersion, AZStd::string_view oldFieldName, AZStd::string_view newFieldName)
 
template<class ClassType , class BaseType , class FieldType >
ClassBuilderFieldFromBase (const char *name, FieldType BaseType::*address)
 
ClassBuilderVersion (unsigned int version, VersionConverter converter=nullptr)
 Add version control to the structure with optional converter. If not controlled a version of 0 is assigned.
 
ClassBuilderSerializer (Serialize::IDataSerializerPtr serializer)
 
ClassBuilderSerializer (IDataSerializer *serializer)
 For data types (usually base types) or types that we handle the full serialize, implement this interface.
 
template<typename SerializerImplementation >
ClassBuilderSerializer ()
 Helper function to create a static instance of specific serializer implementation. Serializer(IDataSerializer*)
 
ClassBuilderSerializeWithNoData ()
 For class type that are empty, we want the serializer to create on load, but have no child elements.
 
ClassBuilderEventHandler (IEventHandler *eventHandler)
 
template<typename EventHandlerImplementation >
ClassBuilderEventHandler ()
 Helper function to create a static instance of specific event handler implementation. Serializer(IDataSerializer*)
 
ClassBuilderDataContainer (IDataContainer *dataContainer)
 Adds a DataContainer structure for manipulating contained data in custom ways.
 
template<typename DataContainerType >
ClassBuilderDataContainer ()
 Helper function to create a static instance of the specific data container implementation. DataContainer(IDataContainer*)
 
ClassBuilderPersistentId (ClassPersistentId persistentId)
 
ClassBuilderSerializerDoSave (ClassDoSave isSave)
 
template<class T >
ClassBuilderAttribute (const char *id, T &&value)
 
template<class T >
ClassBuilderAttribute (Crc32 idCrc, T &&value)
 
template<class ClassType , class FieldType >
SerializeContext::ClassBuilderField (const char *name, FieldType ClassType::*member, AZStd::initializer_list< AttributePair > attributes)
 
template<class FromT , class ToT >
SerializeContext::ClassBuilderTypeChange (AZStd::string_view fieldName, unsigned int fromVersion, unsigned int toVersion, AZStd::function< ToT(const FromT &)> upgradeFunc)
 Declare a type change between serialized versions of a field.
 
template<class ClassType , class BaseType , class FieldType >
SerializeContext::ClassBuilderFieldFromBase (const char *name, FieldType BaseType::*member)
 
template<class T >
SerializeContext::ClassBuilderAttribute (Crc32 idCrc, T &&value)
 

Friends

class SerializeContext
 

Member Function Documentation

◆ Attribute() [1/2]

template<class T >
ClassBuilder * AZ::SerializeContext::ClassBuilder::Attribute ( const char *  id,
T &&  value 
)
inline

All T (attribute value) MUST be copy or move constructible as they are stored in internal AttributeContainer<T>, which can be accessed by azrtti and AttributeData. Attributes can be assigned to either classes or DataElements.

◆ Attribute() [2/2]

template<class T >
ClassBuilder * AZ::SerializeContext::ClassBuilder::Attribute ( Crc32  idCrc,
T &&  value 
)

All T (attribute value) MUST be copy or move constructible as they are stored in internal AttributeContainer<T>, which can be accessed by azrtti and AttributeData. Attributes can be assigned to either classes or DataElements.

◆ EventHandler()

ClassBuilder * AZ::SerializeContext::ClassBuilder::EventHandler ( IEventHandler eventHandler)

Implement and provide interface for event handling when necessary. An example for this will be when the class does some thread work and need to know when we are about to access data for serialization (load/save).

◆ FieldFromBase()

template<class ClassType , class BaseType , class FieldType >
ClassBuilder * AZ::SerializeContext::ClassBuilder::FieldFromBase ( const char *  name,
FieldType BaseType::*  address 
)

Declare a class field that belongs to a base class of the class. If you use this function to reflect you base class you can't reflect the entire base class.

◆ PersistentId()

ClassBuilder * AZ::SerializeContext::ClassBuilder::PersistentId ( ClassPersistentId  persistentId)

Sets the class persistent ID function getter. This is used when we store the class in containers, so we can identify elements for the purpose of overriding values (aka slices overrides), otherwise the ability to tweak complex types in containers will be limiting due to the lack of reliable ways to address elements in a container.

◆ Serializer()

ClassBuilder * AZ::SerializeContext::ClassBuilder::Serializer ( Serialize::IDataSerializerPtr  serializer)

For data types (usually base types) or types that we handle the full serialize, implement this interface. Takes ownership of the supplied serializer

◆ SerializerDoSave()

ClassBuilder * AZ::SerializeContext::ClassBuilder::SerializerDoSave ( ClassDoSave  isSave)

Provide a function to perform basic yes/no on saving. We don't recommend using such pattern as it's very easy to create asymmetrical serialization and lose silently data.


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