Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::SimulationModuleFactory Class Reference

Defines the SimulationModule factory data type. More...

#include <modulefactory.h>

Public Types

using ModuleType = std::shared_ptr< SimulationModule >
 Base module type. More...
 
using ConcreteBuilder = ModuleType(*)(Repository &, const ModelInput &)
 Concrete module builder function signature. More...
 

Public Member Functions

 SimulationModuleFactory ()=delete
 
 SimulationModuleFactory (Repository &data_repository)
 Initialises a new instance of the SimulationModuleFactory class. More...
 
std::size_t size () const noexcept
 Gets the number of registered module instance. More...
 
bool contains (const SimulationModuleType type) const noexcept
 Determine whether the factory contains an instance of a module type. More...
 
void register_builder (const SimulationModuleType type, const ConcreteBuilder builder)
 Registers a simulation module type builder function. More...
 
ModuleType create (const SimulationModuleType type, const ModelInput &config)
 Create a polymorphic SimulationModule instance. More...
 

Detailed Description

Defines the SimulationModule factory data type.

The module factory is used to assemble the concrete modules implementation to compose the Health-GPS microsimulation instance. The simulation engine will request an instance of each of the SimulationModuleType enumeration module at construction.

The concrete builder function receives an instance of the back-end data storage and the user simulation inputs to create the respective module type instance for use by the microsimulation algorithm.

Member Typedef Documentation

◆ ConcreteBuilder

Concrete module builder function signature.

◆ ModuleType

Base module type.

Constructor & Destructor Documentation

◆ SimulationModuleFactory() [1/2]

hgps::SimulationModuleFactory::SimulationModuleFactory ( )
delete

◆ SimulationModuleFactory() [2/2]

hgps::SimulationModuleFactory::SimulationModuleFactory ( Repository data_repository)

Initialises a new instance of the SimulationModuleFactory class.

Parameters
data_repositoryThe back-end data repository instance to use

Member Function Documentation

◆ contains()

bool hgps::SimulationModuleFactory::contains ( const SimulationModuleType  type) const
noexcept

Determine whether the factory contains an instance of a module type.

Parameters
typeThe simulation module type
Returns
true, if the factory contains a instance; otherwise, false

◆ create()

SimulationModuleFactory::ModuleType hgps::SimulationModuleFactory::create ( const SimulationModuleType  type,
const ModelInput config 
)

Create a polymorphic SimulationModule instance.

Parameters
typeThe simulation module type
configThe simulation model inputs definition
Returns
A new SimulationModule instance
Here is the caller graph for this function:

◆ register_builder()

void hgps::SimulationModuleFactory::register_builder ( const SimulationModuleType  type,
const ConcreteBuilder  builder 
)

Registers a simulation module type builder function.

Parameters
typeThe simulation module type
builderThe module type instance builder function

◆ size()

std::size_t hgps::SimulationModuleFactory::size ( ) const
noexcept

Gets the number of registered module instance.

Returns
NUmber of registered modules

The documentation for this class was generated from the following files: