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::Serialize::IDataContainer Class Referenceabstract

#include <SerializeContext.h>

Inherited by AZ::Internal::AZStdArrayContainer< T, Size >, AZ::Internal::AZStdAssociativeContainer< AZStd::map >, AZ::Internal::AZStdAssociativeContainer< AZStd::set >, AZ::Internal::AZStdAssociativeContainer< AZStd::unordered_map >, AZ::Internal::AZStdAssociativeContainer< AZStd::unordered_multimap >, AZ::Internal::AZStdAssociativeContainer< AZStd::unordered_multiset >, AZ::Internal::AZStdAssociativeContainer< AZStd::unordered_set >, AZ::Internal::AZStdBasicContainer< AZStd::fixed_vector, IsStableIterators >, AZ::Internal::AZStdBasicContainer< AZStd::forward_list, true >, AZ::Internal::AZStdBasicContainer< AZStd::list, true >, AZ::Internal::AZStdBasicContainer< AZStd::vector, IsStableIterators >, AZ::Internal::AZStdOptionalContainer< ContainerType >, AZ::Internal::AZStdSmartPtrContainer< AZStd::intrusive_ptr >, AZ::Internal::AZStdSmartPtrContainer< AZStd::shared_ptr >, AZ::Internal::AZStdSmartPtrContainer< ContainerType >, AZ::Internal::AZStdTupleContainer< Types... >, AZ::Internal::AZRValueContainer< T >, AZ::Internal::AZStdAnyContainer, AZ::Internal::AZStdArrayContainer< T, N >, AZ::Internal::AZStdAssociativeContainer< T >, AZ::Internal::AZStdBasicContainer< T, IsStableIterators >, AZ::Internal::AZStdOptionalContainer< T >, AZ::Internal::AZStdPairContainer< T1, T2 >, AZ::Internal::AZStdSmartPtrContainer< T >, and AZ::Internal::AZStdTupleContainer< Types >.

Classes

class  IAssociativeDataContainer
 Mix-in for associative container actions, implement or provide this to offer key/value actions. More...
 

Public Types

using ElementCB = AZStd::function< bool(void *, const Uuid &, const ClassData *, const ClassElement *) >
 
using ElementTypeCB = AZStd::function< bool(const Uuid &, const ClassElement *) >
 

Public Member Functions

 AZ_TYPE_INFO_WITH_NAME_DECL (IDataContainer)
 
virtual const char * GetElementName (int index=0)
 
virtual u32 GetElementNameCrC (int index=0)
 
virtual const ClassElementGetElement (u32 elementNameCrc) const =0
 Returns the generic element (offsets are mostly invalid 0xbad0ffe0, there are exceptions). Null if element with this name can't be found.
 
virtual bool GetElement (ClassElement &classElement, const DataElement &dataElement) const =0
 Populates the supplied classElement by looking up the name in the DataElement. Returns true if the classElement was populated successfully.
 
virtual void EnumElements (void *instance, const ElementCB &cb)=0
 Enumerate elements in the container based on the stored entries.
 
virtual void EnumTypes (const ElementTypeCB &cb)=0
 Enumerate elements in the container based on possible storage types. If the callback is not called it means there are no restrictions on what can be stored in the container.
 
virtual size_t Size (void *instance) const =0
 Return number of elements in the container.
 
virtual size_t Capacity (void *instance) const =0
 Returns the capacity of the container. Returns 0 for objects without fixed capacity.
 
virtual bool IsStableElements () const =0
 Returns true if elements pointers don't change on add/remove. If false you MUST enumerate all elements.
 
virtual bool IsFixedSize () const =0
 Returns true if the container is fixed size (not capacity), otherwise false.
 
virtual bool IsFixedCapacity () const =0
 Returns if the container is fixed capacity, otherwise false.
 
virtual bool IsSmartPointer () const =0
 Returns true if the container represents a smart pointer.
 
virtual bool CanAccessElementsByIndex () const =0
 Returns true if elements can be retrieved by index.
 
virtual IAssociativeDataContainerGetAssociativeContainerInterface ()
 Returns the associative interface for this container (e.g. the container itself if it inherits it) if available, otherwise null.
 
virtual void * ReserveElement (void *instance, const ClassElement *classElement)=0
 Reserve an element and get its address (called before the element is loaded).
 
virtual void FreeReservedElement (void *instance, void *element, SerializeContext *deletePointerDataContext)
 Free an element that was reserved using ReserveElement, but was not stored by calling StoreElement.
 
virtual void * GetElementByIndex (void *instance, const ClassElement *classElement, size_t index)=0
 Get an element's address by its index (called before the element is loaded).
 
virtual void StoreElement (void *instance, void *element)=0
 Store the element that was reserved before (called post loading)
 
virtual bool RemoveElement (void *instance, const void *element, SerializeContext *deletePointerDataContext)=0
 Remove element in the container. Returns true if the element was removed, otherwise false. If deletePointerDataContext is NOT null, this indicated that you want the remove function to delete/destroy any Elements that are pointer!
 
virtual size_t RemoveElements (void *instance, const void **elements, size_t numElements, SerializeContext *deletePointerDataContext)=0
 
virtual void ClearElements (void *instance, SerializeContext *deletePointerDataContext)=0
 Clear elements in the instance. If deletePointerDataContext is NOT null, this indicated that you want the remove function to delete/destroy any Elements that are pointer!
 
virtual void ElementsUpdated (void *instance)
 Called when elements inside the container have been modified.
 

Static Public Member Functions

static const char * GetDefaultElementName ()
 Return default element generic name (used by most containers).
 
static u32 GetDefaultElementNameCrc ()
 Return default element generic name crc (used by most containers).
 

Protected Member Functions

void DeletePointerData (SerializeContext *context, const ClassElement *classElement, const void *element)
 Free element data (when the class elements are pointers).
 

Detailed Description

Interface for a data container. This might be an AZStd container or just a class with elements defined in some template manner (usually with templates :) )

Member Function Documentation

◆ RemoveElements()

virtual size_t AZ::Serialize::IDataContainer::RemoveElements ( void *  instance,
const void **  elements,
size_t  numElements,
SerializeContext deletePointerDataContext 
)
pure virtual

Remove elements (removed array of elements) regardless if the container is Stable or not (IsStableElements). Element should be sorted on address in acceding order. Returns number of elements removed. If deletePointerDataContext is NOT null, this indicates that you want the remove function to delete/destroy any Elements that are pointer,


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