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() [1/2]

StatusItem::StatusItem ( const diagnostic_msgs::DiagnosticStatus *  status)

Constructed from const DiagnosticStatus*.

Definition at line 42 of file status_item.cpp.

◆ StatusItem() [2/2]

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::~StatusItem ( )

Definition at line 67 of file status_item.cpp.

Member Function Documentation

◆ getHwId()

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

Returns hardware ID field of DiagnosticStatus message.

Definition at line 211 of file status_item.h.

◆ getLastUpdateTime()

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.

◆ getLevel()

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

Definition at line 196 of file status_item.h.

◆ getMessage()

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

Get message field of DiagnosticStatus.

Definition at line 201 of file status_item.h.

◆ getName()

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

Returns name of DiagnosticStatus message.

Definition at line 206 of file status_item.h.

◆ getValue()

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.

◆ hasKey()

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.

◆ toStatusMsg()

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.

◆ update()

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

◆ hw_id_

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

Definition at line 257 of file status_item.h.

◆ level_

DiagnosticLevel diagnostic_aggregator::StatusItem::level_
private

Definition at line 253 of file status_item.h.

◆ message_

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

Definition at line 256 of file status_item.h.

◆ name_

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

Definition at line 255 of file status_item.h.

◆ output_name_

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

name_ w/o "/"

Definition at line 254 of file status_item.h.

◆ update_time_

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

Definition at line 251 of file status_item.h.

◆ values_

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 Mon Feb 28 2022 22:18:07