XII Release 0.1.0
Loading...
Searching...
No Matches
xiiApplyNativePropertyChangesContext Class Reference

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <ApplyNativePropertyChangesContext.h>

Inheritance diagram for xiiApplyNativePropertyChangesContext:
[legend]

Public Member Functions

 xiiApplyNativePropertyChangesContext (xiiRttiConverterContext &ref_source, const xiiAbstractObjectGraph &originalGraph)
 Copyright (c) Theophilus Eriata. All Rights Reserved.
virtual xiiUuid GenerateObjectGuid (const xiiUuid &parentGuid, const xiiAbstractProperty *pProp, xiiVariant index, void *pObject) const override
 Generates a guid for a new object. Default implementation generates stable guids derived from parentGuid + property name + index and ignores the address of pObject.
Public Member Functions inherited from xiiRttiConverterContext
virtual void Clear ()
 Clears all stored information about objects. This is called when the converter context is reused for multiple conversions. Override this to clear any additional data that your implementation may store.
virtual xiiInternal::NewInstance< void > CreateObject (const xiiUuid &guid, const xiiRTTI *pRtti)
 Creates a new object for the given guid and type. Default implementation uses the allocator from the RTTI type to create a new instance of the object. Override this to implement custom object creation logic, e.g. to reuse existing objects or to create objects that cannot be allocated through RTTI.
virtual void DeleteObject (const xiiUuid &guid)
 Deletes the object with the given guid. Default implementation uses the allocator from the RTTI type to delete the object. Override this to implement custom object deletion logic, e.g. to reuse existing objects or to delete objects that cannot be allocated through RTTI.
virtual void RegisterObject (const xiiUuid &guid, const xiiRTTI *pRtti, void *pObject)
 Registers an object with the given guid, type and pointer. This is called by the default implementation of CreateObject after creating a new object. Override this to store additional information about the object or to implement custom registration logic.
virtual void UnregisterObject (const xiiUuid &guid)
 Unregisters the object with the given guid. This is called by the default implementation of DeleteObject after deleting an object. Override this to clear any additional information about the object or to implement custom unregistration logic.
virtual xiiRttiConverterObject GetObjectByGUID (const xiiUuid &guid) const
 Returns the object for the given guid. Default implementation looks up the guid in a hash table and returns the corresponding object pointer and type. Override this to implement custom lookup logic, e.g. to look up objects that are not currently instantiated, but only exist as graph nodes.
virtual xiiUuid GetObjectGUID (const xiiRTTI *pRtti, const void *pObject) const
 Returns the guid for the given object pointer. Default implementation looks up the object pointer in a hash table and returns the corresponding guid. Override this to implement custom lookup logic, e.g. to look up guids for objects that are not currently instantiated, but only exist as graph nodes.
virtual const xiiRTTI * FindTypeByName (xiiStringView sName) const
 Returns the type for the given type name. Default implementation looks up the type name in a hash table and returns the corresponding RTTI type. Override this to implement custom lookup logic, e.g. to look up types that are not currently registered in the RTTI system.
template<typename T>
void GetObjectsByType (xiiDynamicArray< T * > &out_objects, xiiDynamicArray< xiiUuid > *out_pUuids=nullptr)
 Returns the type for the given type name hash. Default implementation looks up the type name hash in a hash table and returns the corresponding RTTI type. Override this to implement custom lookup logic, e.g. to look up types that are not currently registered in the RTTI system.
virtual xiiUuid EnqueObject (const xiiUuid &guid, const xiiRTTI *pRtti, void *pObject)
 Enqueues an object for later creation. This is called by the default implementation of AddSubObjectToGraph when adding a sub-object that is not currently instantiated, but only exists as a graph node. Default implementation registers the object with the given guid, type and pointer and adds the guid to a set of queued objects. Override this to implement custom enqueue logic, e.g. to store additional information about the object or to implement custom registration logic.
virtual xiiRttiConverterObject DequeueObject ()
 Dequeues an object for creation. This is called by the default implementation of CreateObject when creating an object that was previously enqueued with EnqueueObject. Default implementation looks up the guid in the set of queued objects and returns the corresponding object pointer and type. Override this to implement custom dequeue logic, e.g. to look up objects that are not currently instantiated, but only exist as graph nodes.
virtual void OnUnknownTypeError (xiiStringView sTypeName)
 Called when an object with a guid that is already registered is created. Default implementation logs an error and returns the existing object. Override this to implement custom logic, e.g. to replace the existing object or to allow multiple objects with the same guid.

Additional Inherited Members

Protected Attributes inherited from xiiRttiConverterContext
xiiHashTable< xiiUuid, xiiRttiConverterObject > m_GuidToObject
 Maps guids to objects. The object pointer may be nullptr if the object is not currently instantiated, but only exists as a graph node.
xiiHashTable< const void *, xiiUuid > m_ObjectToGuid
 Maps object pointers to guids. The guid may be invalid if the object is not currently instantiated, but only exists as a graph node.
xiiSet< xiiUuid > m_QueuedObjects
 Set of guids for objects that are enqueued for later creation. The objects may not be currently instantiated, but only exist as graph nodes.

Detailed Description

Copyright (c) Theophilus Eriata. All Rights Reserved.

The xiiApplyNativePropertyChangesContext takes care of generating guids for native pointers that match those of the xiiAbstractObjectGraph that was passed in. This allows native changes to be tracked and applied to the object graph at a later point.

See also
xiiAbstractObjectGraph::ModifyNodeViaNativeCounterpart

Member Function Documentation

◆ GenerateObjectGuid()

xiiUuid xiiApplyNativePropertyChangesContext::GenerateObjectGuid ( const xiiUuid & parentGuid,
const xiiAbstractProperty * pProperty,
xiiVariant index,
void * pObject ) const
overridevirtual

Generates a guid for a new object. Default implementation generates stable guids derived from parentGuid + property name + index and ignores the address of pObject.

Reimplemented from xiiRttiConverterContext.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Serialization/ApplyNativePropertyChangesContext.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Serialization/Implementation/ApplyNativePropertyChangesContext.cpp