]> pilppa.org Git - libplp.git/blob - src/Data.hh
w1 independent file cleanups.
[libplp.git] / src / Data.hh
1 /*
2  * Data.hh
3  *
4  *  Created on: Dec 8, 2010
5  *      Author: lamikr
6  */
7
8 #ifndef DATA_HH_
9 #define DATA_HH_
10
11 #include <string>
12 #include <valarray>
13 #include <vector>
14
15 #include "Date.hh"
16
17 namespace plp {
18         class Data {
19                 public:
20                         Data(int size);
21                         Data(int size, double default_value, std::string unit_param);
22                         Data(std::vector<double> *val_vector_param);
23                         Data(std::vector<double> *val_vector_param, std::string unit_param);
24                         Data(std::vector<double> *val_vector_param, plp::Date *date_param, std::string unit_param);
25                         Data(std::valarray<double> *val_arr_param, plp::Date *date_param);
26                         virtual ~Data();
27                         Data *clone();
28                         void printout();
29                         std::string to_string(int dec_precision);
30                         std::string to_string();
31                         static Data *parse_string(const std::string& data_str);
32                         plp::Date get_date();
33                         void set_date(plp::Date *date_param);
34                         int get_value_count();
35                         double get(int indx);
36                         std::string get_unit();
37                         std::valarray<double>   value_arr;
38                 private:
39                         plp::Date       date_time;
40                         std::string     unit;
41         };
42
43         class DataRange {
44                 public:
45                         DataRange();
46                         DataRange(Data *data);
47                         DataRange(DataRange *datarange);
48                         DataRange(int item_count_per_value, std::string unit_param);
49                         virtual ~DataRange();
50                         void add(Data *data);
51                         void add(DataRange *datarange);
52                         Data *get(int row_index);
53                         Data *get_first();
54                         Data *get_last();
55                         int get_count();
56                         int get_data_item_value_count();
57                         std::string get_unit();
58                         void printout();
59                 protected:
60                         double                          *val_matrix;
61                         std::vector<plp::Date *>        date_list;
62                         int                             row_count;
63                         int                             column_count;
64                         std::string                     unit;
65         };
66 }
67
68 #endif /* DATA_HH_ */