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

Defines the Simulation results container for time series data. More...

#include <data_series.h>

Public Member Functions

 DataSeries ()=delete
 
 DataSeries (std::size_t sample_size)
 Initialises a new instance of the DataSeries class. More...
 
std::vector< double > & operator() (core::Gender gender, std::string key)
 Gets a reference to a channel by Gender and identifier. More...
 
std::vector< double > & at (core::Gender gender, std::string key)
 Gets a reference to a channel by Gender and identifier. More...
 
const std::vector< double > & at (core::Gender gender, std::string key) const
 Gets a read-only reference to a channel by Gender and identifier. More...
 
const std::vector< std::string > & channels () const noexcept
 Gets the collection of channel identifiers. More...
 
void add_channel (std::string key)
 Adds a new channel to the collection. More...
 
void add_channels (const std::vector< std::string > &keys)
 Adds multiple channels to the collection. More...
 
std::size_t size () const noexcept
 Gets the size of the channels collection. More...
 
std::size_t sample_size () const noexcept
 Gets the channels sample size, number of points per channel. More...
 

Detailed Description

Defines the Simulation results container for time series data.

Channels with the time series result data are stored by Gender and Identifier. The collection of channels is dynamic, but all channels must contain exact the same number of data points, sample size, as given during initialisation.

Constructor & Destructor Documentation

◆ DataSeries() [1/2]

hgps::DataSeries::DataSeries ( )
delete

◆ DataSeries() [2/2]

hgps::DataSeries::DataSeries ( std::size_t  sample_size)

Initialises a new instance of the DataSeries class.

Parameters
sample_sizeThe channels sample size, number of data points.

Member Function Documentation

◆ add_channel()

void hgps::DataSeries::add_channel ( std::string  key)

Adds a new channel to the collection.

Parameters
keyThe new channel unique identifier
Exceptions
std::logic_errorfor duplicated channel identifier
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_channels()

void hgps::DataSeries::add_channels ( const std::vector< std::string > &  keys)

Adds multiple channels to the collection.

Parameters
keysThe new channels identifier
Exceptions
std::logic_errorfor duplicated channel identifier
Here is the call graph for this function:

◆ at() [1/2]

std::vector< double > & hgps::DataSeries::at ( core::Gender  gender,
std::string  key 
)

Gets a reference to a channel by Gender and identifier.

Parameters
genderThe gender enumeration
keyThe channel identifier
Returns
The channel data
Exceptions
std::out_of_rangeif the container does not have a channel with the specified age and key

◆ at() [2/2]

const std::vector< double > & hgps::DataSeries::at ( core::Gender  gender,
std::string  key 
) const

Gets a read-only reference to a channel by Gender and identifier.

Parameters
genderThe gender enumeration
keyThe channel identifier
Returns
The channel data
Exceptions
std::out_of_rangeif the container does not have a channel with the specified age and key

◆ channels()

const std::vector< std::string > & hgps::DataSeries::channels ( ) const
noexcept

Gets the collection of channel identifiers.

Returns
The collection of channel identifiers

◆ operator()()

std::vector< double > & hgps::DataSeries::operator() ( core::Gender  gender,
std::string  key 
)

Gets a reference to a channel by Gender and identifier.

Parameters
genderThe gender enumeration
keyThe channel identifier
Returns
The channel data
Exceptions
std::out_of_rangeif the container does not have a channel with the specified age and key

◆ sample_size()

std::size_t hgps::DataSeries::sample_size ( ) const
noexcept

Gets the channels sample size, number of points per channel.

Returns
The channels sample size value

◆ size()

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

Gets the size of the channels collection.

Returns
Number of channels in dataset

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