1414// limitations under the License.
1515#include " system_modes/mode_impl.hpp"
1616
17+ #include < map>
1718#include < string>
1819#include < vector>
1920#include < utility>
2223#include < lifecycle_msgs/msg/state.hpp>
2324#include < lifecycle_msgs/msg/transition.hpp>
2425
26+ using std::map;
2527using std::pair;
2628using std::mutex;
2729using std::string;
@@ -117,9 +119,9 @@ ModeImpl::add_parameters(const vector<Parameter> & parameters)
117119void
118120ModeImpl::set_parameter (const Parameter & parameter)
119121{
120- std:: string param_name = parameter.get_name ();
122+ string param_name = parameter.get_name ();
121123 std::size_t foundr = parameter.get_name ().rfind (" ros__parameters" );
122- if (foundr != std:: string::npos) {
124+ if (foundr != string::npos) {
123125 param_name = parameter.get_name ().substr (foundr + strlen (" ros__parameters" ) + 1 );
124126 }
125127
@@ -142,15 +144,15 @@ ModeImpl::set_parameters(const vector<Parameter> & parameters)
142144
143145void
144146ModeImpl::add_part_mode (
145- const std:: string & part,
147+ const string & part,
146148 const StateAndMode stateAndMode)
147149{
148150 this ->part_modes_ [part] = StateAndMode (stateAndMode.state , stateAndMode.mode );
149151}
150152
151153void
152154ModeImpl::set_part_mode (
153- const std:: string & part,
155+ const string & part,
154156 const StateAndMode stateAndMode)
155157{
156158 if (this ->part_modes_ .find (part) == this ->part_modes_ .end ()) {
@@ -162,7 +164,7 @@ ModeImpl::set_part_mode(
162164 this ->add_part_mode (part, stateAndMode);
163165}
164166
165- const std:: vector<std:: string>
167+ const vector<string>
166168ModeImpl::get_parts () const
167169{
168170 vector<string> results;
@@ -173,19 +175,19 @@ ModeImpl::get_parts() const
173175}
174176
175177const StateAndMode
176- ModeImpl::get_part_mode (const std:: string & part) const
178+ ModeImpl::get_part_mode (const string & part) const
177179{
178180 if (this ->part_modes_ .count (part)) {
179181 return this ->part_modes_ .at (part);
180182 } else {
181- throw std:: out_of_range (
183+ throw out_of_range (
182184 " Can't receive modes for part '" + part +
183185 " ', part not specified." );
184186 }
185187}
186188
187189// TODO(anordman): Can we get this from the rcl default state machine?
188- static const std:: map<unsigned int , string> STATES_ = {
190+ static const map<unsigned int , string> STATES_ = {
189191 {State::PRIMARY_STATE_UNKNOWN , " unknown" },
190192 {State::PRIMARY_STATE_UNCONFIGURED , " unconfigured" },
191193 {State::PRIMARY_STATE_INACTIVE , " inactive" },
@@ -199,7 +201,7 @@ static const std::map<unsigned int, string> STATES_ = {
199201 {State::TRANSITION_STATE_ERRORPROCESSING , " errorprocessing" }
200202};
201203
202- static const std:: map<unsigned int , string> TRANSITIONS_ = {
204+ static const map<unsigned int , string> TRANSITIONS_ = {
203205 {Transition::TRANSITION_CREATE , " create" },
204206 {Transition::TRANSITION_CONFIGURE , " configure" },
205207 {Transition::TRANSITION_CLEANUP , " cleanup" },
@@ -210,7 +212,7 @@ static const std::map<unsigned int, string> TRANSITIONS_ = {
210212 {Transition::TRANSITION_DESTROY , " destroy" }
211213};
212214
213- static const std:: map<unsigned int , unsigned int > GOAL_STATES_ = {
215+ static const map<unsigned int , unsigned int > GOAL_STATES_ = {
214216 {Transition::TRANSITION_CREATE , State::PRIMARY_STATE_UNCONFIGURED },
215217 {Transition::TRANSITION_CONFIGURE , State::PRIMARY_STATE_INACTIVE },
216218 {Transition::TRANSITION_CLEANUP , State::PRIMARY_STATE_UNCONFIGURED },
@@ -220,7 +222,7 @@ static const std::map<unsigned int, unsigned int> GOAL_STATES_ = {
220222 {Transition::TRANSITION_ACTIVE_SHUTDOWN , State::PRIMARY_STATE_FINALIZED }
221223};
222224
223- const std:: string
225+ const string
224226state_label_ (unsigned int state_id)
225227{
226228 try {
@@ -231,7 +233,7 @@ state_label_(unsigned int state_id)
231233}
232234
233235unsigned int
234- state_id_ (const std:: string & state_label)
236+ state_id_ (const string & state_label)
235237{
236238 for (auto id : STATES_ ) {
237239 if (id.second .compare (state_label) == 0 ) {
@@ -241,7 +243,7 @@ state_id_(const std::string & state_label)
241243 return 0 ;
242244}
243245
244- const std:: string
246+ const string
245247transition_label_ (unsigned int transition_id)
246248{
247249 try {
@@ -252,7 +254,7 @@ transition_label_(unsigned int transition_id)
252254}
253255
254256unsigned int
255- transition_id_ (const std:: string & transition_label)
257+ transition_id_ (const string & transition_label)
256258{
257259 for (auto id : TRANSITIONS_ ) {
258260 if (id.second .compare (transition_label) == 0 ) {
0 commit comments