source: XIOS/dev/XIOS_DEV_CMIP6/src/filter/ternary_arithmetic_filter.hpp @ 1358

Last change on this file since 1358 was 1162, checked in by oabramkina, 7 years ago

Two server levels: adding files missing in r1158.

File size: 9.0 KB
Line 
1#ifndef __XIOS_CTernaryArithmeticFilter__
2#define __XIOS_CTernaryArithmeticFilter__
3
4#include "filter.hpp"
5#include <string>
6#include "operator_expr.hpp"
7
8namespace xios
9{
10  /*!
11   * A generic ternary arithmetic filter wrapping any type of ternary scalar-scalar-field operator.
12   */
13  class CScalarScalarFieldArithmeticFilter : public CFilter, public IFilterEngine
14  {
15    public:
16      /*!
17       * Constructs an ternary scalar-field arithmetic filter wrapping the specified operator.
18       *
19       * \param gc the associated garbage collector
20       * \param op the string identifing the ternary scalar-scalar-field operator
21       * \param value1 the scalar value
22       * \param value2 the scalar value
23       */
24      CScalarScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value1, double value2);
25
26    protected:
27      COperatorExpr::functionScalarScalarField op; //!< The ternary scalar-scalar-field operator attached to the ternary arithmeric filter
28      double value1; //!< The scalar value 1 associated with the ternary arithmeric filter
29      double value2; //!< The scalar value 2 associated with the ternary arithmeric filter
30
31      /*!
32       * Applies the ternary scalar-scalar-field operator to the input data and returns the result.
33       *
34       * \param data a vector of packets corresponding to each slot (one in this case)
35       * \return the result of the ternary operation
36       */
37      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
38  }; // class CScalarScalarFieldArithmeticFilter
39
40 
41   /*!
42   * A generic ternary arithmetic filter wrapping any type of ternary scalar-field-scalar operator.
43   */
44  class CScalarFieldScalarArithmeticFilter : public CFilter, public IFilterEngine
45  {
46    public:
47      /*!
48       * Constructs an ternary scalar-field arithmetic filter wrapping the specified operator.
49       *
50       * \param gc the associated garbage collector
51       * \param op the string identifing the ternary scalar-field-scalar operator
52       * \param value1 the scalar value
53       * \param value2 the scalar value
54       */
55      CScalarFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value1, double value2);
56
57    protected:
58      COperatorExpr::functionScalarFieldScalar op; //!< The ternary scalar-field-scalar operator attached to the ternary arithmeric filter
59      double value1; //!< The scalar value 1 associated with the ternary arithmeric filter
60      double value2; //!< The scalar value 2 associated with the ternary arithmeric filter
61
62      /*!
63       * Applies the ternary scalar-field-scalar operator to the input data and returns the result.
64       *
65       * \param data a vector of packets corresponding to each slot (one in this case)
66       * \return the result of the ternary operation
67       */
68      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
69  }; // class CScalarScalarFieldArithmeticFilter
70
71  /*!
72   * A generic ternary arithmetic filter wrapping any type of ternary scalar-field-field operator.
73   */
74  class CScalarFieldFieldArithmeticFilter : public CFilter, public IFilterEngine
75  {
76    public:
77      /*!
78       * Constructs an ternary scalar-field arithmetic filter wrapping the specified operator.
79       *
80       * \param gc the associated garbage collector
81       * \param op the string identifing the ternary scalar-field-field operator
82       * \param value the scalar value
83       */
84      CScalarFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value);
85
86    protected:
87      COperatorExpr::functionScalarFieldField op; //!< The ternary scalar-field-scalar operator attached to the ternary arithmeric filter
88      double value; //!< The scalar value 1 associated with the ternary arithmeric filter
89
90      /*!
91       * Applies the ternary scalar-field-field operator to the input data and returns the result.
92       *
93       * \param data a vector of packets corresponding to each slot (one in this case)
94       * \return the result of the ternary operation
95       */
96      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
97  }; // class CScalarScalarFieldArithmeticFilter
98
99
100
101 /*!
102   * A generic ternary arithmetic filter wrapping any type of ternary field-scalar-scalar operator.
103   */
104  class CFieldScalarScalarArithmeticFilter : public CFilter, public IFilterEngine
105  {
106    public:
107      /*!
108       * Constructs an ternary field-scalar-scalar arithmetic filter wrapping the specified operator.
109       *
110       * \param gc the associated garbage collector
111       * \param op the string identifing the ternary field-scalar-scalar operator
112       * \param value1 the scalar value
113       * \param value2 the scalar value
114       */
115      CFieldScalarScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value1, double value2);
116
117    protected:
118      COperatorExpr::functionFieldScalarScalar op; //!< The ternary field-scalar-scalar operator attached to the ternary arithmeric filter
119      double value1; //!< The scalar value 1 associated with the ternary arithmeric filter
120      double value2; //!< The scalar value 2 associated with the ternary arithmeric filter
121
122      /*!
123       * Applies the ternary field-scalar-scalar operator to the input data and returns the result.
124       *
125       * \param data a vector of packets corresponding to each slot (one in this case)
126       * \return the result of the ternary operation
127       */
128      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
129  }; // class CFieldScalarScalarArithmeticFilter
130
131
132/*!
133   * A generic ternary arithmetic filter wrapping any type of ternary field-scalar-field operator.
134   */
135  class CFieldScalarFieldArithmeticFilter : public CFilter, public IFilterEngine
136  {
137    public:
138      /*!
139       * Constructs an ternary field-scalar-field arithmetic filter wrapping the specified operator.
140       *
141       * \param gc the associated garbage collector
142       * \param op the string identifing the ternary field-scalar-field operator
143       * \param value the scalar value
144       */
145      CFieldScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value);
146
147    protected:
148      COperatorExpr::functionFieldScalarField op; //!< The ternary field-scalar-field operator attached to the ternary arithmeric filter
149      double value; //!< The scalar value associated with the ternary arithmeric filter
150
151      /*!
152       * Applies the ternary field-scalar-field operator to the input data and returns the result.
153       *
154       * \param data a vector of packets corresponding to each slot (one in this case)
155       * \return the result of the ternary operation
156       */
157      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
158  }; // class CFieldScalarFieldArithmeticFilter
159
160
161/*!
162   * A generic ternary arithmetic filter wrapping any type of ternary field-field-scalar operator.
163   */
164  class CFieldFieldScalarArithmeticFilter : public CFilter, public IFilterEngine
165  {
166    public:
167      /*!
168       * Constructs an ternary field-field-scalar arithmetic filter wrapping the specified operator.
169       *
170       * \param gc the associated garbage collector
171       * \param op the string identifing the ternary field-scalar-field operator
172       * \param value the scalar value
173       */
174      CFieldFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value);
175
176    protected:
177      COperatorExpr::functionFieldFieldScalar op; //!< The ternary field-field-scalar operator attached to the ternary arithmeric filter
178      double value; //!< The scalar value associated with the ternary arithmeric filter
179
180      /*!
181       * Applies the ternary field-field-scalar operator to the input data and returns the result.
182       *
183       * \param data a vector of packets corresponding to each slot (one in this case)
184       * \return the result of the ternary operation
185       */
186      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
187  }; // class CFieldFielScalardArithmeticFilter
188
189
190/*!
191   * A generic ternary arithmetic filter wrapping any type of ternary field-field-field operator.
192   */
193  class CFieldFieldFieldArithmeticFilter : public CFilter, public IFilterEngine
194  {
195    public:
196      /*!
197       * Constructs an ternary field-field-scalar arithmetic filter wrapping the specified operator.
198       *
199       * \param gc the associated garbage collector
200       * \param op the string identifing the ternary field-scalar-field operator
201       */
202      CFieldFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op);
203
204    protected:
205      COperatorExpr::functionFieldFieldField op; //!< The ternary field-field-field operator attached to the ternary arithmeric filter
206
207      /*!
208       * Applies the ternary field-field-field operator to the input data and returns the result.
209       *
210       * \param data a vector of packets corresponding to each slot (one in this case)
211       * \return the result of the ternary operation
212       */
213      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
214  }; // class CFieldFielFieldArithmeticFilter
215
216
217} // namespace xios
218
219#endif //__XIOS_CTernaryArithmeticFilter__
220
Note: See TracBrowser for help on using the repository browser.