2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CFACTORYMGR_HPP__
|
|
|
|
#define __URDE_CFACTORYMGR_HPP__
|
2015-08-23 06:42:29 +00:00
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
#include "RetroTypes.hpp"
|
2016-02-16 05:50:41 +00:00
|
|
|
#include "IOStreams.hpp"
|
2016-04-13 06:07:23 +00:00
|
|
|
#include "IFactory.hpp"
|
2015-08-23 06:42:29 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-23 06:42:29 +00:00
|
|
|
{
|
2016-02-17 03:42:27 +00:00
|
|
|
struct SObjectTag;
|
2015-08-23 06:42:29 +00:00
|
|
|
class CVParamTransfer;
|
2016-02-16 05:50:41 +00:00
|
|
|
class IObj;
|
2015-08-23 06:42:29 +00:00
|
|
|
|
|
|
|
class CFactoryMgr
|
|
|
|
{
|
2016-02-16 05:50:41 +00:00
|
|
|
std::unordered_map<FourCC, FFactoryFunc> m_factories;
|
2016-03-29 23:14:14 +00:00
|
|
|
std::unordered_map<FourCC, FMemFactoryFunc> m_memFactories;
|
2015-08-23 06:42:29 +00:00
|
|
|
public:
|
2016-03-04 23:04:53 +00:00
|
|
|
CFactoryFnReturn MakeObject(const SObjectTag& tag, urde::CInputStream& in,
|
2016-02-16 05:50:41 +00:00
|
|
|
const CVParamTransfer& paramXfer);
|
2016-03-29 23:14:14 +00:00
|
|
|
bool CanMakeMemory(const urde::SObjectTag& tag) const;
|
2016-04-13 06:07:23 +00:00
|
|
|
CFactoryFnReturn MakeObjectFromMemory(const SObjectTag& tag,
|
|
|
|
std::unique_ptr<u8[]>&& buf,
|
|
|
|
int size, bool compressed,
|
2016-02-16 05:50:41 +00:00
|
|
|
const CVParamTransfer& paramXfer);
|
2016-03-31 02:44:43 +00:00
|
|
|
void AddFactory(FourCC key, FFactoryFunc func) {m_factories[key] = func;}
|
|
|
|
void AddFactory(FourCC key, FMemFactoryFunc func) {m_memFactories[key] = func;}
|
2015-08-23 06:42:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CFACTORYMGR_HPP__
|