Helper class to hold, store DiagnosticStatus messages. More...
#include <status_item.h>
Public Member Functions | |
std::string | getHwId () const |
Returns hardware ID field of DiagnosticStatus message. More... | |
const ros::Time | getLastUpdateTime () const |
Returns the time since last update for this item. More... | |
DiagnosticLevel | getLevel () const |
std::string | getMessage () const |
Get message field of DiagnosticStatus. More... | |
std::string | getName () const |
Returns name of DiagnosticStatus message. More... | |
std::string | getValue (const std::string &key) const |
Returns value for given key, "" if doesn't exist. More... | |
bool | hasKey (const std::string &key) const |
Returns true if item has key in values KeyValues. More... | |
StatusItem (const diagnostic_msgs::DiagnosticStatus *status) | |
Constructed from const DiagnosticStatus*. More... | |
StatusItem (const std::string item_name, const std::string message="Missing", const DiagnosticLevel level=Level_Stale) | |
Constructed from string of item name. More... | |
boost::shared_ptr< diagnostic_msgs::DiagnosticStatus > | toStatusMsg (const std::string &path, const bool stale=false) const |
Prepends "path/" to name, makes item stale if "stale" true. More... | |
bool | update (const diagnostic_msgs::DiagnosticStatus *status) |
Must have same name as original status or it won't update. More... | |
~StatusItem () | |
Private Attributes | |
std::string | hw_id_ |
DiagnosticLevel | level_ |
std::string | message_ |
std::string | name_ |
std::string | output_name_ |
ros::Time | update_time_ |
std::vector< diagnostic_msgs::KeyValue > | values_ |
Helper class to hold, store DiagnosticStatus messages.
The StatusItem class is used by the Aggregator to store incoming DiagnosticStatus messages. Helper messages make it easy to calculate update intervals, and extract KeyValue pairs.
Definition at line 190 of file status_item.h.
StatusItem::StatusItem | ( | const diagnostic_msgs::DiagnosticStatus * | status | ) |
Constructed from const DiagnosticStatus*.
Definition at line 42 of file status_item.cpp.
diagnostic_aggregator::StatusItem::StatusItem | ( | const std::string | item_name, |
const std::string | message = "Missing" , |
||
const DiagnosticLevel | level = Level_Stale |
||
) |
Constructed from string of item name.
StatusItem::~StatusItem | ( | ) |
Definition at line 67 of file status_item.cpp.
|
inline |
Returns hardware ID field of DiagnosticStatus message.
Definition at line 243 of file status_item.h.
|
inline |
Returns the time since last update for this item.
Definition at line 248 of file status_item.h.
|
inline |
Definition at line 228 of file status_item.h.
|
inline |
Get message field of DiagnosticStatus.
Definition at line 233 of file status_item.h.
|
inline |
Returns name of DiagnosticStatus message.
Definition at line 238 of file status_item.h.
|
inline |
Returns value for given key, "" if doesn't exist.
Definition at line 271 of file status_item.h.
|
inline |
Returns true if item has key in values KeyValues.
Definition at line 255 of file status_item.h.
boost::shared_ptr< diagnostic_msgs::DiagnosticStatus > StatusItem::toStatusMsg | ( | const std::string & | path, |
const bool | stale = false |
||
) | const |
Prepends "path/" to name, makes item stale if "stale" true.
Helper function to convert item back to diagnostic_msgs::DiagnosticStatus pointer. Prepends path. Example: Item with name "Hokuyo" toStatusMsg("Base Path/My Path", false) gives "Base Path/My Path/Hokuyo".
path | : Prepended to name |
stale | : If true, status level is 3 |
Definition at line 91 of file status_item.cpp.
bool StatusItem::update | ( | const diagnostic_msgs::DiagnosticStatus * | status | ) |
Must have same name as original status or it won't update.
Definition at line 69 of file status_item.cpp.
|
private |
Definition at line 289 of file status_item.h.
|
private |
Definition at line 285 of file status_item.h.
|
private |
Definition at line 288 of file status_item.h.
|
private |
Definition at line 287 of file status_item.h.
|
private |
name_ w/o "/"
Definition at line 286 of file status_item.h.
|
private |
Definition at line 283 of file status_item.h.
|
private |
Definition at line 290 of file status_item.h.