INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
trivialstatus.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef GBXUTILACFR_TRIVIAL_STATUS_H 00012 #define GBXUTILACFR_TRIVIAL_STATUS_H 00013 00014 #if defined (WIN32) 00015 #if defined (GBXUTILACFR_STATIC) 00016 #define GBXUTILACFR_EXPORT 00017 #elif defined (GBXUTILACFR_EXPORTS) 00018 #define GBXUTILACFR_EXPORT __declspec (dllexport) 00019 #else 00020 #define GBXUTILACFR_EXPORT __declspec (dllimport) 00021 #endif 00022 #else 00023 #define GBXUTILACFR_EXPORT 00024 #endif 00025 00026 #include <gbxutilacfr/status.h> 00027 #include <gbxutilacfr/tracer.h> 00028 00029 namespace gbxutilacfr { 00030 00031 00039 class GBXUTILACFR_EXPORT TrivialStatus : public Status 00040 { 00041 public: 00042 00043 TrivialStatus( Tracer& tracer, 00044 bool stateChange=true, bool ok=false, bool warn=true, bool fault=true, bool heartbeat=false ); 00045 00046 virtual void addSubsystem( const std::string& subsystem, 00047 double maxHeartbeatIntervalSec=-1.0, SubsystemType type=SubsystemStandard ); 00048 virtual void removeSubsystem( const std::string& subsystem ); 00050 virtual std::vector<std::string> subsystems(); 00052 virtual SubsystemStatus subsystemStatus( const std::string& subsystem ); 00055 virtual ComponentStatus componentStatus(); 00056 virtual void setMaxHeartbeatInterval( const std::string& subsystem, double interval ); 00057 virtual void setSubsystemType( const std::string& subsystem, SubsystemType type ); 00058 00059 virtual void setSubsystemStatus( const std::string& subsystem, SubsystemState state, SubsystemHealth health, const std::string& msg="" ); 00060 00061 virtual void initialising( const std::string& subsystem ); 00062 virtual void working( const std::string& subsystem ); 00063 virtual void finalising( const std::string& subsystem ); 00064 virtual void fault( const std::string& subsystem, const std::string& msg ); 00065 00066 virtual void ok( const std::string& subsystem, const std::string& msg="" ); 00067 virtual void warning( const std::string& subsystem, const std::string& msg ); 00068 virtual void critical( const std::string& subsystem, const std::string& msg ); 00069 00070 virtual void heartbeat( const std::string& subsystem ); 00071 virtual void message( const std::string& subsystem, const std::string& msg ); 00072 00073 virtual void process(); 00074 00075 private: 00076 00077 void internalSetStatus( const std::string& subsystem, gbxutilacfr::SubsystemState state, 00078 gbxutilacfr::SubsystemHealth health, const std::string& msg ) 00079 { internalSetStatus(subsystem,state,health,true,msg); }; 00080 00081 void internalSetStatus( const std::string& subsystem, gbxutilacfr::SubsystemState state, 00082 gbxutilacfr::SubsystemHealth health ) 00083 { internalSetStatus(subsystem,state,health,false,""); }; 00084 00085 void internalSetStatus( const std::string& subsystem, gbxutilacfr::SubsystemState state, 00086 gbxutilacfr::SubsystemHealth health, bool hasMessage, const std::string& msg ); 00087 00088 Tracer& tracer_; 00089 00090 bool stateChange_; 00091 bool ok_; 00092 bool warn_; 00093 bool fault_; 00094 bool heartbeat_; 00095 }; 00096 00097 } // namespace 00098 00099 #endif |