MultiParamProcess.hh
2.34 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
/*
* MultiParamProcess.hh
*
* Created on: Jan 4, 2013
* Author: f.casimir
*/
#ifndef MULTIPARAMPROCESS_HH_
#define MULTIPARAMPROCESS_HH_
#include <string>
#include <map>
#include <boost/shared_ptr.hpp>
#include <log4cxx/logger.h>
#include "Process.hh"
namespace AMDA {
namespace Parameters {
class TimeStamp;
/**
* abstract class to allow a process on multi parameter
*/
class MultiParamProcess: public Process {
public:
typedef std::map<std::string,std::pair<ParameterSPtr,ParamDataIndexInfo>> ParameterList;
MultiParamProcess(Parameter ¶meter);
MultiParamProcess(const MultiParamProcess &pProcess, Parameter ¶meter);
virtual ~MultiParamProcess();
ParameterList& getParameterList() { return _paramNameList; }
/**
* @brief Connection to Parameter server.
* @overload DataClient::establishConnection()
*/
void establishConnection();
/**
* @overload DataClient::init()
*/
virtual TimeStamp init();
/**
* Write data in dataParam.
*/
virtual unsigned int write();
/*
* @brief @ to know the resampling strategy to use. If it's true, the nearest value will be use
*/
virtual bool useNearestValue();
/*
* @overload DataWriter::getMinSampling
*/
virtual double getMinSampling();
/**
* @overload DataWriter::updateInfo - update parameter info in relation to the process
*/
virtual void updateInfo(Parameter & parameter);
protected:
/**
* @brief list of parameter name
*/
ParameterList _paramNameList;
/**
* @brief merge of paramDataIndexInfo of all parameter
*/
ParamDataIndexInfo _paramDataIndexInfo;
/**
* @brief minSampling of all paramInput
*/
double _minSampling;
};
/**
* @brief This CRTP class implements clone() for Derived
*/
template <typename Derived>
class MultiParamProcess_CRTP : public MultiParamProcess {
public:
/**
* Default constructor
*/
MultiParamProcess_CRTP(Parameter ¶meter) : MultiParamProcess(parameter) {}
/**
* constructeur by copy
*/
MultiParamProcess_CRTP(const MultiParamProcess &pProcess, Parameter ¶meter) :
MultiParamProcess(pProcess, parameter) {}
/**
* clone an implementation of MultiParamProcess
*/
virtual DataWriter *clone(Parameter ¶meter) const {
return new Derived(static_cast<Derived const&>(*this),parameter);
}
};
} /* namespace Parameters */
} /* namespace AMDA */
#endif /* MULTIPARAMPROCESS_HH_ */