00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef HOSTSTATE_H
00015 #define HOSTSTATE_H
00016
00017 #include "ImNotifiable.h"
00018
00034 class HostState : public BBItem
00035 {
00036 BBITEM_METAINFO(BBItem)
00037
00038 public:
00042 enum States
00043 {
00044 ACTIVE,
00045 FAILED,
00047 BROKEN,
00049 SLEEP,
00050 OFF
00051 };
00052
00053
00054
00055 private:
00059 States state;
00060
00061 public:
00065 HostState(States state = ACTIVE):
00066 state(state)
00067 {}
00068
00070 States get() const { return state; }
00072 void set(States s) { state = s; }
00073
00077 std::string info() const {
00078 std::ostringstream ost;
00079 switch(state) {
00080 case ACTIVE:
00081 ost << "ACTIVE";
00082 break;
00083 case FAILED:
00084 ost << "FAILED";
00085 break;
00086 case BROKEN:
00087 ost << "BROKEN";
00088 break;
00089 case SLEEP:
00090 ost << "SLEEP";
00091 break;
00092 case OFF:
00093 ost << "OFF";
00094 break;
00095 default:
00096 ost << "Unknown";
00097 break;
00098 }
00099 return ost.str();
00100 }
00101 };
00102
00103 #endif