1#ifndef MODULE_FACTORY_H
2#define MODULE_FACTORY_H
8#include <unordered_map>
36 static std::shared_ptr<GenericManagingModule<T>>
create(
const std::string&
name,
46 static std::unordered_map<std::string, creation_method_submodules> m_registry_submodules;
47 static std::unordered_map<std::string, creation_method> m_registry;
52std::unordered_map<std::string,
57std::unordered_map<std::string,
76 std::cout <<
"Registering: " <<
name <<
"\n";
96 throw std::runtime_error(
"ModuleFactory: No module registered with name: " +
name);
115 std::cout <<
"Registering submodule: " <<
name <<
"\n";
137 throw std::runtime_error(
"ModuleFactory: No module registered with name: " +
name);
Error class to throw when a module chain has circular or missing dependencies. Inherits from std::exc...
Definition ChainManager.h:28
Class to register and generate every module compiled into the executable. Has static auto-registry fu...
Definition ModuleFactory.h:22
std::shared_ptr< GenericManagingModule< T > >(*)(SimulationClassBase< T > *sim) creation_method
Definition ModuleFactory.h:25
static constexpr bool registerModule(std::string name, creation_method module) noexcept
Function that adds a module to the module registry map.
Definition ModuleFactory.h:68
static std::shared_ptr< GenericSubmodule< T > > createSubmodule(const std::string &name, SimulationClassBase< T > *sim)
Creates a submodule, if a submodule with the corresponding name has been registered.
Definition ModuleFactory.h:127
static std::vector< std::shared_ptr< GenericSubmodule< T > > > createAllSubmodules(SimulationClassBase< T > *sim_pointer)
Creates every submodule in the submodule registry.
Definition ModuleFactory.h:165
static std::shared_ptr< GenericManagingModule< T > > create(const std::string &name, SimulationClassBase< T > *sim)
Creates a module, if a module with the corresponding name has been registered.
Definition ModuleFactory.h:88
std::shared_ptr< GenericSubmodule< T > >(*)(SimulationClassBase< T > *sim) creation_method_submodules
Definition ModuleFactory.h:27
static std::vector< std::shared_ptr< GenericManagingModule< T > > > createAllManagingModules(SimulationClassBase< T > *sim_pointer)
Creates every module in the module registry.
Definition ModuleFactory.h:146