INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

gbxutilacfr::Status Class Reference

Local interface to component status. More...

#include <status.h>

Inherited by gbxutilacfr::TrivialStatus.

Inheritance diagram for gbxutilacfr::Status:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual void addSubsystem (const std::string &subsystem, double maxHeartbeatIntervalSec=-1.0)=0
virtual void removeSubsystem (const std::string &subsystem)=0
virtual std::vector< std::string > subsystems ()=0
 Returns a list of subsystem names.
virtual SubsystemStatus subsystemStatus (const std::string &subsystem)=0
virtual void setMaxHeartbeatInterval (const std::string &subsystem, double intervalSec)=0
virtual void initialising (const std::string &subsystem, const std::string &message="")=0
virtual void ok (const std::string &subsystem, const std::string &message="")=0
virtual void warning (const std::string &subsystem, const std::string &message)=0
virtual void fault (const std::string &subsystem, const std::string &message)=0
virtual void heartbeat (const std::string &subsystem)=0
virtual void process ()=0

Detailed Description

Local interface to component status.

Overview
Status provides a machine-readable interface such that tools external to the library can monitor its status. A single Status object is meant to be shared by all threads in the library, so the implementation must be thread-safe. The idea is that Status tracks the state of a number of subsystems (most often one per thread).

Each subsystem should first call addSubsystem(), to make the Status engine aware that it exists. If any other function is called before the subsystem is added, a gbxutilacfr::Exception is thrown.

The 'maxHeartbeatIntervalSec' parameter tells the Status engine how often it expects to hear from each subsystem. If the subsystem has not been heard from for longer than maxHeartbeatIntervalSec, it is assumed that the subsystem has stalled (hung).

The initial default state is Initialising. As soon as initialisation of the subsystem is finished, you should call ok(). This maybe used by external tools as an indication that your subsystem is in "normal" working state.

Local Calls
After registering with setMaxHeartbeatInterval, set the subsystems' status with the various calls. Each of the calls is sufficient to let the Status engine know that the subsystem is alive. The special call 'heartbeat' lets Status know that the subsystem is alive without modifying its status.

See also:
Tracer


Member Function Documentation

virtual void gbxutilacfr::Status::addSubsystem ( const std::string &  subsystem,
double  maxHeartbeatIntervalSec = -1.0 
) [pure virtual]

Adds subsystem to the system status monitor. This command must be called before any other. I.e. all other status commands are ignored unless a subsystem with that name already exists. When trying to add a subsystem with an existing name, the existing subsystem is left unchanged and warning trace is produced.

May also specify the maximum expected interval between heartbeats. When time since last heartbeat exceeds this, an alarm is raised. Heartbeat interval is normally positive, measured in seconds. Negative interval means infinite interval, this is the default behavior.

The initial state of the subsystem is Initialising.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::fault ( const std::string &  subsystem,
const std::string &  message 
) [pure virtual]

Sets subsystem status to Fault. Throws gbxutilacfr::Exception if the subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::heartbeat ( const std::string &  subsystem  )  [pure virtual]

Record heartbeat from a subsystem: let Status know the subsystem is alive without modifying its status. Throws gbxutilacfr::Exception if the subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::initialising ( const std::string &  subsystem,
const std::string &  message = "" 
) [pure virtual]

Sets subsystem status to Initialising. Note that empty message is assumed if none is supplied. Throws gbxutilacfr::Exception if the subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::ok ( const std::string &  subsystem,
const std::string &  message = "" 
) [pure virtual]

Sets subsystem status to Ok. Note that empty message is assumed if none is supplied. Throws gbxutilacfr::Exception if the subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::process (  )  [pure virtual]

Some thread should call this function periodically in order for status publishing to happen.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::removeSubsystem ( const std::string &  subsystem  )  [pure virtual]

Removes subsystem from the status monitor. This should be done for example, if one of the thread is shutting down or restarting. Throws gbxutilacfr::Exception if the subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::setMaxHeartbeatInterval ( const std::string &  subsystem,
double  intervalSec 
) [pure virtual]

Modifies maximum expected interval between heartbeats (in seconds). When time since last heartbeat exceeds this, alarm is raised. Throws gbxutilacfr::Exception if the subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.

virtual SubsystemStatus gbxutilacfr::Status::subsystemStatus ( const std::string &  subsystem  )  [pure virtual]

Returns status of subsystem with the given name. Throws gbxutilacfr::Exception when the specified subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.

virtual void gbxutilacfr::Status::warning ( const std::string &  subsystem,
const std::string &  message 
) [pure virtual]

Sets subsystem status to Warning. Throws gbxutilacfr::Exception if the subsystem does not exist.

Implemented in gbxutilacfr::TrivialStatus.


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

Generated for GearBox by  doxygen 1.4.5