Public Member Functions | Private Attributes | List of all members
diagnostic_aggregator::StatusItem Class Reference

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 doens'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_
 

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.

StatusItem::~StatusItem ( )

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.

const ros::Time diagnostic_aggregator::StatusItem::getLastUpdateTime ( ) const
inline

Returns the time since last update for this item.

Definition at line 216 of file status_item.h.

DiagnosticLevel diagnostic_aggregator::StatusItem::getLevel ( ) const
inline

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

std::string diagnostic_aggregator::StatusItem::hw_id_
private

Definition at line 257 of file status_item.h.

DiagnosticLevel diagnostic_aggregator::StatusItem::level_
private

Definition at line 253 of file status_item.h.

std::string diagnostic_aggregator::StatusItem::message_
private

Definition at line 256 of file status_item.h.

std::string diagnostic_aggregator::StatusItem::name_
private

Definition at line 255 of file status_item.h.

std::string diagnostic_aggregator::StatusItem::output_name_
private

name_ w/o "/"

Definition at line 254 of file status_item.h.

ros::Time diagnostic_aggregator::StatusItem::update_time_
private

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 Wed Mar 27 2019 03:02:15