10#ifndef fsCComponentFactoryhdr
11#define fsCComponentFactoryhdr
33 static std::shared_ptr<fsCComponentFactory>
create();
54 std::map<fsU32, TCreateFnc> mComponents;
63 fsAssert( mComponents.find( T::mTypeId.idGet() ) == mComponents.end(),
"Already registered component of type %s.\n",
typeid( T ).name() );
73 return T::create(pParent);
75 mComponents.insert(std::pair<fsU32, TCreateFnc>(T::mTypeId.idGet(), createFnc));
76 fsTrace(
"registering: %s",
typeid(T).name() );
fsBool componentTypeIsRegisteredGet(const fsCUniqueId &pTypeId) const
Definition fsCComponentFactory.cpp:59
static std::shared_ptr< fsCComponentFactory > create()
Definition fsCComponentFactory.cpp:145
virtual void componentsRegister()
Definition fsCComponentFactory.cpp:64
friend class fsCEntity
Definition fsCComponentFactory.h:27
static void componentDestroy(fsIComponent *pComponent)
Definition fsCComponentFactory.cpp:114
fsIComponent *(* TCreateFnc)(fsCEntity *pParent)
Definition fsCComponentFactory.h:31
fsCComponentFactory()
Definition fsCComponentFactory.cpp:152
void componentRegister()
Definition fsCComponentFactory.h:60
virtual ~fsCComponentFactory()
Definition fsCComponentFactory.cpp:157
fsIComponent * componentCreate(fsCEntity *pParent, const fsCUniqueId &pTypeId)
Definition fsCComponentFactory.cpp:124
void merge(fsCComponentFactory *const pRHS)
Definition fsCComponentFactory.cpp:54
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
Definition fsIComponent.h:26
#define fsAssert(pStatement, pFmtString,...)
Definition fsAssert.h:23
#define fsTrace(...)
Definition fsTrace.h:20
bool fsBool
Definition fsBaseTypes.h:26