source: XIOS/dev/dev_trunk_omp/src/filter/binary_arithmetic_filter.hpp @ 1677

Last change on this file since 1677 was 1677, checked in by yushan, 5 years ago

MARK: Dynamic workflow graph developement. Branch up to date with trunk @1663.

File size: 3.7 KB
Line 
1#ifndef __XIOS_CBinaryArithmeticFilter__
2#define __XIOS_CBinaryArithmeticFilter__
3
4#include "filter.hpp"
5#include <string>
6#include "operator_expr.hpp"
7#include <unordered_map>
8
9namespace xios
10{
11  /*!
12   * A generic binary arithmetic filter wrapping any type of binary scalar-field operator.
13   */
14  class CScalarFieldArithmeticFilter : public CFilter, public IFilterEngine
15  {
16    public:
17      /*!
18       * Constructs an binary scalar-field arithmetic filter wrapping the specified operator.
19       *
20       * \param gc the associated garbage collector
21       * \param op the string identifing the binary scalar-field operator
22       * \param value the scalar value
23       */
24      CScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value);
25      StdString virtual GetName(void);
26
27    protected:
28      COperatorExpr::functionScalarField op; //!< The binary scalar-field operator attached to the binary arithmeric filter
29      double value; //!< The scalar value associated with the binary arithmeric filter
30
31      /*!
32       * Applies the binary 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 binary operation
36       */
37      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
38  }; // class CScalarFieldArithmeticFilter
39
40  /*!
41   * A generic binary arithmetic filter wrapping any type of binary scalar-field operator.
42   */
43  class CFieldScalarArithmeticFilter : public CFilter, public IFilterEngine
44  {
45    public:
46      /*!
47       * Constructs an binary field-scalar arithmetic filter wrapping the specified operator.
48       *
49       * \param gc the associated garbage collector
50       * \param op the string identifing the binary field-scalar operator
51       * \param value the scalar value
52       */
53      CFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value);
54      StdString virtual GetName(void);
55
56    protected:
57      COperatorExpr::functionFieldScalar op; //!< The binary field-scalar operator attached to the binary arithmeric filter
58      double value; //!< The scalar value associated with the binary arithmeric filter
59
60      /*!
61       * Applies the binary field-scalar operator to the input data and returns the result.
62       *
63       * \param data a vector of packets corresponding to each slot (one in this case)
64       * \return the result of the binary operation
65       */
66      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
67  }; // class CFieldScalarArithmeticFilter
68
69  /*!
70   * A generic binary arithmetic filter wrapping any type of binary scalar-field operator.
71   */
72  class CFieldFieldArithmeticFilter : public CFilter, public IFilterEngine
73  {
74    public:
75      /*!
76       * Constructs an binary field-field arithmetic filter wrapping the specified operator.
77       *
78       * \param gc the associated garbage collector
79       * \param op the string identifing the binary field-field operator
80       */
81      CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op);
82      StdString virtual GetName(void);
83
84    protected:
85      COperatorExpr::functionFieldField op; //!< The binary field-field operator attached to the binary arithmeric filter
86
87      /*!
88       * Applies the binary field-field operator to the input data and returns the result.
89       *
90       * \param data a vector of packets corresponding to each slot (one in this case)
91       * \return the result of the binary operation
92       */
93      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
94  }; // class CFieldFieldArithmeticFilter
95} // namespace xios
96
97#endif //__XIOS_CBinaryArithmeticFilter__
Note: See TracBrowser for help on using the repository browser.