Commit be29edb90b30a79716a63589b171ff4171b520fa

Authored by Erdogan Furkan
1 parent 44e0c26f

#6598 / #10557 / #5638 - Done

src/ExternLib/Timestamp/AMDAPlugin.cc
... ... @@ -7,6 +7,7 @@
7 7 #include "PluginManager.hh"
8 8  
9 9 #include "Timestamp_Process.hh"
  10 +#include "Timestamp_FromProcess.hh"
10 11  
11 12 using namespace AMDA::Parameters;
12 13  
... ... @@ -26,4 +27,8 @@ extern "C" void registerPlugin(AMDA::Plugins::PluginManager &pm)
26 27 ProcessFactory factTimestamp_Process = boost::factory<Timestamp_Process *>();
27 28 ServicesServer::getInstance()->addProcessFactory("timestamp", factTimestamp_Process);
28 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());
29 34 }
... ...
src/ExternLib/Timestamp/TimestampCreator.hh
... ... @@ -5,10 +5,10 @@
5 5 */
6 6  
7 7 /*
8   - * File: InternalFieldsCreator.hh
  8 + * File: TimestampCreator.hh
9 9 * Author: Furkan - AKKA I&S
10 10 *
11   - * Created on July 11, 2022, 4:14 PM
  11 + * Created on September 26, 2022, 4:14 PM
12 12 */
13 13  
14 14 #ifndef TIMESTAMPCREATOR_HH
... ... @@ -25,10 +25,9 @@ namespace AMDA
25 25 class TimestampCreator : public VisitorOfParamData
26 26 {
27 27 public:
28   - TimestampCreator(Process &pProcess, ParamData &paramInput)
29   - : _process(pProcess), _paramData(paramInput), _operation(NULL)
  28 + TimestampCreator(Process &pProcess, ParamData &paramInput, bool isTimeFrom, double timeFrom = 0.0)
  29 + : _process(pProcess), _paramData(paramInput), _isTimeFrom(isTimeFrom), _timeFrom(timeFrom), _operation(NULL)
30 30 {
31   -
32 31 _paramData.accept(*this);
33 32 }
34 33  
... ... @@ -187,15 +186,18 @@ namespace AMDA
187 186 template <typename ParamDataType>
188 187 void create()
189 188 {
190   - _operation = new Timestamp_op<ParamDataType>(_process, dynamic_cast<ParamDataType &>(_paramData));
  189 + _operation = new Timestamp_op<ParamDataType>(_process, dynamic_cast<ParamDataType &>(_paramData), _isTimeFrom, _timeFrom);
  190 +
191 191 }
192 192  
193 193 private:
194 194 Process &_process;
195 195 ParamData &_paramData;
  196 + bool _isTimeFrom;
  197 + double _timeFrom;
196 198 Operation *_operation;
197 199 };
198 200 }
199 201 }
200 202  
201   -#endif /* INTERNALFIELDSCREATOR_HH */
  203 +#endif /* TIMESTAMPCREATOR_HH */
... ...
src/ExternLib/Timestamp/Timestamp_FromProcess.cc 0 โ†’ 100644
... ... @@ -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 &parameter) : SingleParamProcess_CRTP(parameter)
  28 + {
  29 + }
  30 +
  31 + Timestamp_FromProcess::Timestamp_FromProcess(const Timestamp_FromProcess &pProcess, Parameter &parameter) : 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
... ...
src/ExternLib/Timestamp/Timestamp_FromProcess.hh 0 โ†’ 100644
... ... @@ -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 &parameter);
  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 */
... ...
src/ExternLib/Timestamp/Timestamp_Process.cc
... ... @@ -39,36 +39,10 @@ namespace AMDA
39 39 Parameter::InfoList lInfoList = _parameterInput->getInfoList();
40 40 _parameter.getInfoList().insert(lInfoList.begin(), lInfoList.end());
41 41 _paramInput = _parameterInput->getParamData(this).get();
42   -
43   - /* Get the modelname and the boolean for the use or not of Con2020
44   - std::string modelname;
45   - if (_attributList.size() == 2)
46   - {
47   - switch (std::stoi(_attributList[0]))
48   - {
49   - case 0:
50   - modelname = "jrm09";
51   - break;
52   - case 1:
53   - modelname = "jrm33";
54   - break;
55   - case 2:
56   - modelname = "isaac";
57   - break;
58   - default:
59   - modelname = "jrm09";
60   - break;
61   - }
62   - if (std::stoi(_attributList[1]) >= 0 && std::stoi(_attributList[1]) <= 3) // 0: no Con2020, 1 : Analytic, 2: Integral, 3: Hybrid
63   - _addCon2020 = std::stoi(_attributList[1]);
64   - else
65   - _addCon2020 = 0;
66   - }
67   - */
68 42  
69 43 /* Creation of the operation */
70 44  
71   - TimestampCreator lCreator(*this, *_paramInput);
  45 + TimestampCreator lCreator(*this, *_paramInput, false);
72 46 _operation = lCreator.getOperation();
73 47 _paramData = ParamDataSPtr(_operation->getParamOutput());
74 48 _paramData->setMinSampling(_paramInput->getMinSampling());
... ...
src/ExternLib/Timestamp/Timestamp_op.hh
... ... @@ -24,8 +24,8 @@ namespace AMDA
24 24 class Timestamp_op : public Operation
25 25 {
26 26 public:
27   - Timestamp_op(Process &pProcess, ParamDataType &paramInput)
28   - : Operation(pProcess), _paramInput(paramInput),
  27 + Timestamp_op(Process &pProcess, ParamDataType &paramInput, bool isTimeFrom, double timeFrom)
  28 + : Operation(pProcess), _paramInput(paramInput), _isTimeFrom(isTimeFrom), _timeFrom(timeFrom),
29 29 _paramOutput(new ParamDataScalaireDouble())
30 30 {
31 31 _paramDataOutput = _paramOutput;
... ... @@ -41,14 +41,21 @@ namespace AMDA
41 41 ++_index)
42 42 {
43 43 double crtTime = _paramInput.getTime(_index);
44   -
45 44 _paramOutput->pushTime(crtTime);
  45 +
  46 + if (_isTimeFrom){
  47 + if(_timeFrom > 0 && _timeFrom <= crtTime){
  48 + crtTime -= _timeFrom;
  49 + }
  50 + }
46 51 _paramOutput->push(crtTime);
47 52 }
48 53 }
49 54  
50 55 protected:
51 56 ParamDataType &_paramInput;
  57 + bool _isTimeFrom;
  58 + double _timeFrom;
52 59 ParamDataScalaireDouble *_paramOutput;
53 60 };
54 61 }
... ...