@@ -49,7 +49,7 @@ using operators::Operator;
49
49
using actions::Action;
50
50
using variables::Variable;
51
51
using actions::transformations::None;
52
-
52
+ using actions::transformations::Transformation;
53
53
54
54
Rule::Rule (const std::string &marker)
55
55
: m_theDisruptiveAction(nullptr ),
@@ -326,11 +326,11 @@ bool Rule::executeOperatorAt(Transaction *trans, const std::string &key,
326
326
}
327
327
328
328
329
- inline void Rule::executeTransformation (actions::Action *a,
329
+ inline void Rule::executeTransformation (
330
+ actions::transformations::Transformation *a,
330
331
std::shared_ptr<std::string> *value,
331
332
Transaction *trans,
332
- std::list<std::pair<std::shared_ptr<std::string>,
333
- std::shared_ptr<std::string>>> *ret,
333
+ TransformationResults *ret,
334
334
std::string *path,
335
335
int *nth) const {
336
336
@@ -359,15 +359,11 @@ inline void Rule::executeTransformation(actions::Action *a,
359
359
}
360
360
361
361
362
- std::list<std::pair<std::shared_ptr<std::string>,
363
- std::shared_ptr<std::string>>>
364
- Rule::executeDefaultTransformations (
365
- Transaction *trans, const std::string &in) {
362
+ void Rule::executeTransformations (
363
+ Transaction *trans, const std::string &in, TransformationResults &ret) {
366
364
int none = 0 ;
367
365
int transformations = 0 ;
368
366
std::string path (" " );
369
- std::list<std::pair<std::shared_ptr<std::string>,
370
- std::shared_ptr<std::string>>> ret;
371
367
std::shared_ptr<std::string> value =
372
368
std::shared_ptr<std::string>(new std::string (in));
373
369
@@ -394,14 +390,17 @@ std::list<std::pair<std::shared_ptr<std::string>,
394
390
continue ;
395
391
}
396
392
397
- executeTransformation (a.get (), &value, trans, &ret, &path,
393
+ // FIXME: here the object needs to be a transformation already.
394
+ Transformation *t = dynamic_cast <Transformation *>(a.get ());
395
+ executeTransformation (t, &value, trans, &ret, &path,
398
396
&transformations);
399
397
}
400
398
}
401
399
402
400
for (Action *a : this ->m_actionsRuntimePre ) {
403
401
if (none == 0 ) {
404
- executeTransformation (a, &value, trans, &ret, &path,
402
+ Transformation *t = dynamic_cast <Transformation *>(a);
403
+ executeTransformation (t, &value, trans, &ret, &path,
405
404
&transformations);
406
405
}
407
406
if (a->m_isNone ) {
@@ -427,7 +426,8 @@ std::list<std::pair<std::shared_ptr<std::string>,
427
426
}
428
427
actions::Action *a = dynamic_cast <actions::Action*>(b.second .get ());
429
428
if (none == 0 ) {
430
- executeTransformation (a, &value, trans, &ret, &path,
429
+ Transformation *t = dynamic_cast <Transformation *>(a);
430
+ executeTransformation (t, &value, trans, &ret, &path,
431
431
&transformations);
432
432
}
433
433
if (a->m_isNone ) {
@@ -446,8 +446,6 @@ std::list<std::pair<std::shared_ptr<std::string>,
446
446
std::shared_ptr<std::string>(new std::string (*value)),
447
447
std::shared_ptr<std::string>(new std::string (path))));
448
448
}
449
-
450
- return ret;
451
449
}
452
450
453
451
@@ -711,10 +709,9 @@ bool Rule::evaluate(Transaction *trans,
711
709
continue ;
712
710
}
713
711
714
- std::list<std::pair<std::shared_ptr<std::string>,
715
- std::shared_ptr<std::string>>> values;
712
+ TransformationResults values;
716
713
717
- values = executeDefaultTransformations (trans, value);
714
+ executeTransformations (trans, value, values );
718
715
719
716
for (const auto &valueTemp : values) {
720
717
bool ret;
0 commit comments