Skip to content

Commit a5c9b68

Browse files
committed
incorporate fixes
1 parent 018793e commit a5c9b68

File tree

1 file changed

+8
-7
lines changed
  • include/maxplus/base/fsm

1 file changed

+8
-7
lines changed

include/maxplus/base/fsm/fsm.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class DepthFirstSearch {
266266
};
267267

268268
// access state
269-
StateRef getState() { return this->state; }
269+
StateRef getState() const { return this->state; }
270270

271271
SetOfEdgeRefs::CIter getIter() { return this->iter; }
272272

@@ -471,7 +471,7 @@ class DetectCycle : public DepthFirstSearch {
471471
void onSimpleCycle(DfsStack &stack) override {
472472
if (!this->hasCycle) {
473473
if (this->cycle != nullptr) {
474-
for (auto si : stack) {
474+
for (const auto& si : stack) {
475475
this->cycle->push_back(si.getState());
476476
}
477477
}
@@ -801,8 +801,8 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
801801
};
802802

803803
void setEdgeLabel(const EdgeRef<StateLabelType, EdgeLabelType> &e, const EdgeLabelType &l) {
804-
auto ee = dynamic_cast<Edge<StateLabelType, EdgeLabelType>*>(
805-
(*this->edges.find(e->getId())).second.get());
804+
const auto& p = (*this->edges.find(e->getId())).second;
805+
auto ee = dynamic_cast<Edge<StateLabelType, EdgeLabelType>*>(p.get());
806806
ee->setLabel(l);
807807
}
808808

@@ -856,7 +856,7 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
856856
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>> determinizeEdgeLabels() {
857857
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>> result =
858858
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>>(
859-
dynamic_cast<FiniteStateMachine<StateLabelType, EdgeLabelType>*>(this->newInstance().release()));
859+
dynamic_cast<FiniteStateMachine<StateLabelType, EdgeLabelType> *>(this->newInstance().release()));
860860

861861
// maintain map of sets of states to the corresponding new states.
862862
std::map<const Abstract::SetOfStateRefs, const State<StateLabelType, EdgeLabelType> *>
@@ -1058,9 +1058,10 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
10581058
eqClasses = std::move(newEqClasses);
10591059
} while (changed);
10601060

1061+
auto x = this->newInstance().release();
1062+
auto y = static_cast<FiniteStateMachine<StateLabelType, EdgeLabelType>*>(x);
10611063
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>> result =
1062-
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>>(
1063-
dynamic_cast<FiniteStateMachine<StateLabelType, EdgeLabelType>*>(this->newInstance().release()));
1064+
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>>(y);
10641065

10651066
// make a state for every equivalence class
10661067
std::map<Abstract::SetOfStateRefs *, StateRef<StateLabelType, EdgeLabelType>> newStateMap;

0 commit comments

Comments
 (0)