Blame view

src/Parameters/ParamOutput.hh 2.58 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
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
/**
 * ParamOutput.hh
 *
 *  Created on: 18 oct. 2012
 *      Author: AKKA IS
 */

#ifndef PARAMOUTPUT_HH_
#define PARAMOUTPUT_HH_

#include <map>
#include <list>
#include <boost/shared_ptr.hpp>
#include <memory>

#include "ParameterManager.hh"
#include "ParamData.hh"
#include "VisitorOfParamData.hh"
#include "DataClient.hh"
#include "Parameter.hh"
#include "PostProcessingAble.hh"

#include "log4cxx/logger.h"

namespace AMDA {
namespace Parameters {

class Parameter;

typedef boost::shared_ptr<Parameter> ParameterSPtr;

/**
 * Exception specific for ParseMainArguments
 */
struct ParamOutput_exception: virtual AMDA_exception {
};

/**
 * AMDA::Parameters::ParamOutput
 */
class ParamOutput: public AMDA::Parameters::DataClient,
		public postprocessing::PostProcessingAble {
public:

	ParamOutput(ParameterManager& pParameterManager);
	virtual ~ParamOutput();

	/**
	 * set information sampling
	 */
	void setSampling(const std::string &samplingMode, float samplingValue,
			float gapThreshold) {
		_samplingMode = samplingMode;
		_samplingValue = samplingValue;
		_gapThreshold = gapThreshold;
	}
	void setWorkPath(const std::string &workPath) {
		_workPath = workPath;
	}

	// Others methods
	/**
	 * @brief initializes time attribute
	 */
	virtual void init(TimeIntervalListSPtr pTimeIntervalList);

	void process();
	/**
	 * @brief generate output, get data with _parameter->getAsync and write data with the design pattern visitor
	 */
	virtual void apply() = 0;

	virtual void terminate();

protected:
	/**
	 * @brief initializes all parameter to process
	 */
	virtual void init() = 0;

	static log4cxx::LoggerPtr _logger;

	/**
	 * @brief _timeInterval: List of time interval on which to do output.
	 */
	TimeIntervalListSPtr _timeIntervalList;

	/**
	 * @brief _timeInterval: List of time interval for which time interval is less than sampling time.
	 */
	TimeIntervalListSPtr _timeIntervalListTooSmall;

	/**
	 * @brief _currentTimeInterval: Identify on which time interval ParamOutput instance is working.
	 */
	TimeIntervalList::iterator _currentTimeInterval;

	/**
	 * sampling mode of _parameter
	 * by default: "" <==> no sampling
	 */
	std::string _samplingMode;

	/**
	 * path where output are created
	 * by default: "."
	 */
	std::string _workPath;

	/**
	 * sampling value of _parameter
	 */
	float _samplingValue;

	/**
	 * gap threshold of _parameter
	 */
	float _gapThreshold;

	ParamDataIndexInfo _paramDataIndexInfo;

	ParameterManager& _parameterManager;

};

float getSamplingInTreeParameter(AMDA::Parameters::ParameterSPtr pParam);

} /* namespace Parameters */
} /* namespace AMDA */
#endif /* PARAMOUTPUT_HH_ */