INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
status.h
1 /*
2  * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3  * http://gearbox.sf.net/
4  * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp
5  *
6  * This distribution is licensed to you under the terms described in
7  * the LICENSE file included in this distribution.
8  *
9  */
10 
11 #ifndef GBXUTILACFR_STATUS_H
12 #define GBXUTILACFR_STATUS_H
13 
14 #if defined (WIN32)
15  #if defined (GBXUTILACFR_STATIC)
16  #define GBXUTILACFR_EXPORT
17  #elif defined (GBXUTILACFR_EXPORTS)
18  #define GBXUTILACFR_EXPORT __declspec (dllexport)
19  #else
20  #define GBXUTILACFR_EXPORT __declspec (dllimport)
21  #endif
22 #else
23  #define GBXUTILACFR_EXPORT
24 #endif
25 
26 #include <string>
27 #include <vector>
28 
29 namespace gbxutilacfr {
30 
33 {
46 };
47 
49 GBXUTILACFR_EXPORT std::string toString( SubsystemState state );
50 
53 {
60 };
61 
63 GBXUTILACFR_EXPORT std::string toString( SubsystemHealth health );
64 
66 struct GBXUTILACFR_EXPORT SubsystemStatus
67 {
70  bool stall=false, double beat=0.0 ) :
71  state(s),
72  health(h),
73  message(msg),
74  isStalled(stall),
75  sinceHeartbeat(beat) {};
76 
79 
82 
84  std::string message;
85 
87  bool isStalled;
88 
94 };
95 
97 GBXUTILACFR_EXPORT std::string toString( const SubsystemStatus& status );
98 
101 {
114 };
115 
117 GBXUTILACFR_EXPORT std::string toString( SubsystemType type );
118 
121 {
130 };
131 
133 GBXUTILACFR_EXPORT std::string toString( ComponentState type );
134 
137 {
144 };
145 
147 GBXUTILACFR_EXPORT std::string toString( ComponentHealth type );
148 
150 struct GBXUTILACFR_EXPORT ComponentStatus
151 {
157  bool isStalled;
158 };
159 
253 class GBXUTILACFR_EXPORT Status
254 {
255 
256 public:
257 
258  virtual ~Status() {};
259 
275  virtual void addSubsystem( const std::string& subsystem,
276  double maxHeartbeatIntervalSec=-1.0, SubsystemType type=SubsystemStandard )=0;
277 
280  virtual void removeSubsystem( const std::string& subsystem )=0;
281 
283  virtual std::vector<std::string> subsystems()=0;
284 
287  virtual SubsystemStatus subsystemStatus( const std::string& subsystem )=0;
288 
290 // virtual SubsystemState infrastructureState()=0;
291 
295  virtual ComponentStatus componentStatus()=0;
296 
301  virtual void setMaxHeartbeatInterval( const std::string& subsystem, double intervalSec )=0;
302 
304  virtual void setSubsystemType( const std::string& subsystem, SubsystemType type )=0;
305 
306  //
307  // BOTH STATE AND HEALTH CHANGES
308  //
309 
313  virtual void setSubsystemStatus( const std::string& subsystem, SubsystemState state, SubsystemHealth health, const std::string& message="" )=0;
314 
315  //
316  // STATE CHANGES
317  //
318 
321  virtual void initialising( const std::string& subsystem )=0;
322 
325  virtual void working( const std::string& subsystem )=0;
326 
329  virtual void finalising( const std::string& subsystem )=0;
330 
334  virtual void fault( const std::string& subsystem, const std::string& message )=0;
335 
336  //
337  // HEALTH CHANGES
338  //
339 
342  virtual void ok( const std::string& subsystem, const std::string& message="" )=0;
343 
346  virtual void warning( const std::string& subsystem, const std::string& message )=0;
347 
350  virtual void critical( const std::string& subsystem, const std::string& message )=0;
351 
352  //
353  // NO CHANGE
354  //
355 
359  virtual void heartbeat( const std::string& subsystem )=0;
360 
363  virtual void message( const std::string& subsystem, const std::string& message )=0;
364 
365  //
366  // Utility
367  //
368 
371  virtual void process()=0;
372 };
373 
374 } // namespace
375 
376 #endif
ComponentHealth
Possible values of component health.
Definition: status.h:136
SubsystemHealth
Possible subsystem status values.
Definition: status.h:52
Component is preparing to shutdown, e.g. releasing its resources, etc.
Definition: status.h:127
Component is in an unrecovarable faulty state.
Definition: status.h:129
Definition: status.h:113
Status of a single component.
Definition: status.h:150
SubsystemStatus(SubsystemState s=SubsystemIdle, SubsystemHealth h=SubsystemOk, const std::string &msg="", bool stall=false, double beat=0.0)
Constructor.
Definition: status.h:69
Definition: status.h:108
ComponentState state
Component state.
Definition: status.h:153
Subsystem is fully initialised and is performing its function.
Definition: status.h:39
At least one of the component&#39;s subsystems has encountered a critical condition.
Definition: status.h:143
std::string toString(SubsystemState state)
Returns string equivalent of state enumerator.
Definition: status.cpp:17
Subsystem is preparing to shutdown, e.g. releasing its resources, etc.
Definition: status.h:41
All of the component&#39;s subsystems are OK.
Definition: status.h:139
ComponentHealth health
Component health.
Definition: status.h:155
SubsystemState
Possible subsystem status values.
Definition: status.h:32
bool isStalled
Is component stalled?
Definition: status.h:157
std::string message
Human-readable status description.
Definition: status.h:84
Subsystem is not longer functioning.
Definition: status.h:43
ComponentState
Possible component states.
Definition: status.h:120
bool isStalled
If true, the subsystem has not been heard from for an abnormally long time.
Definition: status.h:87
SubsystemState state
Current state in the subsystem&#39;s state machine. I.e. what is the subsystem doing? ...
Definition: status.h:75
Subsystem is OK.
Definition: status.h:55
SubsystemType
Subsystem type which describes common behavior models of a subsystem.
Definition: status.h:100
Subsystem is preparing to work, e.g. initialising its resources, etc.
Definition: status.h:37
Subsystem is in an unrecovarable faulty state.
Definition: status.h:45
ACFR utilities.
Definition: gbxnovatelacfr/driver.h:24
SubsystemHealth health
Subsystem&#39;s health. I.e. how is the subsystem doing?
Definition: status.h:81
Component is fully initialised and is performing its work.
Definition: status.h:125
Local interface to component status.
Definition: status.h:253
Subsystem has encountered a critical condition.
Definition: status.h:59
double sinceHeartbeat
Definition: status.h:93
At least one of the component&#39;s subsystems has encountered an abnormal but non-critical condition...
Definition: status.h:141
Subsystem has encountered an abnormal but non-critical condition.
Definition: status.h:57
Standard model: subsystem&#39;s life cycle is equal to the life cycle of the component.
Definition: status.h:103
Component is preparing to work, e.g. initialising its resources, etc.
Definition: status.h:123
Status for a single subsystem.
Definition: status.h:66
Subsystem has been created but has not started initialisation process.
Definition: status.h:35
 

Generated for GearBox by  doxygen 1.4.5