23 #ifndef SRC_CONFIGURATION_APPLICATIONFACTORY_HPP_
24 #define SRC_CONFIGURATION_APPLICATIONFACTORY_HPP_
32 #include <boost/atomic.hpp>
33 #include <boost/thread/mutex.hpp>
39 namespace application {
70 template <
class AppType>
79 return new AppType(app_name_);
107 template <
class AppType>
111 throw std::runtime_error(
"Application factory: internal factory already existing! Possible reason: multiple REGISTER_APPLICATION macro calls.");
124 throw std::runtime_error(
"Application factory: internal factory not existing! Possible reason: Macro REGISTER_APPLICATION was not called.");
153 #define APP_FACTORY mic::application::ApplicationFactory::getInstance()
160 #define REGISTER_APPLICATION(AppType) APP_FACTORY->RegisterFactory<AppType>();
virtual ~ApplicationFactory()
virtual mic::application::Application * create(std::string app_name_)=0
void RegisterApplication(void)
Declaration of a function that must be defined in each application-derived class separately.
Base class for all applications.
virtual ~FactoryInterface()
mic::application::Application * create(std::string app_name_)
mic::application::Application * create(std::string app_name_)
FactoryInterface * internal_factory
"Internal factory", responsible for returning of classes of different objects (applications).
Template class used for generation of concrete object factories. This enables that each application h...
static boost::atomic< ApplicationFactory * > instance_
static ApplicationFactory * getInstance()
ApplicationState declaration.
static boost::mutex instantiation_mutex
Application factory, class responsible for generation of an application object. Defined in the form o...
Abstract class constituting interface for application factories.