39 #ifndef DIAGNOSTICMESSAGEWRAPPER_HH 40 #define DIAGNOSTICMESSAGEWRAPPER_HH 50 #include "diagnostic_msgs/DiagnosticStatus.h" 76 void summary(
unsigned char lvl,
const std::string s)
103 if ((lvl>0) && (level>0))
105 if (!message.empty())
109 else if (lvl > level)
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);
void mergeSummary(const diagnostic_msgs::DiagnosticStatus &src)
Version of mergeSummary that merges in the summary from another DiagnosticStatus. ...
void summary(unsigned char lvl, const std::string s)
Fills out the level and message fields of the DiagnosticStatus.
void addf(const std::string &key, const char *format,...)
Add a key-value pair using a format string.
void summaryf(unsigned char lvl, const char *format,...)
Formatted version of summary.
void clearSummary()
clears the summary, setting the level to zero and the message to "".
void mergeSummary(unsigned char lvl, const std::string s)
Merges a level and message with the existing ones.
void clear()
Clear the key-value pairs.
void mergeSummaryf(unsigned char lvl, const char *format,...)
Formatted version of mergeSummary.
void add(const std::string &key, const T &val)
Add a key-value pair.
void summary(const diagnostic_msgs::DiagnosticStatus &src)
copies the summary from a DiagnosticStatus message
Wrapper for the diagnostic_msgs::DiagnosticStatus message that makes it easier to update...