Blame view

src/ExternLib/Timestamp/Timestamp_op.hh 1.76 KB
3b7530a6   Erdogan Furkan   # 6598- Creation ...
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
/*
 * File:   InternalFields_.hh
 * Author: Furkan - AKKA I&S
 *
 * Created on July 11, 2022, 4:14 PM
 */
#ifndef TIMESTAMP_OP_HH
#define TIMESTAMP_OP_HH


#include "Parameter.hh"
#include "ParamData.hh"
#include "DataTypeMath.hh"
#include "Operation.hh"
#include <vector>

using namespace std;

namespace AMDA
{
    namespace Parameters
    {
        template <typename ParamDataType>
        class Timestamp_op : public Operation
        {
        public:
be29edb9   Erdogan Furkan   #6598 / #10557 / ...
27
28
            Timestamp_op(Process &pProcess, ParamDataType &paramInput, bool isTimeFrom, double timeFrom)
                : Operation(pProcess), _paramInput(paramInput), _isTimeFrom(isTimeFrom), _timeFrom(timeFrom),
3b7530a6   Erdogan Furkan   # 6598- Creation ...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
                  _paramOutput(new ParamDataScalaireDouble())
            {
                _paramDataOutput = _paramOutput;
            }

            virtual ~Timestamp_op()
            {
            }
            void write(ParamDataIndexInfo &pParamDataIndexInfo)
            {
                for (unsigned int _index = pParamDataIndexInfo._startIndex;
                     _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
                     ++_index)
                {
                    double crtTime = _paramInput.getTime(_index);
3b7530a6   Erdogan Furkan   # 6598- Creation ...
44
                    _paramOutput->pushTime(crtTime);
be29edb9   Erdogan Furkan   #6598 / #10557 / ...
45
46
47
48
49
50

                    if (_isTimeFrom){
                        if(_timeFrom > 0 && _timeFrom <= crtTime){
                            crtTime -= _timeFrom;
                        }
                    }
3b7530a6   Erdogan Furkan   # 6598- Creation ...
51
52
53
54
55
56
                    _paramOutput->push(crtTime);
                }
            }

        protected:
            ParamDataType &_paramInput;
be29edb9   Erdogan Furkan   #6598 / #10557 / ...
57
58
            bool  _isTimeFrom;
            double _timeFrom;
3b7530a6   Erdogan Furkan   # 6598- Creation ...
59
60
61
62
63
            ParamDataScalaireDouble *_paramOutput;
        };
    }
}
#endif /* TIMESTAMP_OP_HH */