1#ifndef MODULE_FACTORY_H
2#define MODULE_FACTORY_H
9#include <unordered_map>
37 static std::shared_ptr<GenericManagingModule<T>>
create(
const std::string&
name,
43 static std::vector<std::shared_ptr<GenericManagingModule<T>>>
54 static std::unordered_map<std::string, creation_method_submodules> m_registry_submodules;
55 static std::unordered_map<std::string, creation_method> m_registry;
60std::unordered_map<std::string,
65std::unordered_map<std::string,
84 std::cout <<
"Registering: " <<
name <<
"\n";
104 std::cerr <<
"[ModuleFactory]: No module registered with name: " <<
name;
105 throw std::runtime_error(
106 static_cast<std::string
>(
"[ModuleFactory]: No module registered with name: ") +
name);
125 std::cout <<
"Registering submodule: " <<
name <<
"\n";
147 std::cerr <<
"[ModuleFactory]: No submodule registered with name: " <<
name;
148 throw std::runtime_error(
149 static_cast<std::string
>(
"[ModuleFactory]: No submodule registered with name: ") +
name);
199std::vector<std::shared_ptr<GenericManagingModule<T>>>
241 if (m_registry_submodules.find(
submodule_name) == m_registry_submodules.end())
244 <<
" loaded in registry.\n[ModuleFactory]: This submodule was requested "
245 "in managing module "
247 throw std::runtime_error(
"[ModuleFactory]: No submodule "
249 +
" loaded in registry.\n[ModuleFactory]: This submodule was "
250 "requested in managing module "
251 +
static_cast<std::string
>(
module_pointer->getNameLocal()) +
"\n");
277 if (m_registry_submodules.find(
submodule_name) == m_registry_submodules.end())
280 <<
" loaded in registry.\n[ModuleFactory]: This submodule "
281 "was requested in submodule "
283 throw std::runtime_error(
284 "[ModuleFactory]: No submodule "
286 +
" loaded in registry.\n[ModuleFactory]: This submodule "
287 "was requested in submodule "
Concrete implementation of a matrix class representing a Compressed Sparse Rows (CSR) matrix....
Definition CsrMatrix.h:37
CsrSparseMatrix()
Constructor for an empty CsrSparseMatrix object. Leaves all storage arrays empty but sets the flag to...
Definition CsrMatrix.h:94
Class to register and generate every module compiled into the executable. Has static auto-registry fu...
Definition ModuleFactory.h:23
std::shared_ptr< GenericManagingModule< T > >(*)(SimulationClassBase< T > *sim) creation_method
Definition ModuleFactory.h:26
static std::vector< std::shared_ptr< GenericManagingModule< T > > > createAllSelectedManagingModules(SimulationClassBase< T > *sim_pointer, const std::vector< std::string > &list_of_mananging_modules_to_load)
Only creates instances of managing modules that have been specified by the user. (This allows only ha...
Definition ModuleFactory.h:200
static constexpr bool registerModule(std::string name, creation_method module) noexcept
Function that adds a module to the module registry map.
Definition ModuleFactory.h:76
static std::vector< std::shared_ptr< GenericSubmodule< T > > > createAllSelectedSubmodules(SimulationClassBase< T > *sim_pointer, const std::vector< std::shared_ptr< GenericManagingModule< T > > > &loaded_managing_modules)
Only creates submodules that are used within the simulation. Iteratively requests the submodule list ...
Definition ModuleFactory.h:229
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:137
static std::vector< std::shared_ptr< GenericSubmodule< T > > > createAllSubmodules(SimulationClassBase< T > *sim_pointer)
Creates every submodule in the submodule registry.
Definition ModuleFactory.h:177
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:96
std::shared_ptr< GenericSubmodule< T > >(*)(SimulationClassBase< T > *sim) creation_method_submodules
Definition ModuleFactory.h:28
static std::vector< std::shared_ptr< GenericManagingModule< T > > > createAllManagingModules(SimulationClassBase< T > *sim_pointer)
Creates every module in the module registry.
Definition ModuleFactory.h:158