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

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

#include <WorldRttiConverterContext.h>

Inheritance diagram for xiiWorldRttiConverterContext:
[legend]

Classes

struct  Event

Public Member Functions

virtual void Clear () override
 Copyright (c) Theophilus Eriata. All Rights Reserved.
void DeleteExistingObjects ()
virtual xiiInternal::NewInstance< void > CreateObject (const xiiUuid &guid, const xiiRTTI *pRtti) override
 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) override
 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) override
 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) override
 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 override
 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 override
 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 void OnUnknownTypeError (xiiStringView sTypeName) override
 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.
Public Member Functions inherited from xiiRttiConverterContext
virtual xiiUuid GenerateObjectGuid (const xiiUuid &parentGuid, const xiiAbstractProperty *pProperty, xiiVariant index, void *pObject) const
 Generates a guid for a new object. Default implementation generates stable guids derived from parentGuid + property name + index and ignores the address of pObject.
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.

Public Attributes

xiiWorld * m_pWorld = nullptr
xiiEditorGuidEngineHandleMap< xiiGameObjectHandle > m_GameObjectMap
xiiEditorGuidEngineHandleMap< xiiComponentHandle > m_ComponentMap
xiiEditorGuidEngineHandleMap< xiiUInt32 > m_OtherPickingMap
xiiEditorGuidEngineHandleMap< xiiUInt32 > m_ComponentPickingMap
xiiUInt32 m_uiNextComponentPickingID = 1
xiiUInt32 m_uiHighlightID = 0
xiiEvent< const Event & > m_Events
xiiSet< xiiString > m_UnknownTypes

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 world rtti converter context tracks created objects and is capable of also handling components / game objects. Used by the xiiIPCObjectMirror to create / destroy objects.

As of now, it does not remove owner ptr when a parent is deleted, so it will accumulate zombie entries. As requests to dead objects shouldn't generally happen this is for the time being not a problem.

Member Function Documentation

◆ Clear()

void xiiWorldRttiConverterContext::Clear ( )
overridevirtual

Copyright (c) Theophilus Eriata. All Rights Reserved.

Reimplemented from xiiRttiConverterContext.

◆ CreateObject()

xiiInternal::NewInstance< void > xiiWorldRttiConverterContext::CreateObject ( const xiiUuid & guid,
const xiiRTTI * pRtti )
overridevirtual

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.

Reimplemented from xiiRttiConverterContext.

◆ DeleteObject()

void xiiWorldRttiConverterContext::DeleteObject ( const xiiUuid & guid)
overridevirtual

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.

Reimplemented from xiiRttiConverterContext.

◆ GetObjectByGUID()

xiiRttiConverterObject xiiWorldRttiConverterContext::GetObjectByGUID ( const xiiUuid & guid) const
overridevirtual

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.

Reimplemented from xiiRttiConverterContext.

◆ GetObjectGUID()

xiiUuid xiiWorldRttiConverterContext::GetObjectGUID ( const xiiRTTI * pRtti,
const void * pObject ) const
overridevirtual

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.

Reimplemented from xiiRttiConverterContext.

◆ OnUnknownTypeError()

void xiiWorldRttiConverterContext::OnUnknownTypeError ( xiiStringView sTypeName)
overridevirtual

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.

Reimplemented from xiiRttiConverterContext.

◆ RegisterObject()

void xiiWorldRttiConverterContext::RegisterObject ( const xiiUuid & guid,
const xiiRTTI * pRtti,
void * pObject )
overridevirtual

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.

Reimplemented from xiiRttiConverterContext.

◆ UnregisterObject()

void xiiWorldRttiConverterContext::UnregisterObject ( const xiiUuid & guid)
overridevirtual

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.

Reimplemented from xiiRttiConverterContext.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Editor/EditorEngineProcessFramework/EngineProcess/WorldRttiConverterContext.h
  • /home/runner/work/XII/XII/Source/Editor/EditorEngineProcessFramework/EngineProcess/Implementation/WorldRttiConverterContext.cpp