Timestamp_op.hh 1.43 KB
/*
 * 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:
            Timestamp_op(Process &pProcess, ParamDataType &paramInput)
                : Operation(pProcess), _paramInput(paramInput),
                  _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);

                    _paramOutput->pushTime(crtTime);
                    _paramOutput->push(crtTime);
                }
            }

        protected:
            ParamDataType &_paramInput;
            ParamDataScalaireDouble *_paramOutput;
        };
    }
}
#endif /* TIMESTAMP_OP_HH */