Blame view

src/ExternLib/Spectrum/SpectrumCreator.hh 7.1 KB
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
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
/*
 * 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:   SpectrumCreator.hh
 * Author: hacene
 *
 * Created on December 31, 2020, 3:06 PM
 */

#ifndef SPECTRUMCREATOR_HH
#define SPECTRUMCREATOR_HH

#include "ParamData.hh"
#include "VisitorOfParamData.hh"
#include "Spectrum.hh"

namespace AMDA {
    namespace Parameters {

        class SpectrumCreator : public VisitorOfParamData {
        public:

d466ae92   Hacene SI HADJ MOHAND   progress
27
28
29
30
31
32
33
            typedef enum {
                FOURIER,
            } SpectrumType;

            SpectrumCreator(Process& pProcess, TimeIntervalListSPtr pTimeIntervalList, ParamData& paramInput,  SpectrumType type, double windowtime, std::string sampling = "center" )
            : _process(pProcess), _timeIntervalList(pTimeIntervalList), _paramData(paramInput), _type(type), _windowtime(windowtime), _sampling(sampling), _operation(NULL) {

b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
34
35
36
37
38
39
40
                _paramData.accept(*this);
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireShort *)
             */
            void visit(ParamDataScalaireShort *) {
d466ae92   Hacene SI HADJ MOHAND   progress
41
                createOperation<short>();
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
42
43
44
45
46
47
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *)
             */
            void visit(ParamDataScalaireFloat *) {
d466ae92   Hacene SI HADJ MOHAND   progress
48
                createOperation<float>();
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
49
50
51
52
53
54
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *)
             */
            void visit(ParamDataScalaireDouble *) {
d466ae92   Hacene SI HADJ MOHAND   progress
55
               createOperation<double>();
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
56
57
58
59
60
61
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *)
             */
            void visit(ParamDataScalaireLongDouble *) {
d466ae92   Hacene SI HADJ MOHAND   progress
62
                createOperation<long double>();
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
63
64
65
66
67
68
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataScalaireInt *)
             */
            void visit(ParamDataScalaireInt *) {
d466ae92   Hacene SI HADJ MOHAND   progress
69
               createOperation<int>();
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
70
71
72
73
74
75
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataLogicalData *)
             */
            void visit(ParamDataLogicalData *) {
d466ae92   Hacene SI HADJ MOHAND   progress
76
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
77
78
79
80
81
82
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DShort *)
             */
            void visit(ParamDataTab1DShort *) {
d466ae92   Hacene SI HADJ MOHAND   progress
83
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
84
85
86
87
88
89
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *)
             */
            void visit(ParamDataTab1DFloat *) {
d466ae92   Hacene SI HADJ MOHAND   progress
90
               BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
91
92
93
94
95
96
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *)
             */
            void visit(ParamDataTab1DDouble *) {
d466ae92   Hacene SI HADJ MOHAND   progress
97
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
98
99
100
101
102
103
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *)
             */
            void visit(ParamDataTab1DLongDouble *) {
d466ae92   Hacene SI HADJ MOHAND   progress
104
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
105
106
107
108
109
110
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DInt *)
             */
            void visit(ParamDataTab1DInt *) {
d466ae92   Hacene SI HADJ MOHAND   progress
111
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
112
113
114
115
116
117
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *)
             */
            void visit(ParamDataTab1DLogicalData *) {
d466ae92   Hacene SI HADJ MOHAND   progress
118
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
119
120
121
122
123
124
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DShort *)
             */
            void visit(ParamDataTab2DShort *) {
d466ae92   Hacene SI HADJ MOHAND   progress
125
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
126
127
128
129
130
131
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *)
             */
            void visit(ParamDataTab2DFloat *) {
d466ae92   Hacene SI HADJ MOHAND   progress
132
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
133
134
135
136
137
138
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *)
             */
            void visit(ParamDataTab2DDouble *) {
d466ae92   Hacene SI HADJ MOHAND   progress
139
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
140
141
142
143
144
145
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *)
             */
            void visit(ParamDataTab2DLongDouble *) {
d466ae92   Hacene SI HADJ MOHAND   progress
146
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
147
148
149
150
151
152
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DInt *)
             */
            void visit(ParamDataTab2DInt *) {
d466ae92   Hacene SI HADJ MOHAND   progress
153
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
154
155
156
157
158
159
            }

            /**
             * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *)
             */
            void visit(ParamDataTab2DLogicalData *) {
d466ae92   Hacene SI HADJ MOHAND   progress
160
                BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("SpectrumCreator operation not supported"));
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
161
162
163
164
165
166
167
168
169
170
171
172
            }

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

            template <typename Type>
            void createOperation() {
d466ae92   Hacene SI HADJ MOHAND   progress
173
                _operation = new Spectrum::SpectrumFourier<Type, double>(_process, _timeIntervalList, dynamic_cast<ParamDataSpec<Type> &> (_paramData), _windowtime, _sampling);
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
174
175
            }
            Process &_process;
d466ae92   Hacene SI HADJ MOHAND   progress
176
            TimeIntervalListSPtr _timeIntervalList;
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
177
            ParamData &_paramData;
d466ae92   Hacene SI HADJ MOHAND   progress
178
179
180
            SpectrumType _type;
            double _windowtime;
            std::string _sampling;
b58d725b   Hacene SI HADJ MOHAND   adding plungin auto
181
182
183
184
185
186
187
188
            Operation* _operation;
        };

    }
}


#endif /* SPECTRUMCREATOR_HH */