Blame view

src/ParamOutputImpl/DataMining/DataMiningValidInterval.hh 2.36 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * DataMiningValidInterval.hh
 *
 *  Created on: 3 oct. 2013
 *      Author: guillaume
 */

#ifndef DATAMININGVALIDINTERVAL_HH_
#define DATAMININGVALIDINTERVAL_HH_

#include "DataMiningType.hh"

#include <utility>
#include <vector>
#include <memory>

#include "TimeInterval.hh"
#include "AbstractWriter.hh"


using namespace AMDA::Parameters;

namespace AMDA {
	namespace ParamOutputImpl {
		namespace DataMining {

			class ParamOutputDataMining;

			typedef boost::shared_ptr<TimeTable> TimeTableSPtr;

			class DataMiningValidInterval : public DataMiningType {

			public:
				DataMiningValidInterval(std::string pPrefixTTFileName, LogicalData pDataToMatch, ParamOutputDataMining* pParamOutputDataMining);

				/**
				 * @brief Change time interval on which to work.
				 * @note It also reset static data to begin with proper value and not with the old time interval.
				 */
				void setTimeInterval(const TimeInterval& pTimeInterval);

				/**
				 * @brief Create interval in which value corresponds to the given value in constructor parameter.
				 */
				void createInterval(ParamDataLogicalData* pParamData, ParamDataIndexInfo pParamDataIndexInfo);

				/**
				 * @brief Fill information (history, description, filename, ...).
				 */
				void fillInformation(TimeTable::TIME_FORMAT pTimeFormat, std::string pFileName, int pIndex = 0);

			protected:
				/**
				 * @brief _valCurrent read, true if current value is True (see LogicalData)
				*/
				bool _valCurrent;

				/**
				 * @brief _beginTimeInterval identify the beginning value of an interval
				 */
				double _beginTimeInterval;

				/**
				 * @brief _beginTimeInterval identify the ending value of an interval
				 */
				double _endTimeInterval;

				static log4cxx::LoggerPtr _logger;

			private:
				LogicalData _dataToMatch;

				void checkTimeIntervalBounds();

				void finalize();
			};

			struct DataMiningTrue : public DataMiningValidInterval {
				DataMiningTrue (ParamOutputDataMining* pParamOutputDataMining) :
					DataMiningValidInterval("", LogicalData::True,  pParamOutputDataMining) {
				}
			};

			struct DataMiningNoData : public DataMiningValidInterval {
				DataMiningNoData (ParamOutputDataMining* pParamOutputDataMining) :
					DataMiningValidInterval("Gaps_", LogicalData::NaN,  pParamOutputDataMining) {
				}
			};

		} // DataMining
	} // ParamOutputImpl
} // AMDA
#endif /* DATAMININGVALIDINTERVAL_HH_ */