Wrapper for the diagnostic_msgs::DiagnosticStatus message that makes it easier to update. More...
#include <DiagnosticStatusWrapper.h>
Public Member Functions | |
template<> | |
void | add (const std::string &key, const bool &b) |
For bool, diagnostic value is "True" or "False". More... | |
template<class T > | |
void | add (const std::string &key, const T &val) |
Add a key-value pair. More... | |
void | addf (const std::string &key, const char *format,...) |
Add a key-value pair using a format string. More... | |
void | clear () |
Clear the key-value pairs. More... | |
void | clearSummary () |
clears the summary, setting the level to zero and the message to "". More... | |
void | mergeSummary (const diagnostic_msgs::DiagnosticStatus &src) |
Version of mergeSummary that merges in the summary from another DiagnosticStatus. More... | |
void | mergeSummary (unsigned char lvl, const std::string s) |
Merges a level and message with the existing ones. More... | |
void | mergeSummaryf (unsigned char lvl, const char *format,...) |
Formatted version of mergeSummary. More... | |
void | summary (const diagnostic_msgs::DiagnosticStatus &src) |
copies the summary from a DiagnosticStatus message More... | |
void | summary (unsigned char lvl, const std::string s) |
Fills out the level and message fields of the DiagnosticStatus. More... | |
void | summaryf (unsigned char lvl, const char *format,...) |
Formatted version of summary. More... | |
Wrapper for the diagnostic_msgs::DiagnosticStatus message that makes it easier to update.
This class handles common string formatting and vector handling issues for filling the diagnostic_msgs::DiagnosticStatus message. It is a subclass of diagnostic_msgs::DiagnosticStatus, so it can be passed directly to diagnostic publish calls.
Definition at line 98 of file DiagnosticStatusWrapper.h.
|
inline |
For bool, diagnostic value is "True" or "False".
Definition at line 277 of file DiagnosticStatusWrapper.h.
|
inline |
Add a key-value pair.
This method adds a key-value pair. Any type that has a << stream operator can be passed as the second argument. Formatting is done using a std::stringstream.
key | Key to be added. |
value | Value to be added. |
Definition at line 268 of file DiagnosticStatusWrapper.h.
|
inline |
Add a key-value pair using a format string.
This method adds a key-value pair. A format string is used to set the value. The current implementation limits the value to 1000 characters in length.
Definition at line 288 of file DiagnosticStatusWrapper.h.
|
inline |
Clear the key-value pairs.
The values vector containing the key-value pairs is cleared.
Definition at line 292 of file DiagnosticStatusWrapper.h.
|
inline |
clears the summary, setting the level to zero and the message to "".
Definition at line 243 of file DiagnosticStatusWrapper.h.
|
inline |
Version of mergeSummary that merges in the summary from another DiagnosticStatus.
src | DiagnosticStatus from which to merge the summary. |
Definition at line 187 of file DiagnosticStatusWrapper.h.
|
inline |
Merges a level and message with the existing ones.
It is sometimes useful to merge two DiagnosticStatus messages. In that case, the key value pairs can be unioned, but the level and summary message have to be merged more intelligently. This function does the merge in an intelligent manner, combining the summary in *this, with the one that is passed in.
The combined level is the greater of the two levels to be merged. If both levels are non-zero (not OK), the messages are combined with a semicolon separator. If only one level is zero, and the other is non-zero, the message for the zero level is discarded. If both are zero, the new message is ignored.
lvl | Numerical level to of the merged-in summary. |
s | Descriptive status message for the merged-in summary. |
Definition at line 165 of file DiagnosticStatusWrapper.h.
|
inline |
Formatted version of mergeSummary.
This method is identical to mergeSummary, except that the message is an sprintf-style format string.
lvl | Numerical level to of the merged-in summary. |
format | Format string for the descriptive status message for the merged-in summary. |
... | Values to be formatted by the format string. |
Definition at line 204 of file DiagnosticStatusWrapper.h.
|
inline |
copies the summary from a DiagnosticStatus message
src | StatusWrapper to copy the summary from. |
Definition at line 253 of file DiagnosticStatusWrapper.h.
|
inline |
Fills out the level and message fields of the DiagnosticStatus.
lvl | Numerical level to assign to this Status (OK, Warn, Err). |
s | Descriptive status message. |
Definition at line 140 of file DiagnosticStatusWrapper.h.
|
inline |
Formatted version of summary.
This method is identical to summary, except that the message is an sprintf-style format string.
lvl | Numerical level to assign to this Status (OK, Warn, Err). |
s | Format string for the descriptive status message. |
... | Values to be formatted by the format string. |
Definition at line 227 of file DiagnosticStatusWrapper.h.