39 #ifndef DIAGNOSTICMESSAGEWRAPPER_HH
40 #define DIAGNOSTICMESSAGEWRAPPER_HH
50 #include "diagnostic_msgs/DiagnosticStatus.h"
66 class DiagnosticStatusWrapper :
public diagnostic_msgs::DiagnosticStatus
76 void summary(
unsigned char lvl,
const std::string s)
101 void mergeSummary(
unsigned char lvl,
const std::string s)
103 if ((lvl>0) && (level>0))
105 if (!message.empty())
109 else if (lvl > level)
123 void mergeSummary(
const diagnostic_msgs::DiagnosticStatus &src)
144 va_start(va, format);
145 if (vsnprintf(buff, 1000, format, va) >= 1000)
146 ROS_DEBUG(
"Really long string in DiagnosticStatusWrapper::addf, it was truncated.");
147 std::string value = std::string(buff);
163 void summaryf(
unsigned char lvl,
const char *format, ...)
167 va_start(va, format);
168 if (vsnprintf(buff, 1000, format, va) >= 1000)
169 ROS_DEBUG(
"Really long string in DiagnosticStatusWrapper::addf, it was truncated.");
170 std::string value = std::string(buff);
189 void summary(
const diagnostic_msgs::DiagnosticStatus &src)
191 summary(src.level, src.message);
204 void add(
const std::string &key,
const T &val)
206 std::stringstream ss;
208 std::string sval = ss.str();
220 void addf(
const std::string &key,
const char *format, ...);
235 inline void DiagnosticStatusWrapper::add<std::string>(
const std::string &key,
const std::string &s)
237 diagnostic_msgs::KeyValue ds;
240 values.push_back(ds);
245 inline void DiagnosticStatusWrapper::add<bool>(
const std::string &key,
const bool &b)
247 diagnostic_msgs::KeyValue ds;
249 ds.value = b ?
"True" :
"False";
251 values.push_back(ds);
260 va_start(va, format);
261 if (vsnprintf(buff, 1000, format, va) >= 1000)
262 ROS_DEBUG(
"Really long string in DiagnosticStatusWrapper::addf, it was truncated.");
263 std::string value = std::string(buff);