[642] | 1 | #ifndef __XIOS_FILTER_EXPR_NODE_HPP__ |
---|
| 2 | #define __XIOS_FILTER_EXPR_NODE_HPP__ |
---|
| 3 | |
---|
| 4 | #include <string> |
---|
| 5 | #include <boost/shared_ptr.hpp> |
---|
| 6 | #include <boost/smart_ptr/scoped_ptr.hpp> |
---|
| 7 | #include "scalar_expr_node.hpp" |
---|
| 8 | |
---|
| 9 | namespace xios |
---|
| 10 | { |
---|
| 11 | class COutputPin; |
---|
| 12 | class CGarbageCollector; |
---|
| 13 | class CField; |
---|
| 14 | |
---|
| 15 | /*! |
---|
| 16 | * Interface implemented by all the nodes of a tree representing an expression |
---|
| 17 | * which can be transformed into a filter graph representation. |
---|
| 18 | */ |
---|
| 19 | struct IFilterExprNode |
---|
| 20 | { |
---|
| 21 | /*! |
---|
| 22 | * Builds a filter graph corresponding to the expression tree. |
---|
| 23 | * |
---|
| 24 | * \param gc the garbage collector to associated with the filter graph |
---|
| 25 | * \param thisField the field to which the expression is attached |
---|
| 26 | * \return the output pin of the filter producing the result of the expression |
---|
| 27 | */ |
---|
| 28 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const = 0; |
---|
| 29 | }; |
---|
| 30 | |
---|
| 31 | /*! |
---|
| 32 | * Expression node corresponding to a field. |
---|
| 33 | */ |
---|
| 34 | class CFilterFieldExprNode : public IFilterExprNode |
---|
| 35 | { |
---|
| 36 | public: |
---|
| 37 | /*! |
---|
| 38 | * Constructs an expression node corresponding |
---|
| 39 | * to the field whose id is provided. |
---|
| 40 | * |
---|
| 41 | * \param fieldId the identifier of the field |
---|
| 42 | */ |
---|
| 43 | CFilterFieldExprNode(const std::string& fieldId); |
---|
| 44 | |
---|
| 45 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 46 | |
---|
| 47 | private: |
---|
| 48 | std::string fieldId; //!< The identifier of the field |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | /*! |
---|
[643] | 52 | * Expression node corresponding to a field for which the result of |
---|
| 53 | * the temporal operation is requested instead of the instant value. |
---|
| 54 | */ |
---|
| 55 | class CFilterTemporalFieldExprNode : public IFilterExprNode |
---|
| 56 | { |
---|
| 57 | public: |
---|
| 58 | /*! |
---|
| 59 | * Constructs an expression node corresponding |
---|
| 60 | * to the field whose id is provided. |
---|
| 61 | * |
---|
| 62 | * \param fieldId the identifier of the field |
---|
| 63 | */ |
---|
| 64 | CFilterTemporalFieldExprNode(const std::string& fieldId); |
---|
| 65 | |
---|
| 66 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 67 | |
---|
| 68 | private: |
---|
| 69 | std::string fieldId; //!< The identifier of the field |
---|
| 70 | }; |
---|
| 71 | |
---|
| 72 | /*! |
---|
[642] | 73 | * Expression node corresponding to a unary operation on a field. |
---|
| 74 | */ |
---|
| 75 | class CFilterUnaryOpExprNode : public IFilterExprNode |
---|
| 76 | { |
---|
| 77 | public: |
---|
| 78 | /*! |
---|
| 79 | * Constructs an expression node corresponding to the specified unary operation |
---|
| 80 | * applied to the provided child node. |
---|
| 81 | * Note that the child node will be destroyed automatically when the parent node |
---|
| 82 | * is destroyed. |
---|
| 83 | * |
---|
| 84 | * \param opId the identifier of the operator |
---|
| 85 | * \param child the child node to which the operator is applied |
---|
| 86 | */ |
---|
| 87 | CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child); |
---|
| 88 | |
---|
| 89 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 90 | |
---|
| 91 | private: |
---|
| 92 | std::string opId; //!< The identifier of the field |
---|
| 93 | boost::scoped_ptr<IFilterExprNode> child; //!< The child node to which the operator is applied |
---|
| 94 | }; |
---|
| 95 | |
---|
| 96 | /*! |
---|
| 97 | * Expression node corresponding to a binary operation on a scalar and a field. |
---|
| 98 | */ |
---|
| 99 | class CFilterScalarFieldOpExprNode : public IFilterExprNode |
---|
| 100 | { |
---|
| 101 | public: |
---|
| 102 | /*! |
---|
| 103 | * Constructs an expression node corresponding to the specified binary operation |
---|
| 104 | * applied to the provided scalar and field child nodes. |
---|
| 105 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 106 | * is destroyed. |
---|
| 107 | * |
---|
| 108 | * \param child1 the scalar child node to which the operator is applied |
---|
| 109 | * \param opId the identifier of the operator |
---|
| 110 | * \param child2 the field child node to which the operator is applied |
---|
| 111 | */ |
---|
| 112 | CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2); |
---|
| 113 | |
---|
| 114 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 115 | |
---|
| 116 | private: |
---|
| 117 | std::string opId; //!< The identifier of the field |
---|
| 118 | boost::scoped_ptr<IScalarExprNode> child1; //!< The scalar child node to which the operator is applied |
---|
| 119 | boost::scoped_ptr<IFilterExprNode> child2; //!< The field child node to which the operator is applied |
---|
| 120 | }; |
---|
| 121 | |
---|
| 122 | /*! |
---|
| 123 | * Expression node corresponding to a binary operation on a field and a scalar. |
---|
| 124 | */ |
---|
| 125 | class CFilterFieldScalarOpExprNode : public IFilterExprNode |
---|
| 126 | { |
---|
| 127 | public: |
---|
| 128 | /*! |
---|
| 129 | * Constructs an expression node corresponding to the specified binary operation |
---|
| 130 | * applied to the provided field and scalar child nodes. |
---|
| 131 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 132 | * is destroyed. |
---|
| 133 | * |
---|
| 134 | * \param child1 the field child node to which the operator is applied |
---|
| 135 | * \param opId the identifier of the operator |
---|
| 136 | * \param child2 the scalar child node to which the operator is applied |
---|
| 137 | */ |
---|
| 138 | CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2); |
---|
| 139 | |
---|
| 140 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 141 | |
---|
| 142 | private: |
---|
| 143 | std::string opId; //!< The identifier of the field |
---|
| 144 | boost::scoped_ptr<IFilterExprNode> child1; //!< The field child node to which the operator is applied |
---|
| 145 | boost::scoped_ptr<IScalarExprNode> child2; //!< The scalar child node to which the operator is applied |
---|
| 146 | }; |
---|
| 147 | |
---|
| 148 | /*! |
---|
| 149 | * Expression node corresponding to a binary operation on two fields. |
---|
| 150 | */ |
---|
| 151 | class CFilterFieldFieldOpExprNode : public IFilterExprNode |
---|
| 152 | { |
---|
| 153 | public: |
---|
| 154 | /*! |
---|
| 155 | * Constructs an expression node corresponding to the specified binary operation |
---|
| 156 | * applied to the provided field child nodes. |
---|
| 157 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 158 | * is destroyed. |
---|
| 159 | * |
---|
| 160 | * \param opId the identifier of the operator |
---|
| 161 | * \param child1, child2 the field child nodes to which the operator is applied |
---|
| 162 | */ |
---|
| 163 | CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2); |
---|
| 164 | |
---|
| 165 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 166 | |
---|
| 167 | private: |
---|
| 168 | std::string opId; //!< The identifier of the field |
---|
| 169 | boost::scoped_ptr<IFilterExprNode> child1, child2; //!< The field child nodes to which the operator is applied |
---|
| 170 | }; |
---|
[1158] | 171 | |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | /*! |
---|
| 175 | * Expression node corresponding to a ternary operation on a scalar-scalar-field. |
---|
| 176 | */ |
---|
| 177 | class CFilterScalarScalarFieldOpExprNode : public IFilterExprNode |
---|
| 178 | { |
---|
| 179 | public: |
---|
| 180 | /*! |
---|
| 181 | * Constructs an expression node corresponding to the specified ternary operation |
---|
| 182 | * applied to the provided fields and scalars child nodes. |
---|
| 183 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 184 | * is destroyed. |
---|
| 185 | * |
---|
| 186 | * \param child1 the scalar child node to which the operator is applied |
---|
| 187 | * \param opId the identifier of the operator |
---|
| 188 | * \param child2 the scalar child node to which the operator is applied |
---|
| 189 | * \param child3 the field child node to which the operator is applied |
---|
| 190 | */ |
---|
| 191 | CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); |
---|
| 192 | |
---|
| 193 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 194 | |
---|
| 195 | private: |
---|
| 196 | std::string opId; //!< The identifier of the field |
---|
| 197 | boost::scoped_ptr<IScalarExprNode> child1; //!< The scalar child node to which the operator is applied |
---|
| 198 | boost::scoped_ptr<IScalarExprNode> child2; //!< The scalar child node to which the operator is applied |
---|
| 199 | boost::scoped_ptr<IFilterExprNode> child3; //!< The field child node to which the operator is applied |
---|
| 200 | }; |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | /*! |
---|
| 204 | * Expression node corresponding to a ternary operation on a scalar-field-scalar. |
---|
| 205 | */ |
---|
| 206 | class CFilterScalarFieldScalarOpExprNode : public IFilterExprNode |
---|
| 207 | { |
---|
| 208 | public: |
---|
| 209 | /*! |
---|
| 210 | * Constructs an expression node corresponding to the specified ternary operation |
---|
| 211 | * applied to the provided fields and scalars child nodes. |
---|
| 212 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 213 | * is destroyed. |
---|
| 214 | * |
---|
| 215 | * \param child1 the scalar child node to which the operator is applied |
---|
| 216 | * \param opId the identifier of the operator |
---|
| 217 | * \param child2 the field child node to which the operator is applied |
---|
| 218 | * \param child3 the scalar child node to which the operator is applied |
---|
| 219 | */ |
---|
| 220 | CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); |
---|
| 221 | |
---|
| 222 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 223 | |
---|
| 224 | private: |
---|
| 225 | std::string opId; //!< The identifier of the field |
---|
| 226 | boost::scoped_ptr<IScalarExprNode> child1; //!< The scalar child node to which the operator is applied |
---|
| 227 | boost::scoped_ptr<IFilterExprNode> child2; //!< The field child node to which the operator is applied |
---|
| 228 | boost::scoped_ptr<IScalarExprNode> child3; //!< The scalar child node to which the operator is applied |
---|
| 229 | }; |
---|
| 230 | |
---|
| 231 | |
---|
| 232 | /*! |
---|
| 233 | * Expression node corresponding to a ternary operation on a scalar-field-field. |
---|
| 234 | */ |
---|
| 235 | class CFilterScalarFieldFieldOpExprNode : public IFilterExprNode |
---|
| 236 | { |
---|
| 237 | public: |
---|
| 238 | /*! |
---|
| 239 | * Constructs an expression node corresponding to the specified ternary operation |
---|
| 240 | * applied to the provided fields and scalars child nodes. |
---|
| 241 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 242 | * is destroyed. |
---|
| 243 | * |
---|
| 244 | * \param child1 the scalar child node to which the operator is applied |
---|
| 245 | * \param opId the identifier of the operator |
---|
| 246 | * \param child2 the field child node to which the operator is applied |
---|
| 247 | * \param child3 the field child node to which the operator is applied |
---|
| 248 | */ |
---|
| 249 | CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); |
---|
| 250 | |
---|
| 251 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 252 | |
---|
| 253 | private: |
---|
| 254 | std::string opId; //!< The identifier of the field |
---|
| 255 | boost::scoped_ptr<IScalarExprNode> child1; //!< The scalar child node to which the operator is applied |
---|
| 256 | boost::scoped_ptr<IFilterExprNode> child2; //!< The field child node to which the operator is applied |
---|
| 257 | boost::scoped_ptr<IFilterExprNode> child3; //!< The field child node to which the operator is applied |
---|
| 258 | }; |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | /*! |
---|
| 263 | * Expression node corresponding to a ternary operation on a field-scalar-scalar. |
---|
| 264 | */ |
---|
| 265 | class CFilterFieldScalarScalarOpExprNode : public IFilterExprNode |
---|
| 266 | { |
---|
| 267 | public: |
---|
| 268 | /*! |
---|
| 269 | * Constructs an expression node corresponding to the specified ternary operation |
---|
| 270 | * applied to the provided fields and scalars child nodes. |
---|
| 271 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 272 | * is destroyed. |
---|
| 273 | * |
---|
| 274 | * \param child1 the field child node to which the operator is applied |
---|
| 275 | * \param opId the identifier of the operator |
---|
| 276 | * \param child2 the scalar child node to which the operator is applied |
---|
| 277 | * \param child3 the scalar child node to which the operator is applied |
---|
| 278 | */ |
---|
| 279 | CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3); |
---|
| 280 | |
---|
| 281 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 282 | |
---|
| 283 | private: |
---|
| 284 | std::string opId; //!< The identifier of the field |
---|
| 285 | boost::scoped_ptr<IFilterExprNode> child1; //!< The field child node to which the operator is applied |
---|
| 286 | boost::scoped_ptr<IScalarExprNode> child2; //!< The scalar child node to which the operator is applied |
---|
| 287 | boost::scoped_ptr<IScalarExprNode> child3; //!< The scalar child node to which the operator is applied |
---|
| 288 | }; |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | /*! |
---|
| 292 | * Expression node corresponding to a ternary operation on a field-scalar-field. |
---|
| 293 | */ |
---|
| 294 | class CFilterFieldScalarFieldOpExprNode : public IFilterExprNode |
---|
| 295 | { |
---|
| 296 | public: |
---|
| 297 | /*! |
---|
| 298 | * Constructs an expression node corresponding to the specified ternary operation |
---|
| 299 | * applied to the provided fields and scalars child nodes. |
---|
| 300 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 301 | * is destroyed. |
---|
| 302 | * |
---|
| 303 | * \param child1 the field child node to which the operator is applied |
---|
| 304 | * \param opId the identifier of the operator |
---|
| 305 | * \param child2 the scalar child node to which the operator is applied |
---|
| 306 | * \param child3 the field child node to which the operator is applied |
---|
| 307 | */ |
---|
| 308 | CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); |
---|
| 309 | |
---|
| 310 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 311 | |
---|
| 312 | private: |
---|
| 313 | std::string opId; //!< The identifier of the field |
---|
| 314 | boost::scoped_ptr<IFilterExprNode> child1; //!< The field child node to which the operator is applied |
---|
| 315 | boost::scoped_ptr<IScalarExprNode> child2; //!< The scalar child node to which the operator is applied |
---|
| 316 | boost::scoped_ptr<IFilterExprNode> child3; //!< The field child node to which the operator is applied |
---|
| 317 | }; |
---|
| 318 | |
---|
| 319 | /*! |
---|
| 320 | * Expression node corresponding to a ternary operation on a field-field-scalar. |
---|
| 321 | */ |
---|
| 322 | class CFilterFieldFieldScalarOpExprNode : public IFilterExprNode |
---|
| 323 | { |
---|
| 324 | public: |
---|
| 325 | /*! |
---|
| 326 | * Constructs an expression node corresponding to the specified ternary operation |
---|
| 327 | * applied to the provided fields and scalars child nodes. |
---|
| 328 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 329 | * is destroyed. |
---|
| 330 | * |
---|
| 331 | * \param child1 the field child node to which the operator is applied |
---|
| 332 | * \param opId the identifier of the operator |
---|
| 333 | * \param child2 the field child node to which the operator is applied |
---|
| 334 | * \param child3 the scalar child node to which the operator is applied |
---|
| 335 | */ |
---|
| 336 | CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); |
---|
| 337 | |
---|
| 338 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 339 | |
---|
| 340 | private: |
---|
| 341 | std::string opId; //!< The identifier of the field |
---|
| 342 | boost::scoped_ptr<IFilterExprNode> child1; //!< The field child node to which the operator is applied |
---|
| 343 | boost::scoped_ptr<IFilterExprNode> child2; //!< The field child node to which the operator is applied |
---|
| 344 | boost::scoped_ptr<IScalarExprNode> child3; //!< The scalar child node to which the operator is applied |
---|
| 345 | }; |
---|
| 346 | |
---|
| 347 | |
---|
| 348 | /*! |
---|
| 349 | * Expression node corresponding to a ternary operation on a field-field-field. |
---|
| 350 | */ |
---|
| 351 | class CFilterFieldFieldFieldOpExprNode : public IFilterExprNode |
---|
| 352 | { |
---|
| 353 | public: |
---|
| 354 | /*! |
---|
| 355 | * Constructs an expression node corresponding to the specified ternary operation |
---|
| 356 | * applied to the provided fields and scalars child nodes. |
---|
| 357 | * Note that the child nodes will be destroyed automatically when the parent node |
---|
| 358 | * is destroyed. |
---|
| 359 | * |
---|
| 360 | * \param child1 the field child node to which the operator is applied |
---|
| 361 | * \param opId the identifier of the operator |
---|
| 362 | * \param child2 the field child node to which the operator is applied |
---|
| 363 | * \param child3 the field child node to which the operator is applied |
---|
| 364 | */ |
---|
| 365 | CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); |
---|
| 366 | |
---|
| 367 | virtual boost::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; |
---|
| 368 | |
---|
| 369 | private: |
---|
| 370 | std::string opId; //!< The identifier of the field |
---|
| 371 | boost::scoped_ptr<IFilterExprNode> child1; //!< The field child node to which the operator is applied |
---|
| 372 | boost::scoped_ptr<IFilterExprNode> child2; //!< The field child node to which the operator is applied |
---|
| 373 | boost::scoped_ptr<IFilterExprNode> child3; //!< The field child node to which the operator is applied |
---|
| 374 | }; |
---|
| 375 | |
---|
| 376 | |
---|
| 377 | |
---|
[642] | 378 | } |
---|
| 379 | |
---|
| 380 | #endif // __XIOS_FILTER_EXPR_NODE_HPP__ |
---|