#ifndef __PSHAG_CFACTORYMGR_HPP__ #define __PSHAG_CFACTORYMGR_HPP__ #include #include "RetroTypes.hpp" #include "IOStreams.hpp" namespace pshag { struct SObjectTag; class CVParamTransfer; class IObj; using CFactoryFnReturn = std::unique_ptr; using FFactoryFunc = std::function; class CFactoryMgr { std::unordered_map m_factories; public: CFactoryFnReturn MakeObject(const SObjectTag& tag, pshag::CInputStream& in, const CVParamTransfer& paramXfer); CFactoryFnReturn MakeObjectFromMemory(const SObjectTag& tag, void* buf, int size, bool compressed, const CVParamTransfer& paramXfer); void AddFactory(FourCC key, FFactoryFunc func) { m_factories[key] = func; } }; } #endif // __PSHAG_CFACTORYMGR_HPP__