Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
modulefactory.h
Go to the documentation of this file.
1#pragma once
2
3#include "interfaces.h"
4#include "modelinput.h"
5#include "repository.h"
6#include <functional>
7#include <unordered_map>
8
9namespace hgps {
10
22 public:
24 using ModuleType = std::shared_ptr<SimulationModule>;
25
28
32 SimulationModuleFactory(Repository &data_repository);
33
36 std::size_t size() const noexcept;
37
41 bool contains(const SimulationModuleType type) const noexcept;
42
46 void register_builder(const SimulationModuleType type, const ConcreteBuilder builder);
47
52 ModuleType create(const SimulationModuleType type, const ModelInput &config);
53
54 private:
55 std::reference_wrapper<Repository> repository_;
56 std::unordered_map<SimulationModuleType, ConcreteBuilder> builders_;
57};
58} // namespace hgps
Defines the Simulation model inputs data type.
Definition modelinput.h:49
Define the data repository interface for input datasets and back-end storage.
Definition repository.h:18
Defines the SimulationModule factory data type.
Definition modulefactory.h:21
ModuleType create(const SimulationModuleType type, const ModelInput &config)
Create a polymorphic SimulationModule instance.
Definition modulefactory.cpp:21
ModuleType(*)(Repository &, const ModelInput &) ConcreteBuilder
Concrete module builder function signature.
Definition modulefactory.h:27
std::size_t size() const noexcept
Gets the number of registered module instance.
Definition modulefactory.cpp:9
void register_builder(const SimulationModuleType type, const ConcreteBuilder builder)
Registers a simulation module type builder function.
Definition modulefactory.cpp:15
bool contains(const SimulationModuleType type) const noexcept
Determine whether the factory contains an instance of a module type.
Definition modulefactory.cpp:11
std::shared_ptr< SimulationModule > ModuleType
Base module type.
Definition modulefactory.h:24
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8
SimulationModuleType
Health GPS simulation modules types enumeration.
Definition interfaces.h:13
Global namespace.
Definition column_iterator.h:123