MexVexElsDecode.hh.ben
2.37 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
/*
* MexVexElsDecode.hh
*
* Created on: Oct 13, 2016
* Author: elena / benjamin
*/
#ifndef MEXVEXELSDECODE_HH_
#define MEXVEXELSDECODE_HH_
#include "Parameter.hh"
#include "ParamData.hh"
#include "DataTypeMath.hh"
#include "Operation.hh"
namespace AMDA {
namespace Parameters {
namespace MexVexElsDecode {
/**
* @class MexVexElsDecode
* @brief
* @details This class implement the interface Operation.
*/
template<typename DataType>
class MexVexElsDecode : public Operation {
public:
/**
* @brief Constructor.
* @details Create the ParamData type of the input ParamData.
*/
MexVexElsDecode(Process& pProcess, ParamDataSpec<std::vector<DataType> >& paramInput)
: Operation(pProcess),
_paramInput(paramInput),
_paramOutput(new ParamDataSpec<std::vector<DataType>>()){
_paramDataOutput=_paramOutput;
}
virtual ~MexVexElsDecode() {
}
/**
* @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo)
*/
void write(ParamDataIndexInfo &pParamDataIndexInfo) {
ParameterSPtr crtParam = _process.getParameterManager().getParameter("EnergyTable");
ParamData* lModeParamInput = crtParam->getParamData(&_process).get();
for (unsigned int _index = pParamDataIndexInfo._startIndex ;
_index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
++_index)
{
double crtTime = _paramInput.getTime(_index);
std::vector<DataType> inputElt = _paramInput.get(_index);
int mode = (dynamic_cast<ParamDataScalaireShort*>(lModeParamInput))->get(_index);
if (mode == 1) {
for (int i = 0; i < 4; ++i){
typename std::vector<DataType>::const_iterator first = inputElt.begin() + 31 * i;
typename std::vector<DataType>::const_iterator last = inputElt.begin() + 31 * (i + 1);
std::vector<DataType> splitVec(first, last);
_paramOutput->pushTime(crtTime+i);
_paramOutput->getDataList().push_back(splitVec);
}
}
else
{
_paramOutput->pushTime(crtTime);
_paramOutput->getDataList().push_back(inputElt);
}
}
}
private:
/**<
* @brief It is the channel of data derived
*/
ParamDataSpec<std::vector<DataType> > &_paramInput;
/**<
* @brief It is the channel of the data derived
*/
ParamDataSpec<std::vector<DataType>> *_paramOutput;
};
} /* namespace MexVexElsDecode */
} /* namespace Parameters */
} /* namespace AMDA */
#endif /* MEXVEXELSDECODE_HH_ */