[642] | 1 | #include "filter_expr_node.hpp" |
---|
| 2 | #include "unary_arithmetic_filter.hpp" |
---|
| 3 | #include "binary_arithmetic_filter.hpp" |
---|
[1158] | 4 | #include "ternary_arithmetic_filter.hpp" |
---|
[642] | 5 | #include "field.hpp" |
---|
| 6 | |
---|
| 7 | namespace xios |
---|
| 8 | { |
---|
| 9 | CFilterFieldExprNode::CFilterFieldExprNode(const std::string& fieldId) |
---|
| 10 | : fieldId(fieldId) |
---|
| 11 | { /* Nothing to do */ } |
---|
| 12 | |
---|
[1575] | 13 | |
---|
[1704] | 14 | std::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[642] | 15 | { |
---|
[1542] | 16 | std::shared_ptr<COutputPin> outputPin; |
---|
[642] | 17 | |
---|
[1575] | 18 | if (fieldId == "this") outputPin = thisField.getSelfReference(gc); |
---|
| 19 | else |
---|
[642] | 20 | { |
---|
[1575] | 21 | string id ; |
---|
[642] | 22 | |
---|
[1575] | 23 | if (fieldId == "this_ref") |
---|
| 24 | { |
---|
| 25 | if (thisField.field_ref.isEmpty()) |
---|
| 26 | { |
---|
| 27 | ERROR("shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", |
---|
| 28 | << "field_ref attribute is empty."); |
---|
| 29 | } |
---|
| 30 | else id = thisField.field_ref ; |
---|
| 31 | } |
---|
| 32 | else id= fieldId ; |
---|
| 33 | |
---|
| 34 | if (CField::has(id)) |
---|
| 35 | { |
---|
| 36 | CField* field = CField::get(id); |
---|
| 37 | if (field == &thisField) |
---|
| 38 | ERROR("shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", |
---|
| 39 | << "The field " << id << " has an invalid reference to itself. " |
---|
| 40 | << "Use the keyword \"this\" if you want to reference the input data sent to this field."); |
---|
| 41 | |
---|
[1704] | 42 | // field->buildFilterGraph(gc, false); |
---|
| 43 | field->buildFilterGraph(gc, false, start_graph, end_graph); |
---|
[1575] | 44 | outputPin = field->getInstantDataFilter(); |
---|
| 45 | } |
---|
| 46 | else ERROR("boost::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", |
---|
| 47 | << "The field " << id << " does not exist."); |
---|
[642] | 48 | } |
---|
| 49 | return outputPin; |
---|
| 50 | } |
---|
| 51 | |
---|
[1575] | 52 | |
---|
[643] | 53 | CFilterTemporalFieldExprNode::CFilterTemporalFieldExprNode(const std::string& fieldId) |
---|
| 54 | : fieldId(fieldId) |
---|
| 55 | { /* Nothing to do */ } |
---|
| 56 | |
---|
[1575] | 57 | |
---|
[1704] | 58 | std::shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[643] | 59 | { |
---|
[1542] | 60 | std::shared_ptr<COutputPin> outputPin; |
---|
[1158] | 61 | |
---|
| 62 | if (fieldId == "this") |
---|
| 63 | outputPin = thisField.getSelfTemporalDataFilter(gc, thisField.freq_op.isEmpty() ? TimeStep : thisField.freq_op); |
---|
[1575] | 64 | else |
---|
[1158] | 65 | { |
---|
[1575] | 66 | string id ; |
---|
[1158] | 67 | |
---|
[1575] | 68 | if (fieldId == "this_ref") |
---|
| 69 | { |
---|
| 70 | if (thisField.field_ref.isEmpty()) |
---|
| 71 | { |
---|
| 72 | ERROR("shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", |
---|
| 73 | << "field_ref attribute is empty."); |
---|
| 74 | } |
---|
| 75 | else id = thisField.field_ref ; |
---|
| 76 | } |
---|
| 77 | else id = fieldId ; |
---|
| 78 | |
---|
| 79 | if (CField::has(id)) |
---|
| 80 | { |
---|
| 81 | CField* field = CField::get(id); |
---|
| 82 | if (field == &thisField) |
---|
| 83 | ERROR("shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", |
---|
| 84 | << "The field " << fieldId << " has an invalid reference to itself. " |
---|
| 85 | << "Use the keyword \"this\" if you want to reference the input data sent to this field."); |
---|
| 86 | |
---|
| 87 | field->buildFilterGraph(gc, false); |
---|
| 88 | outputPin = field->getTemporalDataFilter(gc, thisField.freq_op.isEmpty() ? TimeStep : thisField.freq_op); |
---|
| 89 | } |
---|
| 90 | else |
---|
| 91 | ERROR("shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const", |
---|
| 92 | << "The field " << fieldId << " does not exist."); |
---|
[1158] | 93 | } |
---|
| 94 | return outputPin; |
---|
[643] | 95 | } |
---|
| 96 | |
---|
[1575] | 97 | |
---|
[642] | 98 | CFilterUnaryOpExprNode::CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child) |
---|
| 99 | : opId(opId) |
---|
| 100 | , child(child) |
---|
| 101 | { |
---|
| 102 | if (!child) |
---|
| 103 | ERROR("CFilterUnaryOpExprNode::CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child)", |
---|
| 104 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 105 | } |
---|
| 106 | |
---|
[1704] | 107 | std::shared_ptr<COutputPin> CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[642] | 108 | { |
---|
[1704] | 109 | std::shared_ptr<COutputPin> ch = child->reduce(gc, thisField, start_graph, end_graph); |
---|
| 110 | |
---|
[1542] | 111 | std::shared_ptr<CUnaryArithmeticFilter> filter(new CUnaryArithmeticFilter(gc, opId)); |
---|
[1704] | 112 | ch->connectOutput(filter, 0); |
---|
| 113 | |
---|
| 114 | (filter->parent_filters).resize(1); |
---|
| 115 | (filter->parent_filters)[0] = ch; |
---|
| 116 | |
---|
| 117 | filter->tag = ch->tag; |
---|
| 118 | filter->start_graph = ch->start_graph; |
---|
| 119 | filter->end_graph = ch->end_graph; |
---|
| 120 | filter->field = &thisField; |
---|
| 121 | |
---|
| 122 | |
---|
[642] | 123 | return filter; |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | CFilterScalarFieldOpExprNode::CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2) |
---|
| 127 | : child1(child1) |
---|
| 128 | , opId(opId) |
---|
| 129 | , child2(child2) |
---|
| 130 | { |
---|
| 131 | if (!child1 || !child2) |
---|
| 132 | ERROR("CFilterScalarFieldOpExprNode::CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2)", |
---|
| 133 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 134 | } |
---|
| 135 | |
---|
[1704] | 136 | std::shared_ptr<COutputPin> CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[642] | 137 | { |
---|
[1704] | 138 | std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); |
---|
[1542] | 139 | std::shared_ptr<CScalarFieldArithmeticFilter> filter(new CScalarFieldArithmeticFilter(gc, opId, child1->reduce())); |
---|
[1704] | 140 | ch2->connectOutput(filter, 0); |
---|
| 141 | |
---|
| 142 | (filter->parent_filters).resize(1); |
---|
| 143 | (filter->parent_filters)[0] = ch2; |
---|
| 144 | |
---|
| 145 | filter->tag = ch2->tag; |
---|
| 146 | filter->start_graph = ch2->start_graph; |
---|
| 147 | filter->end_graph = ch2->end_graph; |
---|
| 148 | filter->field = &thisField; |
---|
| 149 | |
---|
[642] | 150 | return filter; |
---|
| 151 | } |
---|
| 152 | |
---|
| 153 | CFilterFieldScalarOpExprNode::CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2) |
---|
| 154 | : child1(child1) |
---|
| 155 | , opId(opId) |
---|
| 156 | , child2(child2) |
---|
| 157 | { |
---|
| 158 | if (!child1 || !child2) |
---|
| 159 | ERROR("CFilterFieldScalarOpExprNode::CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2)", |
---|
| 160 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 161 | } |
---|
| 162 | |
---|
[1704] | 163 | std::shared_ptr<COutputPin> CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[642] | 164 | { |
---|
[1704] | 165 | std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); |
---|
| 166 | |
---|
[1542] | 167 | std::shared_ptr<CFieldScalarArithmeticFilter> filter(new CFieldScalarArithmeticFilter(gc, opId, child2->reduce())); |
---|
[1704] | 168 | ch1->connectOutput(filter, 0); |
---|
| 169 | |
---|
| 170 | (filter->parent_filters).resize(1); |
---|
| 171 | (filter->parent_filters)[0] = ch1; |
---|
| 172 | |
---|
| 173 | filter->tag = ch1->tag; |
---|
| 174 | filter->start_graph = ch1->start_graph; |
---|
| 175 | filter->end_graph = ch1->end_graph; |
---|
| 176 | filter->field = &thisField; |
---|
| 177 | |
---|
[642] | 178 | return filter; |
---|
| 179 | } |
---|
| 180 | |
---|
| 181 | CFilterFieldFieldOpExprNode::CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2) |
---|
| 182 | : child1(child1) |
---|
| 183 | , opId(opId) |
---|
| 184 | , child2(child2) |
---|
| 185 | { |
---|
| 186 | if (!child1 || !child2) |
---|
| 187 | ERROR("CFilterFieldFieldOpExprNode::CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2)", |
---|
| 188 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 189 | } |
---|
| 190 | |
---|
[1704] | 191 | std::shared_ptr<COutputPin> CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[642] | 192 | { |
---|
[1704] | 193 | std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); |
---|
| 194 | std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); |
---|
| 195 | |
---|
[1542] | 196 | std::shared_ptr<CFieldFieldArithmeticFilter> filter(new CFieldFieldArithmeticFilter(gc, opId)); |
---|
[1704] | 197 | ch1->connectOutput(filter, 0); |
---|
| 198 | ch2->connectOutput(filter, 1); |
---|
| 199 | |
---|
| 200 | (filter->parent_filters).resize(2); |
---|
| 201 | (filter->parent_filters)[0] = ch1; |
---|
| 202 | (filter->parent_filters)[1] = ch2; |
---|
| 203 | |
---|
| 204 | filter->tag = (ch1->tag || ch2->tag); |
---|
| 205 | filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: -1); |
---|
| 206 | filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: -1); |
---|
| 207 | |
---|
| 208 | filter->field = &thisField; |
---|
| 209 | |
---|
| 210 | |
---|
[642] | 211 | return filter; |
---|
| 212 | } |
---|
[1158] | 213 | |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | CFilterScalarScalarFieldOpExprNode::CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3) |
---|
| 218 | : child1(child1) |
---|
| 219 | , opId(opId) |
---|
| 220 | , child2(child2) |
---|
| 221 | , child3(child3) |
---|
| 222 | { |
---|
| 223 | if (!child1 || !child2 || !child3) |
---|
| 224 | ERROR(" CFilterScalarScalarFieldOpExprNode::CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3)", |
---|
| 225 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 226 | } |
---|
| 227 | |
---|
[1704] | 228 | std::shared_ptr<COutputPin> CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[1158] | 229 | { |
---|
[1704] | 230 | std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); |
---|
| 231 | |
---|
[1542] | 232 | std::shared_ptr<CScalarScalarFieldArithmeticFilter> filter(new CScalarScalarFieldArithmeticFilter(gc, opId, child1->reduce(),child2->reduce())); |
---|
[1704] | 233 | ch3->connectOutput(filter, 0); |
---|
| 234 | |
---|
| 235 | (filter->parent_filters).resize(1); |
---|
| 236 | (filter->parent_filters)[0] = ch3; |
---|
| 237 | |
---|
| 238 | filter->tag = ch3->tag; |
---|
| 239 | filter->start_graph = ch3->start_graph; |
---|
| 240 | filter->end_graph = ch3->end_graph; |
---|
| 241 | filter->field = &thisField; |
---|
| 242 | |
---|
[1158] | 243 | return filter; |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | |
---|
| 247 | CFilterScalarFieldScalarOpExprNode::CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3) |
---|
| 248 | : child1(child1) |
---|
| 249 | , opId(opId) |
---|
| 250 | , child2(child2) |
---|
| 251 | , child3(child3) |
---|
| 252 | { |
---|
| 253 | if (!child1 || !child2 || !child3) |
---|
| 254 | ERROR(" CFilterScalarFieldScalarOpExprNode::CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3)", |
---|
| 255 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 256 | } |
---|
| 257 | |
---|
[1704] | 258 | std::shared_ptr<COutputPin> CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[1158] | 259 | { |
---|
[1704] | 260 | std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); |
---|
| 261 | |
---|
[1542] | 262 | std::shared_ptr<CScalarFieldScalarArithmeticFilter> filter(new CScalarFieldScalarArithmeticFilter(gc, opId, child1->reduce(),child3->reduce())); |
---|
[1704] | 263 | ch2->connectOutput(filter, 0); |
---|
| 264 | |
---|
| 265 | (filter->parent_filters).resize(1); |
---|
| 266 | (filter->parent_filters)[0] = ch2; |
---|
| 267 | |
---|
| 268 | filter->tag = ch2->tag; |
---|
| 269 | filter->start_graph = ch2->start_graph; |
---|
| 270 | filter->end_graph = ch2->end_graph; |
---|
| 271 | filter->field = &thisField; |
---|
| 272 | |
---|
[1158] | 273 | return filter; |
---|
| 274 | } |
---|
| 275 | |
---|
| 276 | |
---|
| 277 | CFilterScalarFieldFieldOpExprNode::CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3) |
---|
| 278 | : child1(child1) |
---|
| 279 | , opId(opId) |
---|
| 280 | , child2(child2) |
---|
| 281 | , child3(child3) |
---|
| 282 | { |
---|
| 283 | if (!child1 || !child2 || !child3) |
---|
| 284 | ERROR(" CFilterScalarFieldFieldOpExprNode::CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3)", |
---|
| 285 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 286 | } |
---|
| 287 | |
---|
[1704] | 288 | std::shared_ptr<COutputPin> CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[1158] | 289 | { |
---|
[1704] | 290 | std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); |
---|
| 291 | std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); |
---|
| 292 | |
---|
[1542] | 293 | std::shared_ptr<CScalarFieldFieldArithmeticFilter> filter(new CScalarFieldFieldArithmeticFilter(gc, opId, child1->reduce())); |
---|
[1704] | 294 | ch2->connectOutput(filter, 0); |
---|
| 295 | ch3->connectOutput(filter, 1); |
---|
| 296 | |
---|
| 297 | (filter->parent_filters).resize(2); |
---|
| 298 | (filter->parent_filters)[0] = ch2; |
---|
| 299 | (filter->parent_filters)[1] = ch3; |
---|
| 300 | |
---|
| 301 | filter->tag = (ch3->tag || ch2->tag); |
---|
| 302 | filter->start_graph = ch3->tag? ch3->start_graph : (ch2->tag? ch2->start_graph: -1); |
---|
| 303 | filter->end_graph = ch3->tag? ch3->end_graph : (ch2->tag? ch2->end_graph: -1); |
---|
| 304 | filter->field = &thisField; |
---|
| 305 | |
---|
[1158] | 306 | return filter; |
---|
| 307 | } |
---|
| 308 | |
---|
| 309 | |
---|
| 310 | |
---|
| 311 | CFilterFieldScalarScalarOpExprNode::CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3) |
---|
| 312 | : child1(child1) |
---|
| 313 | , opId(opId) |
---|
| 314 | , child2(child2) |
---|
| 315 | , child3(child3) |
---|
| 316 | { |
---|
| 317 | if (!child1 || !child2 || !child3) |
---|
| 318 | ERROR(" CFilterFieldScalarScalarOpExprNode::CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3)", |
---|
| 319 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 320 | } |
---|
| 321 | |
---|
[1704] | 322 | std::shared_ptr<COutputPin> CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[1158] | 323 | { |
---|
[1704] | 324 | std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); |
---|
| 325 | |
---|
[1542] | 326 | std::shared_ptr<CFieldScalarScalarArithmeticFilter> filter(new CFieldScalarScalarArithmeticFilter(gc, opId, child2->reduce(),child3->reduce())); |
---|
[1704] | 327 | ch1->connectOutput(filter, 0); |
---|
| 328 | |
---|
| 329 | (filter->parent_filters).resize(1); |
---|
| 330 | (filter->parent_filters)[0] = ch1; |
---|
| 331 | |
---|
| 332 | filter->tag = ch1->tag; |
---|
| 333 | filter->start_graph = ch1->start_graph; |
---|
| 334 | filter->end_graph = ch1->end_graph; |
---|
| 335 | filter->field = &thisField; |
---|
| 336 | |
---|
[1158] | 337 | return filter; |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | |
---|
| 341 | |
---|
| 342 | CFilterFieldScalarFieldOpExprNode::CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3) |
---|
| 343 | : child1(child1) |
---|
| 344 | , opId(opId) |
---|
| 345 | , child2(child2) |
---|
| 346 | , child3(child3) |
---|
| 347 | { |
---|
| 348 | if (!child1 || !child2 || !child3) |
---|
| 349 | ERROR(" CFilterFieldScalarFieldOpExprNode::CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3)", |
---|
| 350 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 351 | } |
---|
| 352 | |
---|
[1704] | 353 | std::shared_ptr<COutputPin> CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[1158] | 354 | { |
---|
[1704] | 355 | std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); |
---|
| 356 | std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); |
---|
| 357 | |
---|
[1542] | 358 | std::shared_ptr<CFieldScalarFieldArithmeticFilter> filter(new CFieldScalarFieldArithmeticFilter(gc, opId, child2->reduce())); |
---|
[1704] | 359 | ch1->connectOutput(filter, 0); |
---|
| 360 | ch3->connectOutput(filter, 1); |
---|
| 361 | |
---|
| 362 | (filter->parent_filters).resize(2); |
---|
| 363 | (filter->parent_filters)[0] = ch1; |
---|
| 364 | (filter->parent_filters)[1] = ch3; |
---|
| 365 | |
---|
| 366 | filter->tag = (ch3->tag || ch1->tag); |
---|
| 367 | filter->start_graph = ch3->tag? ch3->start_graph : (ch1->tag? ch1->start_graph: -1); |
---|
| 368 | filter->end_graph = ch3->tag? ch3->end_graph : (ch1->tag? ch1->end_graph: -1); |
---|
| 369 | filter->field = &thisField; |
---|
| 370 | |
---|
[1158] | 371 | return filter; |
---|
| 372 | } |
---|
| 373 | |
---|
| 374 | |
---|
| 375 | |
---|
| 376 | CFilterFieldFieldScalarOpExprNode::CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3) |
---|
| 377 | : child1(child1) |
---|
| 378 | , opId(opId) |
---|
| 379 | , child2(child2) |
---|
| 380 | , child3(child3) |
---|
| 381 | { |
---|
| 382 | if (!child1 || !child2 || !child3) |
---|
| 383 | ERROR(" CFilterFieldFieldScalarOpExprNode::CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3)", |
---|
| 384 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 385 | } |
---|
| 386 | |
---|
[1704] | 387 | std::shared_ptr<COutputPin> CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[1158] | 388 | { |
---|
[1704] | 389 | std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); |
---|
| 390 | std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); |
---|
| 391 | |
---|
[1542] | 392 | std::shared_ptr<CFieldFieldScalarArithmeticFilter> filter(new CFieldFieldScalarArithmeticFilter(gc, opId, child3->reduce())); |
---|
[1704] | 393 | ch1->connectOutput(filter, 0); |
---|
| 394 | ch2->connectOutput(filter, 1); |
---|
| 395 | |
---|
| 396 | (filter->parent_filters).resize(2); |
---|
| 397 | (filter->parent_filters)[0] = ch1; |
---|
| 398 | (filter->parent_filters)[1] = ch2; |
---|
| 399 | |
---|
| 400 | filter->tag = (ch2->tag || ch1->tag); |
---|
| 401 | filter->start_graph = ch2->tag? ch2->start_graph : (ch1->tag? ch1->start_graph: -1); |
---|
| 402 | filter->end_graph = ch2->tag? ch2->end_graph : (ch1->tag? ch1->end_graph: -1); |
---|
| 403 | filter->field = &thisField; |
---|
[1158] | 404 | return filter; |
---|
| 405 | } |
---|
| 406 | |
---|
| 407 | |
---|
| 408 | CFilterFieldFieldFieldOpExprNode::CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3) |
---|
| 409 | : child1(child1) |
---|
| 410 | , opId(opId) |
---|
| 411 | , child2(child2) |
---|
| 412 | , child3(child3) |
---|
| 413 | { |
---|
| 414 | if (!child1 || !child2 || !child3) |
---|
| 415 | ERROR(" CFilterFieldFieldFieldOpExprNode::CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3)", |
---|
| 416 | "Impossible to create the new expression node, an invalid child node was provided."); |
---|
| 417 | } |
---|
| 418 | |
---|
[1704] | 419 | std::shared_ptr<COutputPin> CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const |
---|
[1158] | 420 | { |
---|
[1704] | 421 | std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); |
---|
| 422 | std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); |
---|
| 423 | std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); |
---|
| 424 | |
---|
[1542] | 425 | std::shared_ptr<CFieldFieldFieldArithmeticFilter> filter(new CFieldFieldFieldArithmeticFilter(gc, opId)); |
---|
[1704] | 426 | ch1->connectOutput(filter, 0); |
---|
| 427 | ch2->connectOutput(filter, 1); |
---|
| 428 | ch3->connectOutput(filter, 2); |
---|
| 429 | |
---|
| 430 | (filter->parent_filters).resize(3); |
---|
| 431 | (filter->parent_filters)[0] = ch1; |
---|
| 432 | (filter->parent_filters)[1] = ch2; |
---|
| 433 | (filter->parent_filters)[2] = ch3; |
---|
| 434 | |
---|
| 435 | |
---|
| 436 | filter->tag = (ch1->tag || ch1->tag || ch3->tag); |
---|
| 437 | filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: (ch3->tag? ch3->start_graph: -1)); |
---|
| 438 | filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: (ch3->tag? ch3->end_graph: -1)); |
---|
| 439 | filter->field = &thisField; |
---|
| 440 | |
---|
| 441 | |
---|
[1158] | 442 | return filter; |
---|
| 443 | } |
---|
| 444 | |
---|
[642] | 445 | } |
---|