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

Defines the Simulation runtime context data type. More...

#include <runtime_context.h>

Public Member Functions

 RuntimeContext ()=delete
 
 RuntimeContext (EventAggregator &bus, SimulationDefinition &definition)
 Initialises a new instance of the RuntimeContext class. More...
 
int time_now () const noexcept
 Gets the current simulation time. More...
 
int start_time () const noexcept
 Gets the experiment start time. More...
 
unsigned int current_run () const noexcept
 Gets the experiment current run number. More...
 
int sync_timeout_millis () const noexcept
 Gets the data synchronisation timeout in milliseconds. More...
 
Populationpopulation () noexcept
 Gets a reference to the virtual population container. More...
 
RuntimeMetricmetrics () noexcept
 Gets a reference to the runtime metrics container. More...
 
Scenarioscenario () noexcept
 Gets a reference to the simulation experiment scenario. More...
 
Randomrandom () noexcept
 Gets a reference to the engine random number generator. More...
 
const HierarchicalMappingmapping () const noexcept
 Gets a read-only reference to the hierarchical risk factors mapping. More...
 
const std::vector< core::DiseaseInfo > & diseases () const noexcept
 Gets a read-only reference to the select diseases information. More...
 
const core::IntegerIntervalage_range () const noexcept
 Gets a read-only reference to the population age range constraints. More...
 
const std::string identifier () const noexcept
 Gets the simulation identifier for outside world messages. More...
 
void set_current_time (const int time_now) noexcept
 Sets the current simulation time value. More...
 
void set_current_run (const unsigned int run_number) noexcept
 Sets the current simulation run number. More...
 
void reset_population (const std::size_t initial_pop_size, const int model_start_time)
 Resets the virtual population to an initial size, with only new individuals. More...
 
void publish (std::unique_ptr< EventMessage > message) const noexcept
 Publishes a polymorphic new message to the outside world synchronously. More...
 
void publish_async (std::unique_ptr< EventMessage > message) const noexcept
 Publishes a polymorphic new message to the outside world asynchronously. More...
 

Detailed Description

Defines the Simulation runtime context data type.

The context holds the simulation runtime information, including the virtual population, and expose to all modules via the API calls. Only one context instance exists per simulation instance for internal use only by the engine algorithm.

Constructor & Destructor Documentation

◆ RuntimeContext() [1/2]

hgps::RuntimeContext::RuntimeContext ( )
delete

◆ RuntimeContext() [2/2]

hgps::RuntimeContext::RuntimeContext ( EventAggregator bus,
SimulationDefinition definition 
)

Initialises a new instance of the RuntimeContext class.

Parameters
busThe message bus instance for communication with the outside world
definitionThe simulation experiment definition.

Member Function Documentation

◆ age_range()

const core::IntegerInterval & hgps::RuntimeContext::age_range ( ) const
noexcept

Gets a read-only reference to the population age range constraints.

Returns
Allowed age range
Here is the caller graph for this function:

◆ current_run()

unsigned int hgps::RuntimeContext::current_run ( ) const
noexcept

Gets the experiment current run number.

Returns
Current run number
Here is the caller graph for this function:

◆ diseases()

const std::vector< core::DiseaseInfo > & hgps::RuntimeContext::diseases ( ) const
noexcept

Gets a read-only reference to the select diseases information.

Returns
Selected diseases

◆ identifier()

const std::string hgps::RuntimeContext::identifier ( ) const
noexcept

Gets the simulation identifier for outside world messages.

Returns
Simulation identifier

◆ mapping()

const HierarchicalMapping & hgps::RuntimeContext::mapping ( ) const
noexcept

Gets a read-only reference to the hierarchical risk factors mapping.

Returns
Risk factor mapping
Here is the caller graph for this function:

◆ metrics()

RuntimeMetric & hgps::RuntimeContext::metrics ( )
noexcept

Gets a reference to the runtime metrics container.

Returns
Runtime metrics
Here is the caller graph for this function:

◆ population()

Population & hgps::RuntimeContext::population ( )
noexcept

Gets a reference to the virtual population container.

Returns
Virtual population
Here is the caller graph for this function:

◆ publish()

void hgps::RuntimeContext::publish ( std::unique_ptr< EventMessage message) const
noexcept

Publishes a polymorphic new message to the outside world synchronously.

Parameters
messageThe message instance to publish
Here is the caller graph for this function:

◆ publish_async()

void hgps::RuntimeContext::publish_async ( std::unique_ptr< EventMessage message) const
noexcept

Publishes a polymorphic new message to the outside world asynchronously.

Parameters
messageThe message instance to publish

◆ random()

Random & hgps::RuntimeContext::random ( )
noexcept

Gets a reference to the engine random number generator.

Returns
Random number generator
Here is the caller graph for this function:

◆ reset_population()

void hgps::RuntimeContext::reset_population ( const std::size_t  initial_pop_size,
const int  model_start_time 
)

Resets the virtual population to an initial size, with only new individuals.

Parameters
initial_pop_sizeInitial population size
model_start_timeExperiment start time

◆ scenario()

Scenario & hgps::RuntimeContext::scenario ( )
noexcept

Gets a reference to the simulation experiment scenario.

Returns
Experiment scenario
Here is the caller graph for this function:

◆ set_current_run()

void hgps::RuntimeContext::set_current_run ( const unsigned int  run_number)
noexcept

Sets the current simulation run number.

Parameters
run_numberThe new run number

◆ set_current_time()

void hgps::RuntimeContext::set_current_time ( const int  time_now)
noexcept

Sets the current simulation time value.

Parameters
time_nowThe new simulation time
Here is the caller graph for this function:

◆ start_time()

int hgps::RuntimeContext::start_time ( ) const
noexcept

Gets the experiment start time.

Returns
Experiment start time
Here is the caller graph for this function:

◆ sync_timeout_millis()

int hgps::RuntimeContext::sync_timeout_millis ( ) const
noexcept

Gets the data synchronisation timeout in milliseconds.

Returns
Timeout in milliseconds

◆ time_now()

int hgps::RuntimeContext::time_now ( ) const
noexcept

Gets the current simulation time.

Returns
Current simulation time
Here is the caller graph for this function:

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