Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
diagnostic_aggregator::GenericAnalyzerBase Class Referenceabstract

GenericAnalyzerBase is the base class for GenericAnalyzer and OtherAnalyzer. More...

#include <generic_analyzer_base.h>

Inheritance diagram for diagnostic_aggregator::GenericAnalyzerBase:
Inheritance graph
[legend]

Public Member Functions

virtual bool analyze (const boost::shared_ptr< StatusItem > item)
 Update state with new StatusItem. More...
 
 GenericAnalyzerBase ()
 
virtual std::string getName () const
 Returns nice name (ex: "Power System") More...
 
virtual std::string getPath () const
 Returns full prefix (ex: "/Robot/Power System") More...
 
bool init (const std::string path, const ros::NodeHandle &n)=0
 Analyzer is initialized with base path and namespace. More...
 
bool init (const std::string path, const std::string nice_name, double timeout=-1.0, int num_items_expected=-1, bool discard_stale=false)
 
virtual bool match (const std::string name)=0
 Match function isn't implemented by GenericAnalyzerBase. More...
 
virtual std::vector< boost::shared_ptr< diagnostic_msgs::DiagnosticStatus > > report ()
 Reports current state, returns vector of formatted status messages. More...
 
virtual ~GenericAnalyzerBase ()
 
- Public Member Functions inherited from diagnostic_aggregator::Analyzer
 Analyzer ()
 Default constructor, called by pluginlib. More...
 
virtual ~Analyzer ()
 

Protected Member Functions

void addItem (std::string name, boost::shared_ptr< StatusItem > item)
 Subclasses can add items to analyze. More...
 

Protected Attributes

std::string nice_name_
 
int num_items_expected_
 
std::string path_
 
double timeout_
 

Private Attributes

bool discard_stale_
 
bool has_initialized_
 
bool has_warned_
 
std::map< std::string, boost::shared_ptr< StatusItem > > items_
 Stores items by name. State of analyzer. More...
 
int last_header_level_
 
ros::Time last_header_status_change_
 

Detailed Description

GenericAnalyzerBase is the base class for GenericAnalyzer and OtherAnalyzer.

GenericAnalyzerBase contains the getPath(), getName(), analyze() and report() functions of the Generic and Other Analyzers. It is a virtual class, and cannot be instantiated or loaded as a plugin. Subclasses are responsible for implementing the init() and match() functions.

The GenericAnalyzerBase holds the state of the analyzer, and tracks if items are stale, and if the user has the correct number of items.

Definition at line 97 of file generic_analyzer_base.h.

Constructor & Destructor Documentation

◆ GenericAnalyzerBase()

diagnostic_aggregator::GenericAnalyzerBase::GenericAnalyzerBase ( )
inline

Definition at line 132 of file generic_analyzer_base.h.

◆ ~GenericAnalyzerBase()

virtual diagnostic_aggregator::GenericAnalyzerBase::~GenericAnalyzerBase ( )
inlinevirtual

Definition at line 137 of file generic_analyzer_base.h.

Member Function Documentation

◆ addItem()

void diagnostic_aggregator::GenericAnalyzerBase::addItem ( std::string  name,
boost::shared_ptr< StatusItem item 
)
inlineprotected

Subclasses can add items to analyze.

Definition at line 329 of file generic_analyzer_base.h.

◆ analyze()

virtual bool diagnostic_aggregator::GenericAnalyzerBase::analyze ( const boost::shared_ptr< StatusItem item)
inlinevirtual

Update state with new StatusItem.

Implements diagnostic_aggregator::Analyzer.

Definition at line 174 of file generic_analyzer_base.h.

◆ getName()

virtual std::string diagnostic_aggregator::GenericAnalyzerBase::getName ( ) const
inlinevirtual

Returns nice name (ex: "Power System")

Implements diagnostic_aggregator::Analyzer.

Definition at line 317 of file generic_analyzer_base.h.

◆ getPath()

virtual std::string diagnostic_aggregator::GenericAnalyzerBase::getPath ( ) const
inlinevirtual

Returns full prefix (ex: "/Robot/Power System")

Implements diagnostic_aggregator::Analyzer.

Definition at line 312 of file generic_analyzer_base.h.

◆ init() [1/2]

bool diagnostic_aggregator::GenericAnalyzerBase::init ( const std::string  base_path,
const ros::NodeHandle n 
)
pure virtual

Analyzer is initialized with base path and namespace.

The Analyzer initialized with parameters in its given namespace. The "base_path" is common to all analyzers, and needs to be prepended to all DiagnosticStatus names.

Parameters
base_path: Common to all analyzers, prepended to all processed names. Starts with "/".
n: NodeHandle with proper private namespace for analyzer.

Implements diagnostic_aggregator::Analyzer.

Implemented in diagnostic_aggregator::GenericAnalyzer, and diagnostic_aggregator::OtherAnalyzer.

◆ init() [2/2]

bool diagnostic_aggregator::GenericAnalyzerBase::init ( const std::string  path,
const std::string  nice_name,
double  timeout = -1.0,
int  num_items_expected = -1,
bool  discard_stale = false 
)
inline

Definition at line 149 of file generic_analyzer_base.h.

◆ match()

virtual bool diagnostic_aggregator::GenericAnalyzerBase::match ( const std::string  name)
pure virtual

◆ report()

virtual std::vector<boost::shared_ptr<diagnostic_msgs::DiagnosticStatus> > diagnostic_aggregator::GenericAnalyzerBase::report ( )
inlinevirtual

Reports current state, returns vector of formatted status messages.

Returns
Vector of DiagnosticStatus messages. They must have the correct prefix for all names.

Implements diagnostic_aggregator::Analyzer.

Reimplemented in diagnostic_aggregator::GenericAnalyzer, diagnostic_aggregator::OtherAnalyzer, and diagnostic_aggregator::DiscardAnalyzer.

Definition at line 195 of file generic_analyzer_base.h.

Member Data Documentation

◆ discard_stale_

bool diagnostic_aggregator::GenericAnalyzerBase::discard_stale_
private

Definition at line 337 of file generic_analyzer_base.h.

◆ has_initialized_

bool diagnostic_aggregator::GenericAnalyzerBase::has_initialized_
private

Definition at line 337 of file generic_analyzer_base.h.

◆ has_warned_

bool diagnostic_aggregator::GenericAnalyzerBase::has_warned_
private

Definition at line 337 of file generic_analyzer_base.h.

◆ items_

std::map<std::string, boost::shared_ptr<StatusItem> > diagnostic_aggregator::GenericAnalyzerBase::items_
private

Stores items by name. State of analyzer.

Definition at line 335 of file generic_analyzer_base.h.

◆ last_header_level_

int diagnostic_aggregator::GenericAnalyzerBase::last_header_level_
private

Definition at line 339 of file generic_analyzer_base.h.

◆ last_header_status_change_

ros::Time diagnostic_aggregator::GenericAnalyzerBase::last_header_status_change_
private

Definition at line 338 of file generic_analyzer_base.h.

◆ nice_name_

std::string diagnostic_aggregator::GenericAnalyzerBase::nice_name_
protected

Definition at line 320 of file generic_analyzer_base.h.

◆ num_items_expected_

int diagnostic_aggregator::GenericAnalyzerBase::num_items_expected_
protected

Definition at line 324 of file generic_analyzer_base.h.

◆ path_

std::string diagnostic_aggregator::GenericAnalyzerBase::path_
protected

Definition at line 321 of file generic_analyzer_base.h.

◆ timeout_

double diagnostic_aggregator::GenericAnalyzerBase::timeout_
protected

Definition at line 323 of file generic_analyzer_base.h.


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


diagnostic_aggregator
Author(s): Kevin Watts, Brice Rebsamen
autogenerated on Tue Nov 15 2022 03:17:13