Merged
Merge Request #7
·
created by
Fer 6598
From
FER_6598
into
develop
Showing
11 changed files
Show diff stats
CMakeLists.txt
... | ... | @@ -187,6 +187,7 @@ add_subdirectory(src/ExternLib/vector_) |
187 | 187 | add_subdirectory(src/ExternLib/DataFiltering) |
188 | 188 | add_subdirectory(src/ExternLib/Spectrum) |
189 | 189 | add_subdirectory(src/ExternLib/InternalField) |
190 | +add_subdirectory(src/ExternLib/Timestamp) | |
190 | 191 | |
191 | 192 | IF ( CSLIM_FOUND ) |
192 | 193 | add_subdirectory(test/DD_Client/CSlimFixtures) |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | +#include "ServicesServer.hh" | |
7 | +#include "PluginManager.hh" | |
8 | + | |
9 | +#include "Timestamp_Process.hh" | |
10 | +#include "Timestamp_FromProcess.hh" | |
11 | + | |
12 | +using namespace AMDA::Parameters; | |
13 | + | |
14 | +/** | |
15 | + Retrieve the Plugin version we're going to expect | |
16 | + */ | |
17 | +extern "C" const char *getPluginVersion() | |
18 | +{ | |
19 | + return "(Version)"; | |
20 | +} | |
21 | + | |
22 | +/** | |
23 | + Tells us to register our functionality to an engine kernel | |
24 | + */ | |
25 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager &pm) | |
26 | +{ | |
27 | + ProcessFactory factTimestamp_Process = boost::factory<Timestamp_Process *>(); | |
28 | + ServicesServer::getInstance()->addProcessFactory("timestamp", factTimestamp_Process); | |
29 | + ServicesServer::getInstance()->linkProcessWithPlugin("timestamp", pm.getCurrentPluginPath()); | |
30 | + | |
31 | + ProcessFactory factTimestamp_FromProcess = boost::factory<Timestamp_FromProcess *>(); | |
32 | + ServicesServer::getInstance()->addProcessFactory("timestampfrom", factTimestamp_FromProcess); | |
33 | + ServicesServer::getInstance()->linkProcessWithPlugin("timestampfrom", pm.getCurrentPluginPath()); | |
34 | +} | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | + | |
2 | +PROJECT(timestamp_op) | |
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( timestampProcess SHARED ${source_files} ) | |
26 | + | |
27 | + | |
28 | +target_link_libraries( | |
29 | + timestampProcess | |
30 | + ${LOG4CXX_LIBRARIES} | |
31 | + Parameters | |
32 | + InternLib | |
33 | + TimeTableCatalog | |
34 | + TimeUtil | |
35 | + Info | |
36 | +) | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,203 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +/* | |
8 | + * File: TimestampCreator.hh | |
9 | + * Author: Furkan - AKKA I&S | |
10 | + * | |
11 | + * Created on September 26, 2022, 4:14 PM | |
12 | + */ | |
13 | + | |
14 | +#ifndef TIMESTAMPCREATOR_HH | |
15 | +#define TIMESTAMPCREATOR_HH | |
16 | + | |
17 | +#include "ParamData.hh" | |
18 | +#include "VisitorOfParamData.hh" | |
19 | +#include "Timestamp_op.hh" | |
20 | + | |
21 | +namespace AMDA | |
22 | +{ | |
23 | + namespace Parameters | |
24 | + { | |
25 | + class TimestampCreator : public VisitorOfParamData | |
26 | + { | |
27 | + public: | |
28 | + TimestampCreator(Process &pProcess, ParamData ¶mInput, bool isTimeFrom, double timeFrom = 0.0) | |
29 | + : _process(pProcess), _paramData(paramInput), _isTimeFrom(isTimeFrom), _timeFrom(timeFrom), _operation(NULL) | |
30 | + { | |
31 | + _paramData.accept(*this); | |
32 | + } | |
33 | + | |
34 | + /** | |
35 | + * @overload VisitorOfParamData::visit(ParamDataScalaireShort *) | |
36 | + */ | |
37 | + void visit(ParamDataScalaireShort *) | |
38 | + { | |
39 | + create<ParamDataScalaireShort>(); | |
40 | + } | |
41 | + | |
42 | + /** | |
43 | + * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *) | |
44 | + */ | |
45 | + void visit(ParamDataScalaireFloat *) | |
46 | + { | |
47 | + create<ParamDataScalaireFloat>(); | |
48 | + } | |
49 | + | |
50 | + /** | |
51 | + * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *) | |
52 | + */ | |
53 | + void visit(ParamDataScalaireDouble *) | |
54 | + { | |
55 | + create<ParamDataScalaireDouble>(); | |
56 | + } | |
57 | + | |
58 | + /** | |
59 | + * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *) | |
60 | + */ | |
61 | + void visit(ParamDataScalaireLongDouble *) | |
62 | + { | |
63 | + create<ParamDataScalaireLongDouble>(); | |
64 | + } | |
65 | + | |
66 | + /** | |
67 | + * @overload VisitorOfParamData::visit(ParamDataScalaireInt *) | |
68 | + */ | |
69 | + void visit(ParamDataScalaireInt *) | |
70 | + { | |
71 | + create<ParamDataScalaireInt>(); | |
72 | + } | |
73 | + | |
74 | + /** | |
75 | + * @overload VisitorOfParamData::visit(ParamDataLogicalData *) | |
76 | + */ | |
77 | + void visit(ParamDataLogicalData *) | |
78 | + { | |
79 | + create<ParamDataLogicalData>(); | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * @overload VisitorOfParamData::visit(ParamDataTab1DShort *) | |
84 | + */ | |
85 | + void visit(ParamDataTab1DShort *) | |
86 | + { | |
87 | + create<ParamDataTab1DShort>(); | |
88 | + } | |
89 | + | |
90 | + /** | |
91 | + * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *) | |
92 | + */ | |
93 | + void visit(ParamDataTab1DFloat *) | |
94 | + { | |
95 | + create<ParamDataTab1DFloat>(); | |
96 | + } | |
97 | + | |
98 | + /** | |
99 | + * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *) | |
100 | + */ | |
101 | + void visit(ParamDataTab1DDouble *) | |
102 | + { | |
103 | + create<ParamDataTab1DDouble>(); | |
104 | + } | |
105 | + | |
106 | + /** | |
107 | + * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *) | |
108 | + */ | |
109 | + void visit(ParamDataTab1DLongDouble *) | |
110 | + { | |
111 | + create<ParamDataTab1DLongDouble>(); | |
112 | + } | |
113 | + | |
114 | + /** | |
115 | + * @overload VisitorOfParamData::visit(ParamDataTab1DInt *) | |
116 | + */ | |
117 | + void visit(ParamDataTab1DInt *) | |
118 | + { | |
119 | + create<ParamDataTab1DInt>(); | |
120 | + } | |
121 | + | |
122 | + /** | |
123 | + * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *) | |
124 | + */ | |
125 | + void visit(ParamDataTab1DLogicalData *) | |
126 | + { | |
127 | + create<ParamDataTab1DLogicalData>(); | |
128 | + } | |
129 | + | |
130 | + /** | |
131 | + * @overload VisitorOfParamData::visit(ParamDataTab2DShort *) | |
132 | + */ | |
133 | + void visit(ParamDataTab2DShort *) | |
134 | + { | |
135 | + create<ParamDataTab2DShort>(); | |
136 | + } | |
137 | + | |
138 | + /** | |
139 | + * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *) | |
140 | + */ | |
141 | + void visit(ParamDataTab2DFloat *) | |
142 | + { | |
143 | + create<ParamDataTab2DFloat>(); | |
144 | + } | |
145 | + | |
146 | + /** | |
147 | + * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *) | |
148 | + */ | |
149 | + void visit(ParamDataTab2DDouble *) | |
150 | + { | |
151 | + create<ParamDataTab2DDouble>(); | |
152 | + } | |
153 | + | |
154 | + /** | |
155 | + * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *) | |
156 | + */ | |
157 | + void visit(ParamDataTab2DLongDouble *) | |
158 | + { | |
159 | + create<ParamDataTab2DLongDouble>(); | |
160 | + } | |
161 | + | |
162 | + /** | |
163 | + * @overload VisitorOfParamData::visit(ParamDataTab2DInt *) | |
164 | + */ | |
165 | + void visit(ParamDataTab2DInt *) | |
166 | + { | |
167 | + create<ParamDataTab2DInt>(); | |
168 | + } | |
169 | + | |
170 | + /** | |
171 | + * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *) | |
172 | + */ | |
173 | + void visit(ParamDataTab2DLogicalData *) | |
174 | + { | |
175 | + create<ParamDataTab2DLogicalData>(); | |
176 | + } | |
177 | + | |
178 | + /** | |
179 | + * @brief get the TimeShifted parameterized operation. | |
180 | + */ | |
181 | + Operation *getOperation() const | |
182 | + { | |
183 | + return _operation; | |
184 | + } | |
185 | + | |
186 | + template <typename ParamDataType> | |
187 | + void create() | |
188 | + { | |
189 | + _operation = new Timestamp_op<ParamDataType>(_process, dynamic_cast<ParamDataType &>(_paramData), _isTimeFrom, _timeFrom); | |
190 | + | |
191 | + } | |
192 | + | |
193 | + private: | |
194 | + Process &_process; | |
195 | + ParamData &_paramData; | |
196 | + bool _isTimeFrom; | |
197 | + double _timeFrom; | |
198 | + Operation *_operation; | |
199 | + }; | |
200 | + } | |
201 | +} | |
202 | + | |
203 | +#endif /* TIMESTAMPCREATOR_HH */ | |
... | ... |
... | ... | @@ -0,0 +1,63 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +/* | |
8 | + * File: Timestamp_FromProcess.cc | |
9 | + * Author: Furkan - AKKA I&S | |
10 | + * | |
11 | + * Created on Septemner 19, 2022, 4:14 PM | |
12 | + */ | |
13 | +#include <stdlib.h> | |
14 | +#include <string> | |
15 | + | |
16 | +#include "Operation.hh" | |
17 | +#include "ParameterManager.hh" | |
18 | +#include "ParameterCreatorFromExpression.hh" | |
19 | +#include "Timestamp_FromProcess.hh" | |
20 | +#include "TimestampCreator.hh" | |
21 | + | |
22 | +namespace AMDA | |
23 | +{ | |
24 | + namespace Parameters | |
25 | + { | |
26 | + | |
27 | + Timestamp_FromProcess::Timestamp_FromProcess(Parameter ¶meter) : SingleParamProcess_CRTP(parameter) | |
28 | + { | |
29 | + } | |
30 | + | |
31 | + Timestamp_FromProcess::Timestamp_FromProcess(const Timestamp_FromProcess &pProcess, Parameter ¶meter) : SingleParamProcess_CRTP(pProcess, parameter) | |
32 | + { | |
33 | + } | |
34 | + | |
35 | + TimeStamp Timestamp_FromProcess::init() | |
36 | + { | |
37 | + | |
38 | + TimeStamp timeStamp = _parameterInput->init(this, _timeIntervalList); | |
39 | + Parameter::InfoList lInfoList = _parameterInput->getInfoList(); | |
40 | + _parameter.getInfoList().insert(lInfoList.begin(), lInfoList.end()); | |
41 | + _paramInput = _parameterInput->getParamData(this).get(); | |
42 | + | |
43 | + /* Get the value of the time from witch we need to start */ | |
44 | + if (_attributList.size() == 1) | |
45 | + { | |
46 | + _timeFrom = std::stod(_attributList[0]) ; | |
47 | + } | |
48 | + | |
49 | + | |
50 | + /* Creation of the operation */ | |
51 | + | |
52 | + TimestampCreator lCreator(*this, *_paramInput, true, _timeFrom); | |
53 | + _operation = lCreator.getOperation(); | |
54 | + _paramData = ParamDataSPtr(_operation->getParamOutput()); | |
55 | + _paramData->setMinSampling(_paramInput->getMinSampling()); | |
56 | + return timeStamp; | |
57 | + } | |
58 | + | |
59 | + Timestamp_FromProcess::~Timestamp_FromProcess() | |
60 | + { | |
61 | + } | |
62 | + } | |
63 | +} | |
0 | 64 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,42 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +/* | |
8 | + * File: TimeStamp_FromProcess.hh | |
9 | + * Author: Furkan - AKKA I&S | |
10 | + * | |
11 | + * Created on September 19, 2022, 4:14 PM | |
12 | + */ | |
13 | + | |
14 | +#ifndef TIMESTAMP_FROMPROCESS_HH | |
15 | +#define TIMESTAMP_FROMPROCESS_HH | |
16 | + | |
17 | +#include "SingleParamProcess.hh" | |
18 | + | |
19 | +namespace AMDA | |
20 | +{ | |
21 | + namespace Parameters | |
22 | + { | |
23 | + | |
24 | + class Timestamp_FromProcess : public AMDA::Parameters::SingleParamProcess_CRTP<Timestamp_FromProcess> | |
25 | + { | |
26 | + public: | |
27 | + Timestamp_FromProcess(Parameter ¶meter); | |
28 | + Timestamp_FromProcess(const Timestamp_FromProcess &pProcess, Parameter &pParameter); | |
29 | + virtual ~Timestamp_FromProcess(); | |
30 | + | |
31 | + /** | |
32 | + * @overload DataWriter::init() | |
33 | + */ | |
34 | + TimeStamp init(); | |
35 | + | |
36 | + protected: | |
37 | + std::string _processType; | |
38 | + double _timeFrom; | |
39 | + }; | |
40 | + } | |
41 | +} | |
42 | +#endif /* TIMESTAMP_FROMPROCESS_HH */ | |
... | ... |
... | ... | @@ -0,0 +1,56 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +/* | |
8 | + * File: InternalFields_CartProcess.cc | |
9 | + * Author: Furkan - AKKA I&S | |
10 | + * | |
11 | + * Created on July 11, 2022, 4:14 PM | |
12 | + */ | |
13 | +#include <stdlib.h> | |
14 | +#include <string> | |
15 | + | |
16 | +#include "Operation.hh" | |
17 | +#include "ParameterManager.hh" | |
18 | +#include "ParameterCreatorFromExpression.hh" | |
19 | +#include "Timestamp_Process.hh" | |
20 | +#include "TimestampCreator.hh" | |
21 | + | |
22 | +namespace AMDA | |
23 | +{ | |
24 | + namespace Parameters | |
25 | + { | |
26 | + | |
27 | + Timestamp_Process::Timestamp_Process(Parameter ¶meter) : SingleParamProcess_CRTP(parameter) | |
28 | + { | |
29 | + } | |
30 | + | |
31 | + Timestamp_Process::Timestamp_Process(const Timestamp_Process &pProcess, Parameter ¶meter) : SingleParamProcess_CRTP(pProcess, parameter) | |
32 | + { | |
33 | + } | |
34 | + | |
35 | + TimeStamp Timestamp_Process::init() | |
36 | + { | |
37 | + | |
38 | + TimeStamp timeStamp = _parameterInput->init(this, _timeIntervalList); | |
39 | + Parameter::InfoList lInfoList = _parameterInput->getInfoList(); | |
40 | + _parameter.getInfoList().insert(lInfoList.begin(), lInfoList.end()); | |
41 | + _paramInput = _parameterInput->getParamData(this).get(); | |
42 | + | |
43 | + /* Creation of the operation */ | |
44 | + | |
45 | + TimestampCreator lCreator(*this, *_paramInput, false); | |
46 | + _operation = lCreator.getOperation(); | |
47 | + _paramData = ParamDataSPtr(_operation->getParamOutput()); | |
48 | + _paramData->setMinSampling(_paramInput->getMinSampling()); | |
49 | + return timeStamp; | |
50 | + } | |
51 | + | |
52 | + Timestamp_Process::~Timestamp_Process() | |
53 | + { | |
54 | + } | |
55 | + } | |
56 | +} | |
0 | 57 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +/* | |
8 | + * File: TimeStamp_Process.hh | |
9 | + * Author: Furkan - AKKA I&S | |
10 | + * | |
11 | + * Created on September 19, 2022, 4:14 PM | |
12 | + */ | |
13 | + | |
14 | +#ifndef TIMESTAMP_PROCESS_HH | |
15 | +#define TIMESTAMP_PROCESS_HH | |
16 | + | |
17 | +#include "SingleParamProcess.hh" | |
18 | + | |
19 | +namespace AMDA | |
20 | +{ | |
21 | + namespace Parameters | |
22 | + { | |
23 | + | |
24 | + class Timestamp_Process : public AMDA::Parameters::SingleParamProcess_CRTP<Timestamp_Process> | |
25 | + { | |
26 | + public: | |
27 | + Timestamp_Process(Parameter ¶meter); | |
28 | + Timestamp_Process(const Timestamp_Process &pProcess, Parameter &pParameter); | |
29 | + virtual ~Timestamp_Process(); | |
30 | + | |
31 | + /** | |
32 | + * @overload DataWriter::init() | |
33 | + */ | |
34 | + TimeStamp init(); | |
35 | + | |
36 | + protected: | |
37 | + std::string _processType; | |
38 | + }; | |
39 | + } | |
40 | +} | |
41 | +#endif /* TIMESTAMP_PROCESS_HH */ | |
... | ... |
... | ... | @@ -0,0 +1,63 @@ |
1 | +/* | |
2 | + * File: InternalFields_.hh | |
3 | + * Author: Furkan - AKKA I&S | |
4 | + * | |
5 | + * Created on July 11, 2022, 4:14 PM | |
6 | + */ | |
7 | +#ifndef TIMESTAMP_OP_HH | |
8 | +#define TIMESTAMP_OP_HH | |
9 | + | |
10 | + | |
11 | +#include "Parameter.hh" | |
12 | +#include "ParamData.hh" | |
13 | +#include "DataTypeMath.hh" | |
14 | +#include "Operation.hh" | |
15 | +#include <vector> | |
16 | + | |
17 | +using namespace std; | |
18 | + | |
19 | +namespace AMDA | |
20 | +{ | |
21 | + namespace Parameters | |
22 | + { | |
23 | + template <typename ParamDataType> | |
24 | + class Timestamp_op : public Operation | |
25 | + { | |
26 | + public: | |
27 | + Timestamp_op(Process &pProcess, ParamDataType ¶mInput, bool isTimeFrom, double timeFrom) | |
28 | + : Operation(pProcess), _paramInput(paramInput), _isTimeFrom(isTimeFrom), _timeFrom(timeFrom), | |
29 | + _paramOutput(new ParamDataScalaireDouble()) | |
30 | + { | |
31 | + _paramDataOutput = _paramOutput; | |
32 | + } | |
33 | + | |
34 | + virtual ~Timestamp_op() | |
35 | + { | |
36 | + } | |
37 | + void write(ParamDataIndexInfo &pParamDataIndexInfo) | |
38 | + { | |
39 | + for (unsigned int _index = pParamDataIndexInfo._startIndex; | |
40 | + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; | |
41 | + ++_index) | |
42 | + { | |
43 | + double crtTime = _paramInput.getTime(_index); | |
44 | + _paramOutput->pushTime(crtTime); | |
45 | + | |
46 | + if (_isTimeFrom){ | |
47 | + if(_timeFrom > 0 && _timeFrom <= crtTime){ | |
48 | + crtTime -= _timeFrom; | |
49 | + } | |
50 | + } | |
51 | + _paramOutput->push(crtTime); | |
52 | + } | |
53 | + } | |
54 | + | |
55 | + protected: | |
56 | + ParamDataType &_paramInput; | |
57 | + bool _isTimeFrom; | |
58 | + double _timeFrom; | |
59 | + ParamDataScalaireDouble *_paramOutput; | |
60 | + }; | |
61 | + } | |
62 | +} | |
63 | +#endif /* TIMESTAMP_OP_HH */ | |
0 | 64 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,10 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<param xml:id="const_Timestamp"> | |
3 | + <get> | |
4 | + <constant> | |
5 | + <param sampling="60" type="int" dim1="1" dim2="1" value="1"/> | |
6 | + </constant> | |
7 | + </get> | |
8 | + <process description="timestamp(const)">#timestamp($constant_60_int_1_1_1)</process> | |
9 | + <output/> | |
10 | +</param> | |
... | ... |
... | ... | @@ -0,0 +1,10 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<param xml:id="imf_Timestamp"> | |
3 | + <get> | |
4 | + | |
5 | + <vi name="ace:imf:all"><baseParam name="IMF"> | |
6 | + | |
7 | + </baseParam></vi></get> | |
8 | + <process description="timestamp(imf)">#timestamp($ace_imf_all_IMF)</process> | |
9 | + <output/> | |
10 | +</param> | |
... | ... |