Commit 35de3ffa9e5bcd725b6802a975b5dd074a9a9262
1 parent
be09879f
Exists in
master
and in
100 other branches
mexvex_els
Showing
13 changed files
with
862 additions
and
11 deletions
Show diff stats
src/ExternLib/els_calculate/CMakeLists.txt
... | ... | @@ -13,11 +13,11 @@ file( |
13 | 13 | ./* |
14 | 14 | ) |
15 | 15 | |
16 | -#ADD_LIBRARY( els_calculate SHARED ${source_files} ) | |
17 | - | |
18 | - #target_link_libraries( | |
19 | - #els_calculate | |
20 | -#) | |
16 | +# ADD_LIBRARY( els_calculate SHARED ${source_files} ) | |
17 | +# | |
18 | +# target_link_libraries( | |
19 | +# els_calculate | |
20 | +# ) | |
21 | 21 | |
22 | 22 | FILE( GLOB_RECURSE PROJ_HEADERS *.hh ) |
23 | 23 | INSTALL(FILES ${PROJ_HEADERS} DESTINATION ${LIBRARY_OUTPUT_PATH} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) | ... | ... |
src/ExternLib/els_calculate/els_calculate.hh
1 | 1 | /** |
2 | - * Magnitude.hh | |
2 | + * els_calculate.hh | |
3 | 3 | * |
4 | 4 | * Created on: 31 oct. 2012 |
5 | 5 | * Author: AKKA IS |
6 | 6 | */ |
7 | 7 | |
8 | -#ifndef MAGNITUDE_HH_ | |
9 | -#define MAGNITUDE_HH_ | |
8 | +#ifndef ELS_CALCULATE_HH_ | |
9 | +#define ELS_CALCULATE_HH_ | |
10 | 10 | |
11 | 11 | #include <vector> |
12 | 12 | |
13 | 13 | /** |
14 | - * @bried Compute the magnitude of el | |
15 | - * @return sqrtf(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]); | |
14 | + * @brief MEX/VEX ELS decoding | |
15 | + * @return | |
16 | 16 | */ |
17 | 17 | typedef std::vector<float> FloatVector; |
18 | 18 | typedef const FloatVector& RCFloatVector; |
... | ... | @@ -26,4 +26,5 @@ FloatVector els_calculate(const std::vector<short>& ELS,const double& TimeCompre |
26 | 26 | return lElsCalculate; |
27 | 27 | } |
28 | 28 | |
29 | -#endif /* MAGNITUDE_HH_ */ | |
29 | + | |
30 | +#endif /* ELS_CALCULATE_HH_ */ | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | + | |
2 | +PROJECT(mexvex_els_calculate) | |
3 | + | |
4 | +set(LIBRARY_OUTPUT_PATH ${PLUGIN_OUTPUT_PATH}/mexvex_els_calculate) | |
5 | + | |
6 | +include_directories( | |
7 | +) | |
8 | + | |
9 | +#Library configuration | |
10 | +file( | |
11 | + GLOB_RECURSE | |
12 | + source_files | |
13 | + ./* | |
14 | +) | |
15 | + | |
16 | +# ADD_LIBRARY( mexvexels_calculate SHARED ${source_files} ) | |
17 | +# | |
18 | +# target_link_libraries( | |
19 | +# mexvex_els_calculate | |
20 | +# ) | |
21 | + | |
22 | +FILE( GLOB_RECURSE PROJ_HEADERS *.hh ) | |
23 | +INSTALL(FILES ${PROJ_HEADERS} DESTINATION ${LIBRARY_OUTPUT_PATH} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) | ... | ... |
src/ExternLib/mexvex_els_calculate/mexvex_els_calculate.hh
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +/** | |
2 | + * mexvex_els_calculate.h | |
3 | + */ | |
4 | + | |
5 | +#ifndef MEXVEX_ELS_CALCULATE_HH_ | |
6 | +#define MEXVEX_ELS_CALCULATE_HH_ | |
7 | + | |
8 | +#include <vector> | |
9 | + | |
10 | +/** | |
11 | + * @brief MEX/VEX ELS decoding | |
12 | + * @return | |
13 | + */ | |
14 | +typedef std::vector<float> FloatVector; | |
15 | +typedef const FloatVector& RCFloatVector; | |
16 | + | |
17 | +FloatVector mexvex_els_calculate(const std::vector<short>& ELS,const short& TimeCompres, const short& EnergyCompres, unsigned int Angle) | |
18 | +{ | |
19 | + FloatVector lElsCalculate; | |
20 | + for (unsigned int iEn = 0; iEn < 128; iEn++) {// 128 Energy Steps | |
21 | + lElsCalculate.push_back(((float)ELS[iEn + Angle *128])/(float)TimeCompres/(float)EnergyCompres); | |
22 | + } | |
23 | + return lElsCalculate; | |
24 | +} | |
25 | + | |
26 | + | |
27 | +#endif /* MEXVEX_ELS_CALCULATE_HH_ */ | ... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +// Standard libraries include files | |
2 | +//----------------------------------------------------------------------------- | |
3 | +#include <iostream> | |
4 | + | |
5 | +// Include oriented definitions | |
6 | +//----------------------------------------------------------------------------- | |
7 | + | |
8 | +// Module Kernel include files | |
9 | +//----------------------------------------------------------------------------- | |
10 | + | |
11 | +#include "ProcessMexVexElsDecode.hh" | |
12 | +#include "ServicesServer.hh" | |
13 | +#include "PluginManager.hh" | |
14 | + | |
15 | +using namespace AMDA::Parameters; | |
16 | + | |
17 | +// Other modules include files | |
18 | +//----------------------------------------------------------------------------- | |
19 | + | |
20 | +/** | |
21 | + Retrieve the Plugin version we're going to expect | |
22 | +*/ | |
23 | +extern "C" const char* getPluginVersion() | |
24 | +{ | |
25 | + return "(Version)"; | |
26 | +} | |
27 | + | |
28 | +/** | |
29 | + Tells us to register our functionality to an engine kernel | |
30 | +*/ | |
31 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
32 | +{ | |
33 | + ProcessFactory factProcessMexElsDecode = boost::factory<ProcessMexElsDecode*>(); | |
34 | + ServicesServer::getInstance()->addProcessFactory("mex_els_decode", factProcessMexElsDecode); | |
35 | + | |
36 | + ProcessFactory factProcessVexElsDecode = boost::factory<ProcessVexElsDecode*>(); | |
37 | + ServicesServer::getInstance()->addProcessFactory("vex_els_decode", factProcessVexElsDecode); | |
38 | + // ServicesServer::getInstance()->addServiceImpl<ProcessMexVexElsDecode::ProcessMexVexElsDecode>("mexvex_els_decode",&ProcessMexVexElsDecode); | |
39 | +} | ... | ... |
... | ... | @@ -0,0 +1,36 @@ |
1 | + | |
2 | +PROJECT(mexvex_els_decode) | |
3 | + | |
4 | +set(LIBRARY_OUTPUT_PATH ${PLUGIN_OUTPUT_PATH}) | |
5 | + | |
6 | +include_directories( | |
7 | + ${CMAKE_HOME_DIRECTORY}/src/InternLib/ | |
8 | + ${CMAKE_HOME_DIRECTORY}/src/Common/ | |
9 | + ${CMAKE_HOME_DIRECTORY}/src/Parameters/ | |
10 | + ${CMAKE_HOME_DIRECTORY}/src/Plugins/ | |
11 | + ${CMAKE_HOME_DIRECTORY}/src/helpers/ | |
12 | + ${CMAKE_HOME_DIRECTORY}/src/TimeTableCatalog/ | |
13 | + ${CMAKE_HOME_DIRECTORY}/src/Info/ | |
14 | + ${LOG4CXX_INCLUDE_DIR} | |
15 | + ${Boost_INCLUDE_DIR} | |
16 | +) | |
17 | + | |
18 | +#Library configuration | |
19 | +file( | |
20 | + GLOB_RECURSE | |
21 | + source_files | |
22 | + ./* | |
23 | +) | |
24 | + | |
25 | +ADD_LIBRARY( mexvex_els_decode SHARED ${source_files} ) | |
26 | + | |
27 | + | |
28 | +target_link_libraries( | |
29 | + mexvex_els_decode | |
30 | + ${LOG4CXX_LIBRARIES} | |
31 | + Parameters | |
32 | + InternLib | |
33 | + TimeTableCatalog | |
34 | + TimeUtil | |
35 | + Info | |
36 | +) | |
0 | 37 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,123 @@ |
1 | +/* | |
2 | + * MexVexElsDecode.hh | |
3 | + * | |
4 | + * Created on: Oct 13, 2016 | |
5 | + * Author: elena / benjamin | |
6 | + */ | |
7 | + | |
8 | +#ifndef MEXVEXELSDECODE_HH_ | |
9 | +#define MEXVEXELSDECODE_HH_ | |
10 | + | |
11 | +#include "Parameter.hh" | |
12 | +#include "ParamData.hh" | |
13 | +#include "DataTypeMath.hh" | |
14 | +#include "Operation.hh" | |
15 | + | |
16 | +namespace AMDA { | |
17 | +namespace Parameters { | |
18 | +namespace MexVexElsDecode { | |
19 | + | |
20 | +/** | |
21 | + * @class MexVexElsDecode | |
22 | + * @brief | |
23 | + * @details This class implement the interface Operation. | |
24 | + */ | |
25 | + | |
26 | +template <typename TParamData> | |
27 | +class MexVexElsDecode : public Operation { | |
28 | + | |
29 | +typedef typename TParamData::ElementType ElemType; | |
30 | + | |
31 | +public: | |
32 | + /** | |
33 | + * @brief Constructor. | |
34 | + * @details Create the ParamData type of the input ParamData. | |
35 | + */ | |
36 | + MexVexElsDecode(Process& pProcess, TParamData& paramInput, std::string energyTable) | |
37 | + : Operation(pProcess), | |
38 | + _paramInput(paramInput), | |
39 | + _paramOutput(new TParamData()), | |
40 | + _energyTable(energyTable){ | |
41 | + _paramDataOutput=_paramOutput; | |
42 | + } | |
43 | + | |
44 | + virtual ~MexVexElsDecode() { | |
45 | + | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) | |
50 | + */ | |
51 | + | |
52 | + void write(ParamDataIndexInfo &pParamDataIndexInfo) { | |
53 | + | |
54 | + ParameterSPtr crtParam = _process.getParameterManager().getParameter(_energyTable); | |
55 | + ParamData* lModeParamInput = crtParam->getParamData(&_process).get(); | |
56 | + for (unsigned int _index = pParamDataIndexInfo._startIndex ; | |
57 | + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; | |
58 | + ++_index) | |
59 | + { | |
60 | + double crtTime = _paramInput.getTime(_index); | |
61 | + ElemType inputElt = _paramInput.get(_index); | |
62 | + | |
63 | + int mode = (dynamic_cast<ParamDataScalaireShort*>(lModeParamInput))->get(_index); | |
64 | + | |
65 | + if (mode == 1) { | |
66 | + for (int i = 0; i < 4; ++i){ | |
67 | + _paramOutput->pushTime(crtTime+i); | |
68 | + pushDataForMode1 (inputElt, i); | |
69 | + } | |
70 | + } | |
71 | + else if (mode == 0 || mode == 2) | |
72 | + { | |
73 | + _paramOutput->pushTime(crtTime); | |
74 | + _paramOutput->getDataList().push_back(inputElt); | |
75 | + } | |
76 | + } | |
77 | + } | |
78 | + | |
79 | + template<typename Type> | |
80 | + void pushDataForMode1(Type& elt, int index) { | |
81 | + _paramOutput->getDataList().push_back(elt); | |
82 | + } | |
83 | + | |
84 | + template<typename Type> | |
85 | + void pushDataForMode1(std::vector<Type>& elt, int index) { | |
86 | + typename std::vector<Type>::const_iterator first = elt.begin() + 31 * index; | |
87 | + typename std::vector<Type>::const_iterator last = elt.begin() + 31 * (index + 1); | |
88 | + std::vector<Type> splitVec(first, last); | |
89 | + _paramOutput->getDataList().push_back(splitVec); | |
90 | + } | |
91 | + | |
92 | + template<typename Type> | |
93 | + void pushDataForMode1(Tab2DData<Type>& elt, int index) { | |
94 | + | |
95 | + Tab2DData<Type> newElt(elt.getDim1Size(),32); | |
96 | + for(int i = 0; i < elt.getDim1Size(); ++i) { | |
97 | + std::vector<Type> eltVector = elt[i].toVector(); | |
98 | + typename std::vector<Type>::const_iterator first = eltVector.begin() + 31 * index; | |
99 | + typename std::vector<Type>::const_iterator last = eltVector.begin() + 31 * (index + 1); | |
100 | + std::vector<Type> splitVec(first, last); | |
101 | + newElt[i] = splitVec; | |
102 | + } | |
103 | + _paramOutput->getDataList().push_back(newElt); | |
104 | + } | |
105 | + | |
106 | +private: | |
107 | + /**< | |
108 | + * @brief It is the channel of data derived | |
109 | + */ | |
110 | + TParamData &_paramInput; | |
111 | + | |
112 | + /**< | |
113 | + * @brief It is the channel of the data derived | |
114 | + */ | |
115 | + TParamData *_paramOutput; | |
116 | + | |
117 | + std::string _energyTable; | |
118 | +}; | |
119 | + | |
120 | +} /* namespace MexVexElsDecode */ | |
121 | +} /* namespace Parameters */ | |
122 | +} /* namespace AMDA */ | |
123 | +#endif /* MEXVEXELSDECODE_HH_ */ | ... | ... |
... | ... | @@ -0,0 +1,96 @@ |
1 | +/* | |
2 | + * MexVexElsDecode.hh | |
3 | + * | |
4 | + * Created on: Oct 13, 2016 | |
5 | + * Author: elena / benjamin | |
6 | + */ | |
7 | + | |
8 | +#ifndef MEXVEXELSDECODE_HH_ | |
9 | +#define MEXVEXELSDECODE_HH_ | |
10 | + | |
11 | +#include "Parameter.hh" | |
12 | +#include "ParamData.hh" | |
13 | +#include "DataTypeMath.hh" | |
14 | +#include "Operation.hh" | |
15 | + | |
16 | +namespace AMDA { | |
17 | +namespace Parameters { | |
18 | +namespace MexVexElsDecode { | |
19 | + | |
20 | +/** | |
21 | + * @class MexVexElsDecode | |
22 | + * @brief | |
23 | + * @details This class implement the interface Operation. | |
24 | + */ | |
25 | + | |
26 | +template<typename DataType> | |
27 | +class MexVexElsDecode : public Operation { | |
28 | + | |
29 | +public: | |
30 | + /** | |
31 | + * @brief Constructor. | |
32 | + * @details Create the ParamData type of the input ParamData. | |
33 | + */ | |
34 | + MexVexElsDecode(Process& pProcess, ParamDataSpec<std::vector<DataType> >& paramInput) | |
35 | + : Operation(pProcess), | |
36 | + _paramInput(paramInput), | |
37 | + _paramOutput(new ParamDataSpec<std::vector<DataType>>()){ | |
38 | + _paramDataOutput=_paramOutput; | |
39 | + } | |
40 | + | |
41 | + virtual ~MexVexElsDecode() { | |
42 | + | |
43 | + } | |
44 | + | |
45 | + /** | |
46 | + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) | |
47 | + */ | |
48 | + void write(ParamDataIndexInfo &pParamDataIndexInfo) { | |
49 | + | |
50 | + ParameterSPtr crtParam = _process.getParameterManager().getParameter("EnergyTable"); | |
51 | + ParamData* lModeParamInput = crtParam->getParamData(&_process).get(); | |
52 | + | |
53 | + for (unsigned int _index = pParamDataIndexInfo._startIndex ; | |
54 | + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; | |
55 | + ++_index) | |
56 | + { | |
57 | + double crtTime = _paramInput.getTime(_index); | |
58 | + std::vector<DataType> inputElt = _paramInput.get(_index); | |
59 | + | |
60 | + int mode = (dynamic_cast<ParamDataScalaireShort*>(lModeParamInput))->get(_index); | |
61 | + | |
62 | + if (mode == 1) { | |
63 | + for (int i = 0; i < 4; ++i){ | |
64 | + typename std::vector<DataType>::const_iterator first = inputElt.begin() + 31 * i; | |
65 | + typename std::vector<DataType>::const_iterator last = inputElt.begin() + 31 * (i + 1); | |
66 | + std::vector<DataType> splitVec(first, last); | |
67 | + _paramOutput->pushTime(crtTime+i); | |
68 | + _paramOutput->getDataList().push_back(splitVec); | |
69 | + } | |
70 | + } | |
71 | + else | |
72 | + { | |
73 | + _paramOutput->pushTime(crtTime); | |
74 | + _paramOutput->getDataList().push_back(inputElt); | |
75 | + } | |
76 | + } | |
77 | + } | |
78 | + | |
79 | + | |
80 | +private: | |
81 | + /**< | |
82 | + * @brief It is the channel of data derived | |
83 | + */ | |
84 | + ParamDataSpec<std::vector<DataType> > &_paramInput; | |
85 | + | |
86 | + /**< | |
87 | + * @brief It is the channel of the data derived | |
88 | + */ | |
89 | + ParamDataSpec<std::vector<DataType>> *_paramOutput; | |
90 | + | |
91 | +}; | |
92 | + | |
93 | +} /* namespace MexVexElsDecode */ | |
94 | +} /* namespace Parameters */ | |
95 | +} /* namespace AMDA */ | |
96 | +#endif /* MEXVEXELSDECODE_HH_ */ | ... | ... |
... | ... | @@ -0,0 +1,165 @@ |
1 | +/* | |
2 | + * MexVexElsDecode.hh | |
3 | + * | |
4 | + * Created on: Oct 13, 2016 | |
5 | + * Author: elena / benjamin | |
6 | + */ | |
7 | + | |
8 | +#ifndef MEXVEXELSDECODE_HH_ | |
9 | +#define MEXVEXELSDECODE_HH_ | |
10 | + | |
11 | +#include "Parameter.hh" | |
12 | +#include "ParamData.hh" | |
13 | +#include "DataTypeMath.hh" | |
14 | +#include "Operation.hh" | |
15 | + | |
16 | +namespace AMDA { | |
17 | +namespace Parameters { | |
18 | +namespace MexVexElsDecode { | |
19 | + | |
20 | +/** | |
21 | + * @class MexVexElsDecode | |
22 | + * @brief | |
23 | + * @details This class implement the interface Operation. | |
24 | + */ | |
25 | + | |
26 | +template <typename TParam> | |
27 | +class MexVexElsDecode : public Operation {}; | |
28 | + | |
29 | +template <> | |
30 | +class MexVexElsDecode<ParamDataTab1DFloat> : public Operation { | |
31 | + | |
32 | +public: | |
33 | + /** | |
34 | + * @brief Constructor. | |
35 | + * @details Create the ParamData type of the input ParamData. | |
36 | + */ | |
37 | + MexVexElsDecode(Process& pProcess, ParamDataTab1DFloat& paramInput) | |
38 | + : Operation(pProcess), | |
39 | + _paramInput(paramInput), | |
40 | + _paramOutput(new ParamDataTab1DFloat()){ | |
41 | + _paramDataOutput=_paramOutput; | |
42 | + } | |
43 | + | |
44 | + virtual ~MexVexElsDecode() { | |
45 | + | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) | |
50 | + */ | |
51 | + | |
52 | + void write(ParamDataIndexInfo &pParamDataIndexInfo) { | |
53 | + | |
54 | + ParameterSPtr crtParam = _process.getParameterManager().getParameter("EnergyTable"); | |
55 | + ParamData* lModeParamInput = crtParam->getParamData(&_process).get(); | |
56 | + | |
57 | + for (unsigned int _index = pParamDataIndexInfo._startIndex ; | |
58 | + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; | |
59 | + ++_index) | |
60 | + { | |
61 | + double crtTime = _paramInput.getTime(_index); | |
62 | + std::vector<float> inputElt = _paramInput.get(_index); | |
63 | + | |
64 | + int mode = (dynamic_cast<ParamDataScalaireShort*>(lModeParamInput))->get(_index); | |
65 | + | |
66 | + if (mode == 1) { | |
67 | + for (int i = 0; i < 4; ++i){ | |
68 | + std::vector<float>::const_iterator first = inputElt.begin() + 31 * i; | |
69 | + std::vector<float>::const_iterator last = inputElt.begin() + 31 * (i + 1); | |
70 | + std::vector<float> splitVec(first, last); | |
71 | + _paramOutput->pushTime(crtTime+i); | |
72 | + _paramOutput->getDataList().push_back(splitVec); | |
73 | + } | |
74 | + } | |
75 | + else | |
76 | + { | |
77 | + _paramOutput->pushTime(crtTime); | |
78 | + _paramOutput->getDataList().push_back(inputElt); | |
79 | + } | |
80 | + } | |
81 | + } | |
82 | + | |
83 | + | |
84 | +private: | |
85 | + /**< | |
86 | + * @brief It is the channel of data derived | |
87 | + */ | |
88 | + ParamDataTab1DFloat &_paramInput; | |
89 | + | |
90 | + /**< | |
91 | + * @brief It is the channel of the data derived | |
92 | + */ | |
93 | + ParamDataTab1DFloat *_paramOutput; | |
94 | + | |
95 | +}; | |
96 | + | |
97 | +template <> | |
98 | +class MexVexElsDecode<ParamDataScalaireShort> : public Operation { | |
99 | + | |
100 | +public: | |
101 | + /** | |
102 | + * @brief Constructor. | |
103 | + * @details Create the ParamData type of the input ParamData. | |
104 | + */ | |
105 | + MexVexElsDecode(Process& pProcess, ParamDataScalaireShort& paramInput) | |
106 | + : Operation(pProcess), | |
107 | + _paramInput(paramInput), | |
108 | + _paramOutput(new ParamDataScalaireShort()){ | |
109 | + _paramDataOutput=_paramOutput; | |
110 | + } | |
111 | + | |
112 | + virtual ~MexVexElsDecode() { | |
113 | + | |
114 | + } | |
115 | + | |
116 | + /** | |
117 | + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) | |
118 | + */ | |
119 | + | |
120 | + void write(ParamDataIndexInfo &pParamDataIndexInfo) { | |
121 | + | |
122 | + ParameterSPtr crtParam = _process.getParameterManager().getParameter("EnergyTable"); | |
123 | + ParamData* lModeParamInput = crtParam->getParamData(&_process).get(); | |
124 | + | |
125 | + | |
126 | + for (unsigned int _index = pParamDataIndexInfo._startIndex ; | |
127 | + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; | |
128 | + ++_index) | |
129 | + { | |
130 | + double crtTime = _paramInput.getTime(_index); | |
131 | + short inputElt = _paramInput.get(_index); | |
132 | + short mode = (dynamic_cast<ParamDataScalaireShort*>(lModeParamInput))->get(_index); | |
133 | + | |
134 | + if (mode == 1) { | |
135 | + for (int i = 0; i < 4; ++i){ | |
136 | + _paramOutput->pushTime(crtTime+i); | |
137 | + _paramOutput->getDataList().push_back(inputElt); | |
138 | + } | |
139 | + } | |
140 | + else | |
141 | + { | |
142 | + _paramOutput->pushTime(crtTime); | |
143 | + _paramOutput->getDataList().push_back(inputElt); | |
144 | + } | |
145 | + } | |
146 | + } | |
147 | + | |
148 | + | |
149 | +private: | |
150 | + /**< | |
151 | + * @brief It is the channel of data derived | |
152 | + */ | |
153 | + ParamDataScalaireShort &_paramInput; | |
154 | + | |
155 | + /**< | |
156 | + * @brief It is the channel of the data derived | |
157 | + */ | |
158 | + ParamDataScalaireShort *_paramOutput; | |
159 | + | |
160 | +}; | |
161 | + | |
162 | +} /* namespace MexVexElsDecode */ | |
163 | +} /* namespace Parameters */ | |
164 | +} /* namespace AMDA */ | |
165 | +#endif /* MEXVEXELSDECODE_HH_ */ | ... | ... |
src/ExternLib/mexvex_els_decode/MexVexElsDecodeCreator.hh
0 → 100644
... | ... | @@ -0,0 +1,179 @@ |
1 | +/* | |
2 | + * MexVexElsDecodeCreator.hh | |
3 | + * | |
4 | + * Created on: Oct 14, 2016 | |
5 | + * Author: elena | |
6 | + */ | |
7 | + | |
8 | +#ifndef MexVexElsDecodeCREATOR_HH_ | |
9 | +#define MexVexElsDecodeCREATOR_HH_ | |
10 | + | |
11 | + | |
12 | +#include "DicError.hh" | |
13 | +#include "AMDA_exception.hh" | |
14 | + | |
15 | +#include "ParamData.hh" | |
16 | +#include "VisitorOfParamData.hh" | |
17 | +#include "MexVexElsDecode.hh" | |
18 | + | |
19 | +namespace AMDA { | |
20 | +namespace Parameters { | |
21 | + | |
22 | +/** | |
23 | + * @class MexVexElsDecodeCreator | |
24 | + * @brief Creator of the Operation MexVexElsDecodeCreator parameterized with ParamData input type. | |
25 | + * @details Implement the interface VisitorOfParamData. | |
26 | + */ | |
27 | +class MexVexElsDecodeCreator : public VisitorOfParamData { | |
28 | +public: | |
29 | + /** | |
30 | + * @brief Constructor. | |
31 | + */ | |
32 | + MexVexElsDecodeCreator(Process& pProcess, ParamData& paramInput, std::string energyTable) | |
33 | + : _process(pProcess), _paramData(paramInput), _operation(NULL), _energyTable(energyTable) { | |
34 | + | |
35 | + _paramData.accept(*this); | |
36 | + } | |
37 | + | |
38 | + /** | |
39 | + * @overload VisitorOfParamData::visit(ParamDataScalaireShort *) | |
40 | + */ | |
41 | + void visit(ParamDataScalaireShort *) | |
42 | + {_operation = new MexVexElsDecode::MexVexElsDecode<ParamDataScalaireShort>( _process, dynamic_cast<ParamDataScalaireShort &>(_paramData), _energyTable);} | |
43 | + | |
44 | + /** | |
45 | + * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *) | |
46 | + */ | |
47 | + void visit(ParamDataScalaireFloat *){ | |
48 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
49 | + } | |
50 | + //void visit(ParamDataScalaireFloat *) {_operation = new MexVexElsDecode::MexVexElsDecode<float>( _process, dynamic_cast<ParamDataScalaireFloat &>(_paramData));} | |
51 | + | |
52 | + /** | |
53 | + * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *) | |
54 | + */ | |
55 | + void visit(ParamDataScalaireDouble *){ | |
56 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
57 | + } | |
58 | + //void visit(ParamDataScalaireDouble *) {_operation = new MexVexElsDecode::MexVexElsDecode<double>( _process,dynamic_cast<ParamDataScalaireDouble &>(_paramData));} | |
59 | + | |
60 | + /** | |
61 | + * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *) | |
62 | + */ | |
63 | + void visit(ParamDataScalaireLongDouble *){ | |
64 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
65 | + } | |
66 | + //void visit(ParamDataScalaireLongDouble *) {_operation = new MexVexElsDecode::MexVexElsDecode<ParamDataScalaireLongDouble>( _process, dynamic_cast<ParamDataScalaireLongDouble &>(_paramData));} | |
67 | + | |
68 | + /** | |
69 | + * @overload VisitorOfParamData::visit(ParamDataScalaireInt *) | |
70 | + */ | |
71 | + void visit(ParamDataScalaireInt *){ | |
72 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
73 | + } | |
74 | + //void visit(ParamDataScalaireInt *) {_operation = new MexVexElsDecode::MexVexElsDecode<int>( _process, dynamic_cast<ParamDataScalaireInt &>(_paramData));} | |
75 | + | |
76 | + /** | |
77 | + * @overload VisitorOfParamData::visit(ParamDataLogicalData *) | |
78 | + */ | |
79 | + void visit(ParamDataLogicalData *) { | |
80 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
81 | + } | |
82 | + | |
83 | + /** | |
84 | + * @overload VisitorOfParamData::visit(ParamDataTab1DShort *) | |
85 | + */ | |
86 | + void visit(ParamDataTab1DShort *){_operation = new MexVexElsDecode::MexVexElsDecode<ParamDataTab1DShort>( _process, dynamic_cast<ParamDataTab1DShort &>(_paramData), _energyTable);} | |
87 | + | |
88 | + /** | |
89 | + * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *) | |
90 | + */ | |
91 | + void visit(ParamDataTab1DFloat *) {_operation = new MexVexElsDecode::MexVexElsDecode<ParamDataTab1DFloat>( _process, dynamic_cast<ParamDataTab1DFloat &>(_paramData), _energyTable);} | |
92 | + | |
93 | + /** | |
94 | + * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *) | |
95 | + */ | |
96 | + void visit(ParamDataTab1DDouble *){ | |
97 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
98 | + } | |
99 | +// void visit(ParamDataTab1DDouble *) {_operation = new MexVexElsDecode::MexVexElsDecode<double>( _process, dynamic_cast<ParamDataTab1DDouble &>(_paramData));} | |
100 | + | |
101 | + /** | |
102 | + * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *) | |
103 | + */ | |
104 | + void visit(ParamDataTab1DLongDouble *){ | |
105 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
106 | + } | |
107 | +// void visit(ParamDataTab1DLongDouble *) {_operation = new MexVexElsDecode::MexVexElsDecode<ParamDataTab1DLongDouble>( _process, dynamic_cast<ParamDataTab1DLongDouble &>(_paramData));} | |
108 | + | |
109 | + /** | |
110 | + * @overload VisitorOfParamData::visit(ParamDataTab1DInt *) | |
111 | + */ | |
112 | + void visit(ParamDataTab1DInt *){ | |
113 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
114 | + } | |
115 | + // void visit(ParamDataTab1DInt *) {_operation = new MexVexElsDecode::MexVexElsDecode<ParamDataTab1DInt>( _process, dynamic_cast<ParamDataTab1DInt &>(_paramData));} | |
116 | + | |
117 | + /** | |
118 | + * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *) | |
119 | + */ | |
120 | + void visit(ParamDataTab1DLogicalData *) { | |
121 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("MexVexElsDecodeCreator operation not supported")); | |
122 | + } | |
123 | + | |
124 | + /** | |
125 | + * @overload VisitorOfParamData::visit(ParamDataTab2DShort *) | |
126 | + */ | |
127 | + void visit(ParamDataTab2DShort *){_operation = new MexVexElsDecode::MexVexElsDecode<ParamDataTab2DShort>( _process, dynamic_cast<ParamDataTab2DShort &>(_paramData), _energyTable);} | |
128 | + | |
129 | + /** | |
130 | + * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *) | |
131 | + */ | |
132 | + void visit(ParamDataTab2DFloat *) { | |
133 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DFloat data not supported")); | |
134 | + } | |
135 | + | |
136 | + /** | |
137 | + * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *) | |
138 | + */ | |
139 | + void visit(ParamDataTab2DDouble *) { | |
140 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DDouble data not supported")); | |
141 | + } | |
142 | + | |
143 | + /** | |
144 | + * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *) | |
145 | + */ | |
146 | + void visit(ParamDataTab2DLongDouble *) { | |
147 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DLongDouble data not supported")); | |
148 | + } | |
149 | + | |
150 | + /** | |
151 | + * @overload VisitorOfParamData::visit(ParamDataTab2DInt *) | |
152 | + */ | |
153 | + void visit(ParamDataTab2DInt *) { | |
154 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DInt data not supported")); | |
155 | + } | |
156 | + | |
157 | + /** | |
158 | + * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *) | |
159 | + */ | |
160 | + void visit(ParamDataTab2DLogicalData *) { | |
161 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DLogicalData data not supported")); | |
162 | + } | |
163 | + | |
164 | + /** | |
165 | + * @brief get the MexVexElsDecode parameterized operation. | |
166 | + */ | |
167 | + Operation * getOperation() const { return _operation; } | |
168 | + | |
169 | +private: | |
170 | + Process &_process; | |
171 | + ParamData &_paramData; | |
172 | + Operation *_operation; | |
173 | + std::string _energyTable; | |
174 | + | |
175 | +}; | |
176 | + | |
177 | +} /* namespace Parameters */ | |
178 | +} /* namespace AMDA */ | |
179 | +#endif /* MexVexElsDecodeCREATOR_HH_ */ | ... | ... |
src/ExternLib/mexvex_els_decode/ProcessMexVexElsDecode.cc
0 → 100644
... | ... | @@ -0,0 +1,77 @@ |
1 | +/* | |
2 | + * ProcessMexVexElsDecode.cc | |
3 | + * | |
4 | + * Created on: Oct 14, 2016 | |
5 | + * Author: elena | |
6 | + */ | |
7 | +#include <stdlib.h> | |
8 | +#include <string> | |
9 | + | |
10 | +#include <boost/lexical_cast.hpp> | |
11 | + | |
12 | +#include "DicError.hh" | |
13 | +#include "AMDA_exception.hh" | |
14 | + | |
15 | +#include "Operation.hh" | |
16 | +#include "ParameterManager.hh" | |
17 | +#include "ProcessMexVexElsDecode.hh" | |
18 | +#include "MexVexElsDecodeCreator.hh" | |
19 | +//#include "MexVexElsDecode.hh" | |
20 | +#include "ParamMgr.hh" | |
21 | +#include "ParameterCreatorFromExpression.hh" | |
22 | + | |
23 | +using namespace std; | |
24 | +using namespace boost; | |
25 | +using namespace log4cxx; | |
26 | + | |
27 | +namespace AMDA { | |
28 | +namespace Parameters { | |
29 | + | |
30 | + ProcessMexVexElsDecode::ProcessMexVexElsDecode(Parameter ¶meter, std::string energyTable) : MultiParamProcess_CRTP(parameter), _energyTable(energyTable) { | |
31 | + } | |
32 | + | |
33 | + ProcessMexVexElsDecode::ProcessMexVexElsDecode(const ProcessMexVexElsDecode& pProcess, Parameter ¶meter) | |
34 | + : MultiParamProcess_CRTP(pProcess,parameter) { | |
35 | + } | |
36 | + | |
37 | + ProcessMexVexElsDecode::~ProcessMexVexElsDecode() { | |
38 | + } | |
39 | + | |
40 | + void ProcessMexVexElsDecode::establishConnection() { | |
41 | + ParameterCreatorFromExpression creator(_parameter.getParameterManager()); | |
42 | + ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression); | |
43 | + _paramNameList[lParameter->getId()].first = lParameter; | |
44 | + | |
45 | + if (_parameter.getId() != _energyTable) { | |
46 | + ParameterSPtr energyTableParam = _parameter.getParameterManager().getParameter(_energyTable); | |
47 | + _paramNameList[energyTableParam->getId()].first = energyTableParam; | |
48 | + } | |
49 | + | |
50 | + MultiParamProcess::establishConnection(); | |
51 | + } | |
52 | + | |
53 | + TimeStamp ProcessMexVexElsDecode::init() { | |
54 | + | |
55 | + TimeStamp timeStamp = MultiParamProcess::init(); | |
56 | + | |
57 | + ParamData* lmainParamInput = _paramNameList.begin()->second.first->getParamData(this).get(); | |
58 | + | |
59 | + MexVexElsDecodeCreator lMexVexElsDecodeCreator(*this, *lmainParamInput, _energyTable); | |
60 | + _operation = lMexVexElsDecodeCreator.getOperation(); | |
61 | + //_operation = new MexVexElsDecode::MexVexElsDecode<float>(*this, *lmainParamInput); | |
62 | + _paramData = ParamDataSPtr(_operation->getParamOutput()); | |
63 | + _paramData->setMinSampling(lmainParamInput->getMinSampling()); | |
64 | + | |
65 | + return timeStamp; | |
66 | +} | |
67 | + | |
68 | +ProcessMexElsDecode::ProcessMexElsDecode(Parameter ¶meter) : ProcessMexVexElsDecode(parameter, "mex_els_energytable") { | |
69 | + | |
70 | +} | |
71 | + | |
72 | +ProcessVexElsDecode::ProcessVexElsDecode(Parameter ¶meter) : ProcessMexVexElsDecode(parameter, "vex_els_energytable") { | |
73 | + | |
74 | +} | |
75 | + | |
76 | +} /* namespace Parameters */ | |
77 | +} /* namespace AMDA */ | ... | ... |
src/ExternLib/mexvex_els_decode/ProcessMexVexElsDecode.hh
0 → 100644
... | ... | @@ -0,0 +1,72 @@ |
1 | +/* | |
2 | + * ProcessMexVexElsDecode.hh | |
3 | + * | |
4 | + * Created on: Oct 14, 2016 | |
5 | + * Author: elena | |
6 | + */ | |
7 | + | |
8 | +#ifndef PROCESSMEXVEXELSDECODE_HH_ | |
9 | +#define PROCESSMEXVEXELSDECODE_HH_ | |
10 | + | |
11 | +#include "MultiParamProcess.hh" | |
12 | +#include "ParamInfo.hh" | |
13 | + | |
14 | +namespace AMDA { | |
15 | +namespace Parameters { | |
16 | + | |
17 | +/** | |
18 | + * @class ProcessSumIntoTableRange | |
19 | + * @brief Process to compute the sum of parameter data into table range. | |
20 | + */ | |
21 | +class ProcessMexVexElsDecode : public AMDA::Parameters::MultiParamProcess_CRTP<ProcessMexVexElsDecode> { | |
22 | + | |
23 | +public: | |
24 | + /** | |
25 | + * @brief Constructor. | |
26 | + */ | |
27 | + ProcessMexVexElsDecode(Parameter ¶meter, std::string energyTable); | |
28 | + /** | |
29 | + * @brief Copy Constructor. | |
30 | + */ | |
31 | + ProcessMexVexElsDecode(const ProcessMexVexElsDecode& pProcess, Parameter &pParameter) ; | |
32 | + /** | |
33 | + * @brief Destructor. | |
34 | + */ | |
35 | + ~ProcessMexVexElsDecode(); | |
36 | + | |
37 | + // Overload Process methods | |
38 | + | |
39 | + /** | |
40 | + * @overload Process::establishConnection() | |
41 | + */ | |
42 | + void establishConnection(); | |
43 | + | |
44 | + /** | |
45 | + * @overload Process::init() | |
46 | + */ | |
47 | + TimeStamp init(); | |
48 | + | |
49 | +private: | |
50 | + std::string _energyTable; | |
51 | + | |
52 | +}; | |
53 | + | |
54 | +class ProcessMexElsDecode : public ProcessMexVexElsDecode { | |
55 | +public: | |
56 | + /** | |
57 | + * @brief Constructor. | |
58 | + */ | |
59 | + ProcessMexElsDecode(Parameter ¶meter); | |
60 | +}; | |
61 | + | |
62 | +class ProcessVexElsDecode : public ProcessMexVexElsDecode { | |
63 | +public: | |
64 | + /** | |
65 | + * @brief Constructor. | |
66 | + */ | |
67 | + ProcessVexElsDecode(Parameter ¶meter); | |
68 | +}; | |
69 | + | |
70 | +} /* namespace Parameters */ | |
71 | +} /* namespace AMDA */ | |
72 | +#endif /* PROCESSMEXVEXELSDECODE_HH_ */ | ... | ... |
src/Parameters/VisitorOfParamData.hh
... | ... | @@ -72,6 +72,18 @@ public: |
72 | 72 | std::vector<Type> res(_data, _data + _size); |
73 | 73 | return res; |
74 | 74 | } |
75 | + | |
76 | + inline TabRow& operator = (std::vector<Type>& vector) | |
77 | + { | |
78 | + if (vector.size() != _size) | |
79 | + throw; | |
80 | + int crtIndex = 0; | |
81 | + for (typename std::vector<Type>::const_iterator it = vector.begin(); it != vector.end(); ++it) { | |
82 | + _data[crtIndex] = (*it); | |
83 | + ++crtIndex; | |
84 | + } | |
85 | + return (*this); | |
86 | + } | |
75 | 87 | |
76 | 88 | private: |
77 | 89 | int _size; |
... | ... | @@ -83,6 +95,7 @@ template <typename Type> |
83 | 95 | class Tab2DData |
84 | 96 | { |
85 | 97 | public : |
98 | + | |
86 | 99 | Tab2DData(void) : _dim1Size(0), _dim2Size(0), _rows(NULL) |
87 | 100 | { |
88 | 101 | } | ... | ... |