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