INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
subhealth.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_SUBSYSTEM_HEALTH_H 00012 #define GBXUTILACFR_SUBSYSTEM_HEALTH_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 00028 namespace gbxutilacfr { 00029 00039 class GBXUTILACFR_EXPORT SubHealth 00040 { 00041 00042 public: 00045 SubHealth( Status& sysStatus, const std::string& subsysName ) : 00046 status_(sysStatus), 00047 subsysName_(subsysName) 00048 {}; 00049 00051 void heartbeat() { status_.heartbeat( subsysName_ ); }; 00052 00054 void message( const std::string& message ) { status_.message( subsysName_, message ); }; 00055 00057 void ok( const std::string& message="" ) { status_.ok( subsysName_, message ); }; 00058 00060 void warning( const std::string& message ) { status_.warning( subsysName_, message ); }; 00061 00063 void critical( const std::string& message ) { status_.critical( subsysName_, message ); }; 00064 00066 std::string name() const { return subsysName_; }; 00067 00068 // Returns system Status object 00069 // Status& status() { return status_; }; 00070 00071 private: 00072 00073 Status& status_; 00074 std::string subsysName_; 00075 }; 00076 00077 } // namespace 00078 00079 #endif |