Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
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.
 
std::vector< double > & operator() (core::Gender gender, const std::string &key)
 Gets a reference to a channel by Gender and identifier.
 
std::vector< double > & at (core::Gender gender, const std::string &key)
 Gets a reference to a channel by Gender and identifier.
 
const std::vector< double > & at (core::Gender gender, const std::string &key) const
 Gets a read-only reference to a channel by Gender and identifier.
 
std::vector< double > & at (core::Gender gender, core::Income income, const std::string &key)
 Gets a reference to a channel by Gender, Income and identifier.
 
const std::vector< double > & at (core::Gender gender, core::Income income, const std::string &key) const
 Gets a read-only reference to a channel by Gender, Income and identifier.
 
const std::vector< std::string > & channels () const noexcept
 Gets the collection of channel identifiers.
 
void add_channel (std::string key)
 Adds a new channel to the collection.
 
void add_channels (const std::vector< std::string > &keys)
 Adds multiple channels to the collection.
 
void add_income_channels (const std::vector< std::string > &keys)
 Adds income-based channels to the collection.
 
void add_income_channels_for_categories (const std::vector< std::string > &keys, const std::vector< core::Income > &income_categories)
 Adds income-based channels for specific income categories.
 
std::size_t size () const noexcept
 Gets the size of the channels collection.
 
std::size_t sample_size () const noexcept
 Gets the channels sample size, number of points per channel.
 
std::vector< core::Incomeget_available_income_categories () const
 Gets available income categories from the data.
 
bool has_income_category (core::Gender gender, core::Income income) const
 Checks if an income category exists for a given gender.
 
bool has_income_channel (core::Gender gender, core::Income income, const std::string &key) const
 True if an income-stratified channel key exists (gender, income, key).
 
std::string income_category_to_string (core::Income income) const
 Converts income category enum to string representation.
 

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:

◆ add_income_channels()

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

Adds income-based channels to the collection.

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

◆ add_income_channels_for_categories()

void hgps::DataSeries::add_income_channels_for_categories ( const std::vector< std::string > &  keys,
const std::vector< core::Income > &  income_categories 
)

Adds income-based channels for specific income categories.

Here is the call graph for this function:

◆ at() [1/4]

std::vector< double > & hgps::DataSeries::at ( core::Gender  gender,
const 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/4]

const std::vector< double > & hgps::DataSeries::at ( core::Gender  gender,
const 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

◆ at() [3/4]

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

Gets a reference to a channel by Gender, Income and identifier.

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

◆ at() [4/4]

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

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

Parameters
genderThe gender enumeration
incomeThe income enumeration
keyThe channel identifier
Returns
The channel data
Exceptions
std::out_of_rangeif the container does not have a channel with the specified gender, income 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

◆ get_available_income_categories()

std::vector< core::Income > hgps::DataSeries::get_available_income_categories ( ) const

Gets available income categories from the data.

Returns
Vector of available income categories

◆ has_income_category()

bool hgps::DataSeries::has_income_category ( core::Gender  gender,
core::Income  income 
) const

Checks if an income category exists for a given gender.

Parameters
genderThe gender enumeration
incomeThe income enumeration
Returns
true if the income category exists, false otherwise

◆ has_income_channel()

bool hgps::DataSeries::has_income_channel ( core::Gender  gender,
core::Income  income,
const std::string &  key 
) const

True if an income-stratified channel key exists (gender, income, key).

Here is the call graph for this function:

◆ income_category_to_string()

std::string hgps::DataSeries::income_category_to_string ( core::Income  income) const

Converts income category enum to string representation.

Parameters
incomeThe income enumeration
Returns
String representation of the income category

◆ operator()()

std::vector< double > & hgps::DataSeries::operator() ( core::Gender  gender,
const 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: