/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Tools/Libs/ToolsFoundation/Factory/RttiMappedObjectFactory.h
44 строки
1 KB
Ingrater
clang-tidy modernize-use-using check (#956)
22 май 2023, 17:30
Не верифицирован
22 май 2023, 17:30
01da71c
Код
Авторство
О чём код?
#pragma once #include <Foundation/Reflection/Reflection.h> #include <ToolsFoundation/ToolsFoundationDLL.h> /// \brief A factory that creates the closest matching objects according to the passed type. /// /// Creators can be registered at the factory for a specific type. /// When the create function is called for a type, the parent type hierarchy is traversed until /// the first type is found for which a creator is registered. template <typename Object> class ezRttiMappedObjectFactory { EZ_DISALLOW_COPY_AND_ASSIGN(ezRttiMappedObjectFactory); public: ezRttiMappedObjectFactory(); ~ezRttiMappedObjectFactory(); using CreateObjectFunc = Object* (*)(const ezRTTI*); void RegisterCreator(const ezRTTI* pType, CreateObjectFunc creator); void UnregisterCreator(const ezRTTI* pType); Object* CreateObject(const ezRTTI* pType); struct Event { enum class Type { CreatorAdded, CreatorRemoved }; Type m_Type; const ezRTTI* m_pRttiType; }; ezEvent<const Event&> m_Events; private: ezHashTable<const ezRTTI*, CreateObjectFunc> m_Creators; }; #include <ToolsFoundation/Factory/Implementation/RttiMappedObjectFactory_inl.h>