Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
data_series.h
Go to the documentation of this file.
1 #pragma once
3 
4 #include <map>
5 #include <string>
6 #include <vector>
7 
8 namespace hgps {
9 
16 class DataSeries {
17  public:
18  DataSeries() = delete;
19 
22  DataSeries(std::size_t sample_size);
23 
30  std::vector<double> &operator()(core::Gender gender, std::string key);
31 
38  std::vector<double> &at(core::Gender gender, std::string key);
39 
46  const std::vector<double> &at(core::Gender gender, std::string key) const;
47 
50  const std::vector<std::string> &channels() const noexcept;
51 
55  void add_channel(std::string key);
56 
60  void add_channels(const std::vector<std::string> &keys);
61 
64  std::size_t size() const noexcept;
65 
68  std::size_t sample_size() const noexcept;
69 
70  private:
71  std::size_t sample_size_;
72  std::vector<std::string> channels_;
73  std::map<core::Gender, std::map<std::string, std::vector<double>>> data_;
74 };
75 } // namespace hgps
Defines the Simulation results container for time series data.
Definition: data_series.h:16
DataSeries()=delete
std::size_t sample_size() const noexcept
Gets the channels sample size, number of points per channel.
Definition: data_series.cpp:46
void add_channel(std::string key)
Adds a new channel to the collection.
Definition: data_series.cpp:27
std::vector< double > & operator()(core::Gender gender, std::string key)
Gets a reference to a channel by Gender and identifier.
Definition: data_series.cpp:13
std::size_t size() const noexcept
Gets the size of the channels collection.
Definition: data_series.cpp:44
const std::vector< std::string > & channels() const noexcept
Gets the collection of channel identifiers.
Definition: data_series.cpp:25
std::vector< double > & at(core::Gender gender, std::string key)
Gets a reference to a channel by Gender and identifier.
Definition: data_series.cpp:17
void add_channels(const std::vector< std::string > &keys)
Adds multiple channels to the collection.
Definition: data_series.cpp:38
Gender
Enumerates gender types.
Definition: forward_type.h:18
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
Global namespace.
Definition: jsonparser.h:88