StatisticOutput.hh
2.78 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* StatisticOutput.hh
*
* Created on: 04 nov. 2014
* Author: AKKA
*/
#ifndef STATISTICOUTPUT_HH_
#define STATISTICOUTPUT_HH_
#include "ParamOutput.hh"
#include "StatisticProperties.hh"
#include "StatisticLogger.hh"
#include "StatisticProcess.hh"
#include "Catalog.hh"
#include <memory>
namespace AMDA {
namespace ParamOutputImpl {
namespace Statistic {
/**
* @class StatisticOutput
* @brief Implementation of a ParamOutput to apply statistic processes on parameters.
* @details
*/
class StatisticOutput: public AMDA::Parameters::ParamOutput {
public:
/*
* @brief Working structure to describe a process
*/
typedef struct {
std::string _paramId;
std::string _functionName;
std::string _dataKey;
std::string _coverageKey;
int _index;
std::shared_ptr<AMDA::Parameters::StatisticProcess> _statisticProcesSPtr;
} ProcessDescription;
/*
* @brief Constructor
*/
StatisticOutput(AMDA::Parameters::ParameterManager& pParameterManager);
/*
* @brief Destructor
*/
virtual ~StatisticOutput();
/**
* @overload DataClient::establishConnection()
*/
virtual void establishConnection();
/*
* @brief Get properties of the statistic request
*/
StatisticProperties& getStatisticProperties()
{
return _statisticProperties;
}
/*
* @brief Set properties of the statistic request
*/
void setStatisticProperties(const StatisticProperties& statisticProperties)
{
_statisticProperties = statisticProperties;
}
protected:
/**
* @overload ParamOutput::init()
*/
virtual void init();
/**
* @overload ParamOutput::apply()
*/
virtual void apply();
private:
/*
* @brief apply one file output structure
*/
void applyOneFile(bool isFirstInterval);
/*
* @brief apply one file per parameter output structure
*/
void applyOneFilePerParameter(bool isFirstInterval);
/*
* @brief Init a catalog if need
*/
void initCatalog(std::string paramId);
/*
* @brief Get catalog name
*/
std::string getCatalogName(std::string paramId);
/*
* @brief Get TimeTable name
*/
std::string getTTName(void);
/*
* @brief Add a process description in catalog
*/
void addProcessDescriptionInCatalog(TimeTableCatalog::Catalog* pCatalog, ProcessDescription* pProcDesc);
/**
* Statistic properties
*/
StatisticProperties _statisticProperties;
/*
* @brief Index of current interval
*/
int _currentIntervalIndex;
/*
* @brief List of process description
*/
std::vector<ProcessDescription> _processDescriptionList;
/*
* @brief Map of catalog used to write statistic results.
* The key is the paramId or, for output structure ONE-FILE, an empty string
*/
std::map<std::string,TimeTableCatalog::Catalog> _statisticCatalogMap;
};
} /* namespace Statistic */
} /* namespace ParamOutputImpl */
} /* namespace AMDA */
#endif /* STATISTICOUTPUT_HH_ */