/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Tools/Libs/ToolsFoundation/Reflection/PhantomRttiManager.h
63 строки
2 KB
Jan Krassnigg
Even more migration to ezStringView (Tools, Plugins, Foundation) (#979)
08 июн 2023, 15:18
Не верифицирован
08 июн 2023, 15:18
568268d
Код
Авторство
О чём код?
#pragma once #include <Foundation/Communication/Event.h> #include <Foundation/Containers/IdTable.h> #include <ToolsFoundation/Reflection/ReflectedType.h> class ezPhantomRTTI; struct ezPhantomRttiManagerEvent { enum class Type { TypeAdded, TypeRemoved, TypeChanged, }; ezPhantomRttiManagerEvent() = default; Type m_Type = Type::TypeAdded; const ezRTTI* m_pChangedType = nullptr; }; /// \brief Manages all ezPhantomRTTI types that have been added to him. /// /// A ezPhantomRTTI cannot be created directly but must be created via this managers /// RegisterType function with a given ezReflectedTypeDescriptor. class EZ_TOOLSFOUNDATION_DLL ezPhantomRttiManager { public: /// \brief Adds a reflected type to the list of accessible types. /// /// Types must be added in the correct order, any type must be added before /// it can be referenced in other types. Any base class must be added before /// any class deriving from it can be added. /// Call the function again if a type has changed during the run of the /// program. If the type actually differs the last known class layout the /// m_TypeChangedEvent event will be called with the old and new ezRTTI. /// /// \sa ezReflectionUtils::GetReflectedTypeDescriptorFromRtti static const ezRTTI* RegisterType(ezReflectedTypeDescriptor& ref_desc); /// \brief Removes a type from the list of accessible types. /// /// No instance of the given type or storage must still exist when this function is called. static bool UnregisterType(const ezRTTI* pRtti); private: EZ_MAKE_SUBSYSTEM_STARTUP_FRIEND(ToolsFoundation, ReflectedTypeManager); static void Startup(); static void Shutdown(); static void PluginEventHandler(const ezPluginEvent& e); public: static ezCopyOnBroadcastEvent<const ezPhantomRttiManagerEvent&> s_Events; private: static ezSet<const ezRTTI*> s_RegisteredConcreteTypes; static ezHashTable<ezStringView, ezPhantomRTTI*> s_NameToPhantom; };