TimestampCreator.hh 5.49 KB
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * File:   InternalFieldsCreator.hh
 * Author: Furkan - AKKA I&S
 *
 * Created on July 11, 2022, 4:14 PM
 */

#ifndef TIMESTAMPCREATOR_HH
#define TIMESTAMPCREATOR_HH

#include "ParamData.hh"
#include "VisitorOfParamData.hh"
#include "Timestamp_op.hh"

namespace AMDA
{
    namespace Parameters
    {
        class TimestampCreator : public VisitorOfParamData
        {
        public:
            TimestampCreator(Process &pProcess, ParamData &paramInput)
                : _process(pProcess), _paramData(paramInput), _operation(NULL)
            {

                _paramData.accept(*this);
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireShort *)
             */
            void visit(ParamDataScalaireShort *)
            {
                create<ParamDataScalaireShort>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *)
             */
            void visit(ParamDataScalaireFloat *)
            {
                create<ParamDataScalaireFloat>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *)
             */
            void visit(ParamDataScalaireDouble *)
            {
                create<ParamDataScalaireDouble>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *)
             */
            void visit(ParamDataScalaireLongDouble *)
            {
                create<ParamDataScalaireLongDouble>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireInt *)
             */
            void visit(ParamDataScalaireInt *)
            {
                create<ParamDataScalaireInt>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataLogicalData *)
             */
            void visit(ParamDataLogicalData *)
            {
                create<ParamDataLogicalData>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DShort *)
             */
            void visit(ParamDataTab1DShort *)
            {
                create<ParamDataTab1DShort>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *)
             */
            void visit(ParamDataTab1DFloat *)
            {
                create<ParamDataTab1DFloat>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *)
             */
            void visit(ParamDataTab1DDouble *)
            {
                create<ParamDataTab1DDouble>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *)
             */
            void visit(ParamDataTab1DLongDouble *)
            {
               create<ParamDataTab1DLongDouble>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DInt *)
             */
            void visit(ParamDataTab1DInt *)
            {
                create<ParamDataTab1DInt>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *)
             */
            void visit(ParamDataTab1DLogicalData *)
            {
                create<ParamDataTab1DLogicalData>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DShort *)
             */
            void visit(ParamDataTab2DShort *)
            {
                create<ParamDataTab2DShort>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *)
             */
            void visit(ParamDataTab2DFloat *)
            {
                create<ParamDataTab2DFloat>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *)
             */
            void visit(ParamDataTab2DDouble *)
            {
                create<ParamDataTab2DDouble>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *)
             */
            void visit(ParamDataTab2DLongDouble *)
            {
                create<ParamDataTab2DLongDouble>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DInt *)
             */
            void visit(ParamDataTab2DInt *)
            {
                create<ParamDataTab2DInt>();
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *)
             */
            void visit(ParamDataTab2DLogicalData *)
            {
                create<ParamDataTab2DLogicalData>();
            }

            /**
             * @brief get the TimeShifted parameterized operation.
             */
            Operation *getOperation() const
            {
                return _operation;
            }

            template <typename ParamDataType>
            void create()
            {
                _operation = new Timestamp_op<ParamDataType>(_process, dynamic_cast<ParamDataType &>(_paramData));
            }

        private:
            Process &_process;
            ParamData &_paramData;
            Operation *_operation;
        };
    }
}

#endif /* INTERNALFIELDSCREATOR_HH */