2828#include < utility>
2929#include < vector>
3030
31- using std::endl;
3231using std::mutex;
3332using std::string;
3433using std::make_pair;
@@ -223,6 +222,7 @@ ModeInference::infer_system(const string & part)
223222 // error-processing?
224223 if (stateAndMode.state == State::TRANSITION_STATE_ERRORPROCESSING) {
225224 this ->systems_ [part] = StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
225+
226226 return StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
227227 }
228228
@@ -236,6 +236,7 @@ ModeInference::infer_system(const string & part)
236236 " ', inference failed." );
237237 }
238238 }
239+
239240 return StateAndMode (state, " " );
240241 }
241242
@@ -245,15 +246,16 @@ ModeInference::infer_system(const string & part)
245246 string targetMode = stateAndModeTarget->second .mode ;
246247 if (targetState == State::PRIMARY_STATE_INACTIVE) {
247248 // target: inactive
248- for (auto part : default_mode->get_parts ()) {
249- auto stateAndMode = this ->get_or_infer (part );
249+ for (auto partpart : default_mode->get_parts ()) {
250+ auto stateAndMode = this ->get_or_infer (partpart );
250251
251252 if (stateAndMode.state == State::TRANSITION_STATE_ERRORPROCESSING) {
252253 // Note: If current entity was in an active mode that allowed a part to
253254 // be in error-processing (by dont-care) and the current entity is requested
254255 // to switch to inactive, then the actual state of the current entity will
255256 // go to error-processing until the mentioned part recovers.
256257 this ->systems_ [part] = StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
258+
257259 return StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
258260 }
259261
@@ -262,9 +264,11 @@ ModeInference::infer_system(const string & part)
262264 stateAndMode.state != State::PRIMARY_STATE_UNCONFIGURED)
263265 {
264266 this ->systems_ [part] = StateAndMode (State::TRANSITION_STATE_DEACTIVATING, " " );
267+
265268 return StateAndMode (State::TRANSITION_STATE_DEACTIVATING, " " );
266269 }
267270 }
271+
268272 return StateAndMode (State::PRIMARY_STATE_INACTIVE, " " );
269273 } else if (targetState == State::PRIMARY_STATE_ACTIVE) {
270274 ModeConstPtr mode;
@@ -281,6 +285,7 @@ ModeInference::infer_system(const string & part)
281285 // TODO(anordman): consider DONT-CARE
282286 if (stateAndMode.state == State::TRANSITION_STATE_ERRORPROCESSING) {
283287 this ->systems_ [part] = StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
288+
284289 return StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
285290 }
286291
@@ -302,6 +307,7 @@ ModeInference::infer_system(const string & part)
302307 if (inTargetMode) {
303308 // Target state and target mode reached, all good!
304309 this ->systems_ [part] = StateAndMode (State::PRIMARY_STATE_ACTIVE, targetMode);
310+
305311 return StateAndMode (State::PRIMARY_STATE_ACTIVE, targetMode);
306312 }
307313 }
@@ -316,6 +322,7 @@ ModeInference::infer_system(const string & part)
316322 // TODO(anordman): consider DONT-CARE
317323 if (stateAndMode.state == State::TRANSITION_STATE_ERRORPROCESSING) {
318324 this ->systems_ [part] = StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
325+
319326 return StateAndMode (State::TRANSITION_STATE_ERRORPROCESSING, " " );
320327 }
321328
@@ -331,11 +338,13 @@ ModeInference::infer_system(const string & part)
331338 if (foundMode) {
332339 // We are in a non-target mode, this means we are still activating
333340 this ->systems_ [part] = StateAndMode (State::TRANSITION_STATE_ACTIVATING, mode.first );
341+
334342 return StateAndMode (State::TRANSITION_STATE_ACTIVATING, mode.first );
335343 }
336344 }
337345
338346 this ->systems_ [part] = StateAndMode (State::TRANSITION_STATE_ACTIVATING, " " );
347+
339348 return StateAndMode (State::TRANSITION_STATE_ACTIVATING, " " );
340349 }
341350
@@ -616,8 +625,8 @@ const std::vector<string>
616625ModeInference::get_nodes () const
617626{
618627 std::vector<string> result;
619- for (auto node : this ->nodes_ ) {
620- result.push_back (node .first );
628+ for (auto part : this ->nodes_ ) {
629+ result.push_back (part .first );
621630 }
622631 return result;
623632}
@@ -626,8 +635,8 @@ const std::vector<string>
626635ModeInference::get_systems () const
627636{
628637 std::vector<string> result;
629- for (auto node : this ->systems_ ) {
630- result.push_back (node .first );
638+ for (auto part : this ->systems_ ) {
639+ result.push_back (part .first );
631640 }
632641 return result;
633642}
0 commit comments