/* * 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 class MexVexElsDecode : public Operation { public: /** * @brief Constructor. * @details Create the ParamData type of the input ParamData. */ MexVexElsDecode(Process& pProcess, ParamDataSpec >& paramInput) : Operation(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataSpec>()){ _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 inputElt = _paramInput.get(_index); int mode = (dynamic_cast(lModeParamInput))->get(_index); if (mode == 1) { for (int i = 0; i < 4; ++i){ typename std::vector::const_iterator first = inputElt.begin() + 31 * i; typename std::vector::const_iterator last = inputElt.begin() + 31 * (i + 1); std::vector 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 > &_paramInput; /**< * @brief It is the channel of the data derived */ ParamDataSpec> *_paramOutput; }; } /* namespace MexVexElsDecode */ } /* namespace Parameters */ } /* namespace AMDA */ #endif /* MEXVEXELSDECODE_HH_ */