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 
78  SubsystemState state;
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
 

Generated for GearBox by  doxygen 1.4.5