INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
trivialstatus.h 00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2004-2008 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 ); 00054 virtual SubsystemState infrastructureState(); 00055 virtual void setMaxHeartbeatInterval( const std::string& subsystem, double interval ); 00056 virtual void setSubsystemType( const std::string& subsystem, SubsystemType type ); 00057 00058 virtual void setSubsystemStatus( const std::string& subsystem, SubsystemState state, SubsystemHealth health, const std::string& msg="" ); 00059 00060 virtual void initialising( const std::string& subsystem, const std::string& msg="" ); 00061 virtual void working( const std::string& subsystem, const std::string& msg="" ); 00062 virtual void finalising( const std::string& subsystem, const std::string& msg="" ); 00063 00064 virtual void ok( const std::string& subsystem, const std::string& msg="" ); 00065 virtual void warning( const std::string& subsystem, const std::string& msg ); 00066 virtual void fault( const std::string& subsystem, const std::string& msg ); 00067 virtual void heartbeat( const std::string& subsystem ); 00068 virtual void message( const std::string& subsystem, const std::string& msg ); 00069 00070 virtual void infrastructureInitialising(); 00071 virtual void infrastructureWorking(); 00072 virtual void infrastructureFinalising(); 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 00080 Tracer& tracer_; 00081 00082 bool stateChange_; 00083 bool ok_; 00084 bool warn_; 00085 bool fault_; 00086 bool heartbeat_; 00087 }; 00088 00089 } // namespace 00090 00091 #endif |