39 #ifndef DIAGNOSTIC_STATUS_ITEM_H
40 #define DIAGNOSTIC_STATUS_ITEM_H
46 #include <diagnostic_msgs/DiagnosticStatus.h>
47 #include <diagnostic_msgs/KeyValue.h>
48 #include <boost/shared_ptr.hpp>
59 std::string::size_type pos = 0;
60 while ((pos = output_name.find(slash_str, pos)) != std::string::npos)
62 output_name.replace(pos, slash_str.size(),
" ");
74 Level_OK = diagnostic_msgs::DiagnosticStatus::OK,
75 Level_Warn = diagnostic_msgs::DiagnosticStatus::WARN,
76 Level_Error = diagnostic_msgs::DiagnosticStatus::ERROR,
85 if (val == diagnostic_msgs::DiagnosticStatus::OK)
87 if (val == diagnostic_msgs::DiagnosticStatus::WARN)
89 if (val == diagnostic_msgs::DiagnosticStatus::ERROR)
94 ROS_ERROR(
"Attempting to convert %d into DiagnosticLevel. Values are: {0: OK, 1: Warning, 2: Error, 3: Stale}", val);
103 if (val == diagnostic_msgs::DiagnosticStatus::OK)
105 if (val == diagnostic_msgs::DiagnosticStatus::WARN)
107 if (val == diagnostic_msgs::DiagnosticStatus::ERROR)
112 ROS_ERROR(
"Attempting to convert diagnostic level %d into string. Values are: {0: \"OK\", 1: \"Warning\", 2: \"Error\", 3: \"Stale\"}", val);
131 if (chaff.size() == 0)
136 std::size_t last_slash = output_name.rfind(
"/");
139 if (output_name.find(chaff) == last_slash + 1)
140 output_name.replace(last_slash + 1, chaff.size(),
"");
142 if (output_name.find(
":", last_slash) == last_slash + 1)
143 output_name= start_of_name + output_name.substr(last_slash + 2);
145 while (output_name.find(
" ", last_slash) == last_slash + 1)
146 output_name = start_of_name + output_name.substr(last_slash + 2);
178 bool update(
const diagnostic_msgs::DiagnosticStatus *
status);
225 for (
unsigned int i = 0; i <
values_.size(); ++i)
241 for (
unsigned int i = 0; i <
values_.size(); ++i)
258 std::vector<diagnostic_msgs::KeyValue>
values_;
263 #endif //DIAGNOSTIC_STATUS_ITEM_H