File tree 1 file changed +21
-13
lines changed
1 file changed +21
-13
lines changed Original file line number Diff line number Diff line change 1
-
1
+ /*
2
+ * Copyright (C) 2019 TU Dresden
3
+ * All rights reserved.
4
+ *
5
+ * Authors:
6
+ * Tassilo Tanneberger
7
+ */
2
8
3
9
#include " reactor-cpp/transaction.hh"
4
10
#include " reactor-cpp/environment.hh"
@@ -9,27 +15,29 @@ reactor::Transaction::Transaction(Reactor* parent)
9
15
, parent_(parent) {}
10
16
11
17
auto reactor::Transaction::execute (bool recalculate) -> MutationResult {
12
-
13
18
this ->environment_ ->start_mutation ();
19
+
20
+ std::size_t index = 0 ;
14
21
for (const auto & mutation : mutations_) {
15
- mutation->run ();
16
- }
22
+ if (mutation->run () != Success) {
23
+ break ;
24
+ }
17
25
18
- if (recalculate) {
19
- // parent_->remove_dependency_graph();
20
- // this->environment_->clear_dependency_graph();
21
- // this->environment_->build_dependency_graph(this->parent_);
26
+ index ++;
27
+ }
22
28
23
- // this->environment_
24
- // for (auto* reactor : this->environment_->top_level_reactors()) {
25
- // this->environment_->build_dependency_graph(reactor);
26
- // }
29
+ if (index != mutations_.size ()) {
30
+ for (std::size_t i = 0 ; i < index ; i++) {
31
+ mutations_[index - i]->rollback ();
32
+ }
33
+ }
27
34
35
+ if (recalculate) {
28
36
this ->environment_ ->calculate_indexes ();
29
37
}
30
38
31
39
this ->environment_ ->stop_mutation ();
32
- this -> environment_ -> export_dependency_graph ( " ./test.dot " );
40
+
33
41
mutations_.clear ();
34
42
return Success;
35
43
}
You can’t perform that action at this time.
0 commit comments