Base class of all factories This class has the purpose to produce at runtime instances of classes not known at compile time. More...
#include <Factory.h>
Public Member Functions | |
void | AddProducer (const char *sClassName, AbstractProducer *pcProducer) |
Adds a new prducer instance. | |
std::list< std::string > | CanProduce () const |
returns a list of all registered producer | |
bool | CanProduce (const char *sClassName) const |
returns true if there is a producer for this class registered | |
Protected Member Functions | |
Factory (void) | |
construction | |
void * | Produce (const char *sClassName) const |
produce a class with the given name | |
virtual | ~Factory () |
destruction | |
Protected Attributes | |
std::map< const std::string, AbstractProducer * > | _mpcProducers |
Base class of all factories This class has the purpose to produce at runtime instances of classes not known at compile time.
It holds a map of so called producers which are able to produce an instance of a special class. Producer can be registered at runtime through e.g. application modules
Definition at line 57 of file Factory.h.
Base::Factory::Factory | ( | void | ) | [inline, protected] |
Factory::~Factory | ( | ) | [protected, virtual] |
void Factory::AddProducer | ( | const char * | sClassName, | |
AbstractProducer * | pcProducer | |||
) |
Adds a new prducer instance.
Definition at line 56 of file Factory.cpp.
References _mpcProducers.
Referenced by Gui::CustomPageProducer< CLASS >::CustomPageProducer(), Gui::PrefPageProducer< CLASS >::PrefPageProducer(), Gui::PrefPageUiProducer::PrefPageUiProducer(), Base::ScriptProducer::ScriptProducer(), and Gui::WidgetProducer< CLASS >::WidgetProducer().
std::list< std::string > Factory::CanProduce | ( | ) | const |
returns a list of all registered producer
Definition at line 66 of file Factory.cpp.
References _mpcProducers.
bool Factory::CanProduce | ( | const char * | sClassName | ) | const |
returns true if there is a producer for this class registered
Definition at line 61 of file Factory.cpp.
References _mpcProducers.
Referenced by Gui::UiLoader::createWidget().
void * Factory::Produce | ( | const char * | sClassName | ) | const [protected] |
produce a class with the given name
Definition at line 45 of file Factory.cpp.
References _mpcProducers.
Referenced by Gui::WidgetFactoryInst::createPreferencePage(), Gui::WidgetFactoryInst::createWidget(), Gui::WorkbenchFactoryInst::createWorkbench(), and Base::ScriptFactorySingleton::ProduceScript().
std::map<const std::string, AbstractProducer*> Base::Factory::_mpcProducers [protected] |
Definition at line 70 of file Factory.h.
Referenced by AddProducer(), CanProduce(), Produce(), Gui::WorkbenchFactoryInst::workbenches(), and ~Factory().