TimeShifted.hh
1.53 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
/*
* TimeShifted.hh
*
* Created on: Dec 3, 2012
* Author: f.casimir
*/
#ifndef TIMESHIFTED_HH_
#define TIMESHIFTED_HH_
#include "Parameter.hh"
#include "ParamData.hh"
#include "Operation.hh"
namespace AMDA {
namespace Parameters {
/**
* @class TimeShifted
* @brief It is responsible to shift data of any ParamData type.
* @details This class implement the interface Operation.
*/
template<class TParamData>
class TimeShifted : public Operation {
public:
/**
* @brief Constructor.
* @details Create the ParamData type of the input ParamData.
*/
TimeShifted(Process& pProcess, TParamData& paramInput, double second)
: Operation(pProcess), _paramInput(paramInput), _paramOutput(new TParamData()), _second(second) {
_paramDataOutput=_paramOutput;
}
/**
* @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo)
*/
void write(ParamDataIndexInfo &pParamDataIndexInfo) {
unsigned int index = pParamDataIndexInfo._startIndex;
for (; index< pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; index++) {
_paramOutput->pushTime(_paramInput.getTime(index)+_second);
_paramOutput->getDataList().push_back(_paramInput.getDataList()[index]);
}
}
private:
/**
* @brief It is the channel of data to shift.
*/
TParamData &_paramInput;
/**
* @brief It is the channel of the data shifted.
*/
TParamData *_paramOutput;
/**
* @brief laps time to shift data.
*/
double _second;
};
} /* namespace Parameters */
} /* namespace AMDA */
#endif /* TIMESHIFTED_HH_ */