INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
substatus.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_SUBSYSTEM_STATUS_H
12#define GBXUTILACFR_SUBSYSTEM_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 <gbxutilacfr/status.h>
27
28namespace gbxutilacfr {
29
39class GBXUTILACFR_EXPORT SubStatus
40{
41
42public:
45 SubStatus( Status& status, const std::string& subsysName, double maxHeartbeatIntervalSec=-1.0 ) :
46 status_(status),
47 subsysName_(subsysName)
48 {
49 status_.addSubsystem( subsysName_, maxHeartbeatIntervalSec );
50 };
51
53 ~SubStatus();
54
55 //
56 // set expectations about ourselves
57 //
58
60 void setMaxHeartbeatInterval( double interval ) { status_.setMaxHeartbeatInterval( subsysName_, interval ); };
61
63 void setSubsystemType( SubsystemType type ) { status_.setSubsystemType( subsysName_, type ); };
64
65 //
66 // set health
67 //
68
70 void heartbeat() { status_.heartbeat( subsysName_ ); };
71
73 void message( const std::string& message ) { status_.message( subsysName_, message ); };
74
76 void ok( const std::string& message="" ) { status_.ok( subsysName_, message ); };
77
79 void warning( const std::string& message ) { status_.warning( subsysName_, message ); };
80
82 void critical( const std::string& message ) { status_.critical( subsysName_, message ); };
83
84 //
85 // Set state machine states
86 //
87
89 void initialising() { status_.initialising( subsysName_ ); };
90
92 void working() { status_.working( subsysName_ ); };
93
95 void finalising() { status_.finalising( subsysName_ ); };
96
98 void fault( const std::string& message ) { status_.fault( subsysName_, message ); };
99
101 Status& status() { return status_; };
102
104 std::string name() const { return subsysName_; };
105
106private:
107
108 // Make this uncopyable
109 SubStatus(const SubStatus&);
110 void operator=(const SubStatus&);
111
112 Status& status_;
113 std::string subsysName_;
114};
115
116} // namespace
117
118#endif
Local interface to component status.
Definition: status.h:254
Convenience class which maniupulates the status of a subsystem.
Definition: substatus.h:40
void ok(const std::string &message="")
Passes this information to the system Status.
Definition: substatus.h:76
Status & status()
Returns system Status object.
Definition: substatus.h:101
void initialising()
Passes this information to the system Status.
Definition: substatus.h:89
void critical(const std::string &message)
Passes this information to the system Status. Diagnostic message is required.
Definition: substatus.h:82
void setMaxHeartbeatInterval(double interval)
Passes this information to the system Status.
Definition: substatus.h:60
void heartbeat()
Passes this information to the system Status.
Definition: substatus.h:70
void working()
Passes this information to the system Status.
Definition: substatus.h:92
void fault(const std::string &message)
Passes this information to the system Status. Diagnostic message is required.
Definition: substatus.h:98
SubStatus(Status &status, const std::string &subsysName, double maxHeartbeatIntervalSec=-1.0)
Definition: substatus.h:45
void finalising()
Passes this information to the system Status.
Definition: substatus.h:95
void setSubsystemType(SubsystemType type)
Passes this information to the system Status.
Definition: substatus.h:63
std::string name() const
Returns subsystem's name.
Definition: substatus.h:104
void message(const std::string &message)
Passes this information to the system Status.
Definition: substatus.h:73
void warning(const std::string &message)
Passes this information to the system Status. Diagnostic message is required.
Definition: substatus.h:79
ACFR utilities.
Definition: gbxnovatelacfr/driver.h:24
SubsystemType
Subsystem type which describes common behavior models of a subsystem.
Definition: status.h:101
 

Generated for GearBox by  doxygen 1.4.5