Skip to content

Commit ed91b42

Browse files
committed
some cleanup
1 parent 4c58d9b commit ed91b42

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/graph/mpautomaton.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ CDouble MaxPlusAutomatonWithRewards::calculateMCR() {
2222

2323
CId eId = 0;
2424
for (const auto &s : this->getStates()) {
25-
for (auto *e : (s.second)->getOutgoingEdges()) {
26-
auto *mpae = dynamic_cast<MPAREdgeRef>(e);
25+
for (const auto *e : (s.second)->getOutgoingEdges()) {
26+
const auto *mpae = dynamic_cast<MPAREdgeRef>(e);
2727
g.addEdge(eId++,
2828
*nodeMap[(mpae->getSource())],
2929
*nodeMap[(mpae->getDestination())],
@@ -55,8 +55,8 @@ CDouble MaxPlusAutomatonWithRewards::calculateMCRAndCycle(
5555
std::map<const MCMedge *, MPAREdgeRef> edgeMap;
5656

5757
for (const auto &s : this->getStates()) {
58-
for (auto *e : (s.second)->getOutgoingEdges()) {
59-
auto *mpae = dynamic_cast<MPAREdgeRef>(e);
58+
for (const auto *e : (s.second)->getOutgoingEdges()) {
59+
const auto *mpae = dynamic_cast<MPAREdgeRef>(e);
6060
g.addEdge(eId++,
6161
*nodeMap[mpae->getSource()],
6262
*nodeMap[mpae->getDestination()],

src/graph/smpls.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ void EdgeLabeledModeFSM::removeDanglingStates() {
3333
ELSSetOfStateRefs statesToBeRemoved;
3434

3535
// const ELSSetOfStates& elsStates = this->getStates();
36-
auto &elsEdges = dynamic_cast<const ELSSetOfEdges &>(this->getEdges());
36+
const auto &elsEdges = dynamic_cast<const ELSSetOfEdges &>(this->getEdges());
3737

3838
/*go through all edges and find all edges that end in
3939
dangling states. Also store dangling states.*/
4040
for (const auto &it : elsEdges) {
4141

42-
auto e = dynamic_cast<ELSEdgeRef>(&(*it.second));
42+
const auto *e = dynamic_cast<ELSEdgeRef>(&(*it.second));
4343
const auto &s = dynamic_cast<ELSStateRef>(e->getDestination());
4444
const auto &oEdges = dynamic_cast<const ELSSetOfEdges &>(s->getOutgoingEdges());
4545
if (oEdges.empty()) {
@@ -77,8 +77,8 @@ void EdgeLabeledModeFSM::removeDanglingStates() {
7777
dangling states. Also store dangling states.*/
7878
for (const auto &it : elsEdges2) {
7979

80-
auto e = dynamic_cast<ELSEdgeRef>(&(*(it.second)));
81-
const auto s = dynamic_cast<ELSStateRef>(e->getDestination());
80+
const auto *e = dynamic_cast<ELSEdgeRef>(&(*(it.second)));
81+
const auto *const s = dynamic_cast<ELSStateRef>(e->getDestination());
8282
const auto &oEdges = dynamic_cast<const ELSSetOfEdges &>(s->getOutgoingEdges());
8383
if (oEdges.empty()) {
8484
edgesToBeRemoved.insert(e);
@@ -188,7 +188,7 @@ std::shared_ptr<MaxPlusAutomaton> SMPLS::convertToMaxPlusAutomaton() const {
188188
auto &q1 = dynamic_cast<ELSState &>(*(q.second));
189189
CId q1Id = q1.getLabel();
190190

191-
std::map<int, MPAStateRef> q1StateMap;
191+
std::map<size_t, MPAStateRef> q1StateMap;
192192

193193
// for every outgoing edge of the state
194194
const auto &t = dynamic_cast<const ELSSetOfEdgeRefs &>(q1.getOutgoingEdges());
@@ -251,7 +251,7 @@ void SMPLSwithEvents::saveDeterminizedIOAtoFile(const MPString &file) {
251251

252252
MPString errMsg = "";
253253
auto i = I.begin();
254-
auto &s = dynamic_cast<const IOAState &>(*(*i));
254+
const auto &s = dynamic_cast<const IOAState &>(*(*i));
255255
i++;
256256
// we remove the rest of the initial states since only one is allowed
257257
for (; i != I.end();) {
@@ -310,14 +310,14 @@ std::shared_ptr<MaxPlusAutomaton> SMPLSwithEvents::convertToMaxPlusAutomaton() {
310310

311311
const auto &I2 = this->ioa->getInitialStates();
312312
for (const auto &i : I2) {
313-
auto s = dynamic_cast<IOAStateRef>(i);
313+
const auto *s = dynamic_cast<IOAStateRef>(i);
314314
prepareMatrices(*s, eventList, visitedEdges);
315-
auto sr = this->elsFSM.getStateLabeled(s->getLabel());
315+
const auto *sr = this->elsFSM.getStateLabeled(s->getLabel());
316316
this->elsFSM.addInitialState(*sr);
317317
}
318318
const auto &I3 = this->ioa->getFinalStates();
319319
for (const auto &i : I3) {
320-
auto s = dynamic_cast<IOAStateRef>(i);
320+
const auto *s = dynamic_cast<IOAStateRef>(i);
321321
this->elsFSM.addFinalState(*this->elsFSM.getStateLabeled(s->getLabel()));
322322
}
323323
return SMPLS::convertToMaxPlusAutomaton();
@@ -631,7 +631,7 @@ void SMPLSwithEvents::isConsistentUtil(const IOAState &s,
631631
}
632632
}
633633
}
634-
const auto s2 = dynamic_cast<IOAStateRef>(e->getDestination());
634+
const auto *const s2 = dynamic_cast<IOAStateRef>(e->getDestination());
635635

636636
isConsistentUtil(*s2, eList, finalStates, errMsg, visited);
637637
}
@@ -666,7 +666,7 @@ void SMPLSwithEvents::determinizeUtil(const IOAState &s,
666666
const auto *e = dynamic_cast<const IOAEdge *>(*i);
667667
InputAction input = e->getLabel().first;
668668
if (input.empty()) {
669-
const auto s2 = dynamic_cast<IOAStateRef>(e->getDestination());
669+
const auto *const s2 = dynamic_cast<IOAStateRef>(e->getDestination());
670670
outfile << s.stateLabel << "-," << e->getLabel().second << "->" << s2->stateLabel;
671671
ioa->removeEdge(*e);
672672

@@ -702,7 +702,7 @@ void SMPLSwithEvents::determinizeUtil(const IOAState &s,
702702
} else {
703703
// only allow edges with the outcome of the same event
704704
if (this->findEventByOutcome(input) == ev) {
705-
const auto s2 = dynamic_cast<IOAStateRef>(e->getDestination());
705+
const auto *const s2 = dynamic_cast<IOAStateRef>(e->getDestination());
706706
outfile << s.stateLabel << "-" << e->getLabel().first << ","
707707
<< e->getLabel().second << "->" << s2->stateLabel;
708708

0 commit comments

Comments
 (0)