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 | |
---|
9 | namespace 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 | |
---|
26 | protected: |
---|
27 | COperatorExpr::functionScalarField op; //!< The binary scalar-field operator attached to the binary arithmeric filter |
---|
28 | double value; //!< The scalar value associated with the binary arithmeric filter |
---|
29 | |
---|
30 | /*! |
---|
31 | * Applies the binary scalar-field operator to the input data and returns the result. |
---|
32 | * |
---|
33 | * \param data a vector of packets corresponding to each slot (one in this case) |
---|
34 | * \return the result of the binary operation |
---|
35 | */ |
---|
36 | CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); |
---|
37 | }; // class CScalarFieldArithmeticFilter |
---|
38 | |
---|
39 | /*! |
---|
40 | * A generic binary arithmetic filter wrapping any type of binary scalar-field operator. |
---|
41 | */ |
---|
42 | class CFieldScalarArithmeticFilter : public CFilter, public IFilterEngine |
---|
43 | { |
---|
44 | public: |
---|
45 | /*! |
---|
46 | * Constructs an binary field-scalar arithmetic filter wrapping the specified operator. |
---|
47 | * |
---|
48 | * \param gc the associated garbage collector |
---|
49 | * \param op the string identifing the binary field-scalar operator |
---|
50 | * \param value the scalar value |
---|
51 | */ |
---|
52 | CFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); |
---|
53 | |
---|
54 | protected: |
---|
55 | COperatorExpr::functionFieldScalar op; //!< The binary field-scalar operator attached to the binary arithmeric filter |
---|
56 | double value; //!< The scalar value associated with the binary arithmeric filter |
---|
57 | |
---|
58 | /*! |
---|
59 | * Applies the binary field-scalar operator to the input data and returns the result. |
---|
60 | * |
---|
61 | * \param data a vector of packets corresponding to each slot (one in this case) |
---|
62 | * \return the result of the binary operation |
---|
63 | */ |
---|
64 | CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); |
---|
65 | }; // class CFieldScalarArithmeticFilter |
---|
66 | |
---|
67 | /*! |
---|
68 | * A generic binary arithmetic filter wrapping any type of binary scalar-field operator. |
---|
69 | */ |
---|
70 | class CFieldFieldArithmeticFilter : public CFilter, public IFilterEngine |
---|
71 | { |
---|
72 | public: |
---|
73 | /*! |
---|
74 | * Constructs an binary field-field arithmetic filter wrapping the specified operator. |
---|
75 | * |
---|
76 | * \param gc the associated garbage collector |
---|
77 | * \param op the string identifing the binary field-field operator |
---|
78 | */ |
---|
79 | CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op); |
---|
80 | |
---|
81 | protected: |
---|
82 | COperatorExpr::functionFieldField op; //!< The binary field-field operator attached to the binary arithmeric filter |
---|
83 | |
---|
84 | /*! |
---|
85 | * Applies the binary field-field operator to the input data and returns the result. |
---|
86 | * |
---|
87 | * \param data a vector of packets corresponding to each slot (one in this case) |
---|
88 | * \return the result of the binary operation |
---|
89 | */ |
---|
90 | CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); |
---|
91 | }; // class CFieldFieldArithmeticFilter |
---|
92 | } // namespace xios |
---|
93 | |
---|
94 | #endif //__XIOS_CBinaryArithmeticFilter__ |
---|