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