Castor3D 0.16.0
Multiplatform 3D engine
|
Factory concept implementation. More...
#include <Factory.hpp>
Classes | |
struct | ListEntry |
Public Types | |
using | Obj = ObjT |
using | Key = KeyT |
using | Entry = EntryT |
using | Id = IdT |
using | PtrType = PtrTypeT |
using | Creator = CreatorT |
using | ObjPtr = PtrType |
using | ObjCont = Vector< Entry > |
Public Member Functions | |
Entry & | registerType (Key const &key, Creator create) |
Registers an object type. | |
void | unregisterType (Key const &key) |
Unregisters an object type. | |
Id | getTypeId (Key const &key) const |
Key | getIdType (Id const &id) const |
bool | isTypeRegistered (Key const &key) const |
Checks if the given object type is registered. | |
Vector< ListEntry > | listRegisteredTypes () const |
template<typename ... Parameters> | |
ObjPtr | create (Key const &key, Parameters &&... params) const |
Creates an object from a key. | |
Protected Attributes | |
Id | m_currentId {} |
ObjCont | m_registered |
Factory concept implementation.
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::Creator = CreatorT |
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::Entry = EntryT |
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::Id = IdT |
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::Key = KeyT |
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::Obj = ObjT |
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::ObjCont = Vector< Entry > |
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::ObjPtr = PtrType |
using castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::PtrType = PtrTypeT |
|
inline |
Creates an object from a key.
[in] | key | The object type |
[in] | params | The creation parameters |
References CU_Exception, castor::ERROR_UNKNOWN_OBJECT, and castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_registered.
Referenced by castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::registerType().
|
inline |
[in] | id | The object type ID. |
References castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_registered.
|
inline |
[in] | key | The object type. |
References castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_registered.
|
inline |
Checks if the given object type is registered.
[in] | key | The object type. |
true
if registered. References castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_registered.
|
inline |
References castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_registered.
|
inline |
Registers an object type.
[in] | key | The object type |
[in] | create | The object creation function |
References castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::create(), castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_currentId, and castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_registered.
|
inline |
Unregisters an object type.
[in] | key | The object type |
References castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::m_registered.
|
protected |
|
protected |
Referenced by castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::create(), castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::getIdType(), castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::getTypeId(), castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::isTypeRegistered(), castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::listRegisteredTypes(), castor3d::PassFactory::listRegisteredTypes(), castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::registerType(), and castor::Factory< ObjT, KeyT, PtrTypeT, CreatorT, IdT, EntryT >::unregisterType().