Public Member Functions | Private Attributes
diagnostic_aggregator::StatusItem Class Reference

Helper class to hold, store DiagnosticStatus messages. More...

#include <status_item.h>

List of all members.

Public Member Functions

std::string getHwId () const
 Returns hardware ID field of DiagnosticStatus message.
const ros::Time getLastUpdateTime () const
 Returns the time since last update for this item.
DiagnosticLevel getLevel () const
std::string getMessage () const
 Get message field of DiagnosticStatus.
std::string getName () const
 Returns name of DiagnosticStatus message.
std::string getValue (const std::string &key) const
 Returns value for given key, "" if doens't exist.
bool hasKey (const std::string &key) const
 Returns true if item has key in values KeyValues.
 StatusItem (const diagnostic_msgs::DiagnosticStatus *status)
 Constructed from const DiagnosticStatus*.
 StatusItem (const std::string item_name, const std::string message="Missing", const DiagnosticLevel level=Level_Stale)
 Constructed from string of item name.
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.
bool update (const diagnostic_msgs::DiagnosticStatus *status)
 Must have same name as original status or it won't update.
 ~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_

Detailed Description

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 158 of file status_item.h.


Constructor & Destructor Documentation

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.

Definition at line 67 of file status_item.cpp.


Member Function Documentation

std::string diagnostic_aggregator::StatusItem::getHwId ( ) const [inline]

Returns hardware ID field of DiagnosticStatus message.

Definition at line 211 of file status_item.h.

Returns the time since last update for this item.

Definition at line 216 of file status_item.h.

Definition at line 196 of file status_item.h.

std::string diagnostic_aggregator::StatusItem::getMessage ( ) const [inline]

Get message field of DiagnosticStatus.

Definition at line 201 of file status_item.h.

std::string diagnostic_aggregator::StatusItem::getName ( ) const [inline]

Returns name of DiagnosticStatus message.

Definition at line 206 of file status_item.h.

std::string diagnostic_aggregator::StatusItem::getValue ( const std::string &  key) const [inline]

Returns value for given key, "" if doens't exist.

Returns:
Value if key present, "" if not

Definition at line 239 of file status_item.h.

bool diagnostic_aggregator::StatusItem::hasKey ( const std::string &  key) const [inline]

Returns true if item has key in values KeyValues.

Returns:
True if has key

Definition at line 223 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".

Parameters:
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.

Returns:
True if update successful, false if error

Definition at line 69 of file status_item.cpp.


Member Data Documentation

Definition at line 257 of file status_item.h.

Definition at line 253 of file status_item.h.

Definition at line 256 of file status_item.h.

Definition at line 255 of file status_item.h.

name_ w/o "/"

Definition at line 254 of file status_item.h.

Definition at line 251 of file status_item.h.

std::vector<diagnostic_msgs::KeyValue> diagnostic_aggregator::StatusItem::values_ [private]

Definition at line 258 of file status_item.h.


The documentation for this class was generated from the following files:


diagnostic_aggregator
Author(s): Kevin Watts, Brice Rebsamen
autogenerated on Fri Aug 28 2015 10:30:08