$search

diagnostic_updater::DiagnosticStatusWrapper Class Reference

Wrapper for the diagnostic_msgs::DiagnosticStatus message that makes it easier to update. More...

#include <DiagnosticStatusWrapper.h>

Inheritance diagram for diagnostic_updater::DiagnosticStatusWrapper:
Inheritance graph
[legend]

List of all members.

Public Member Functions

template<>
void add (const std::string &key, const bool &b)
 For bool, diagnostic value is "True" or "False".
template<class T >
void add (const std::string &key, const T &val)
 Add a key-value pair.
void addf (const std::string &key, const char *format,...)
 Add a key-value pair using a format string.
void clear ()
 Clear the key-value pairs.
void clearSummary ()
 clears the summary, setting the level to zero and the message to "".
void mergeSummary (const diagnostic_msgs::DiagnosticStatus &src)
 Version of mergeSummary that merges in the summary from another DiagnosticStatus.
void mergeSummary (unsigned char lvl, const std::string s)
 Merges a level and message with the existing ones.
void mergeSummaryf (unsigned char lvl, const char *format,...)
 Formatted version of mergeSummary.
void summary (const diagnostic_msgs::DiagnosticStatus &src)
 copies the summary from a DiagnosticStatus message
void summary (unsigned char lvl, const std::string s)
 Fills out the level and message fields of the DiagnosticStatus.
void summaryf (unsigned char lvl, const char *format,...)
 Formatted version of summary.

Detailed Description

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 66 of file DiagnosticStatusWrapper.h.


Member Function Documentation

template<>
void diagnostic_updater::DiagnosticStatusWrapper::add ( const std::string &  key,
const bool &  b 
) [inline]

For bool, diagnostic value is "True" or "False".

template<class T >
void diagnostic_updater::DiagnosticStatusWrapper::add ( const std::string &  key,
const T &  val 
) [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.

Parameters:
key Key to be added.
value Value to be added.

Definition at line 204 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::addf ( const std::string &  key,
const char *  format,
  ... 
) [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 256 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::clear (  )  [inline]

Clear the key-value pairs.

The values vector containing the key-value pairs is cleared.

Definition at line 228 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::clearSummary (  )  [inline]

clears the summary, setting the level to zero and the message to "".

Definition at line 179 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::mergeSummary ( const diagnostic_msgs::DiagnosticStatus src  )  [inline]

Version of mergeSummary that merges in the summary from another DiagnosticStatus.

Parameters:
src DiagnosticStatus from which to merge the summary.

Definition at line 123 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::mergeSummary ( unsigned char  lvl,
const std::string  s 
) [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.

Parameters:
lvl Numerical level to of the merged-in summary.
s Descriptive status message for the merged-in summary.

Definition at line 101 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::mergeSummaryf ( unsigned char  lvl,
const char *  format,
  ... 
) [inline]

Formatted version of mergeSummary.

This method is identical to mergeSummary, except that the message is an sprintf-style format string.

Parameters:
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 140 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::summary ( const diagnostic_msgs::DiagnosticStatus src  )  [inline]

copies the summary from a DiagnosticStatus message

Parameters:
src StatusWrapper to copy the summary from.

Definition at line 189 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::summary ( unsigned char  lvl,
const std::string  s 
) [inline]

Fills out the level and message fields of the DiagnosticStatus.

Parameters:
lvl Numerical level to assign to this Status (OK, Warn, Err).
s Descriptive status message.

Definition at line 76 of file DiagnosticStatusWrapper.h.

void diagnostic_updater::DiagnosticStatusWrapper::summaryf ( unsigned char  lvl,
const char *  format,
  ... 
) [inline]

Formatted version of summary.

This method is identical to summary, except that the message is an sprintf-style format string.

Parameters:
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 163 of file DiagnosticStatusWrapper.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


diagnostic_updater
Author(s): Jeremy Leibs, Blaise Gassend
autogenerated on Wed Jan 30 11:30:36 2013