Public Member Functions | |
EventFactory (const std::string &name) | |
virtual | ~EventFactory () |
bool | isSupported (const std::string &eventType) const |
virtual SharedPtr< Event > | create (const std::string &eventType)=0 |
const std::string & | getName () const |
Protected Types | |
typedef std::list< std::string > | NameList |
List containing all supported event types by their names. | |
Protected Member Functions | |
virtual void | fillSupported ()=0 |
Fill the list of supported event types. | |
Protected Attributes | |
NameList | mSupportedTypes |
Variabl eto hold all supported types. | |
std::string | mName |
Name of the factory. |
EventFatory is an object which is able to create events of certain type. You can either create events by yourself or through such a factory.
We introduce the concept of a factory to enable sharing of new event types through plugins. That means, that plugins provide the engine such a factory to create an event object within the engine memory either in the plugin (dynamic library) memory.
Definition at line 38 of file EventFactory.h.
nrEngine::EventFactory::EventFactory | ( | const std::string & | name | ) |
Create a instance of a new factory.
Definition at line 22 of file EventFactory.cpp.
nrEngine::EventFactory::~EventFactory | ( | ) | [virtual] |
Release used memory and remove the list of supported event types from the event manager. So no new events of the supported types could be created throguh this factory
Definition at line 27 of file EventFactory.cpp.
bool nrEngine::EventFactory::isSupported | ( | const std::string & | eventType | ) | const |
Return true if the given event type is supported
Definition at line 35 of file EventFactory.cpp.
References mSupportedTypes.
virtual SharedPtr<Event> nrEngine::EventFactory::create | ( | const std::string & | eventType | ) | [pure virtual] |
Create a new instance of an event of the given type
eventType | Type name of the event to create |
const std::string& nrEngine::EventFactory::getName | ( | ) | const |
Get the name
Definition at line 71 of file EventFactory.h.