Changeset 13904
- Timestamp:
- 05/26/12 11:26:43 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/DimState.h
r13871 r13904 13 13 public: 14 14 DimState(const string &n, const string s="STATE") : server(n), 15 service(n+"/"+s), info(make_pair(Time(), - 4))15 service(n+"/"+s), info(make_pair(Time(), -256)) 16 16 { 17 17 } … … 41 41 const bool disconnected = evt.GetSize()==0; 42 42 43 info = make_pair(evt.GetTime(), disconnected ? - 4: evt.GetQoS());43 info = make_pair(evt.GetTime(), disconnected ? -256 : evt.GetQoS()); 44 44 45 45 msg = disconnected ? "" : evt.GetString(); … … 52 52 const int &state() const { return info.second; } 53 53 54 bool online() const { return info.second>- 4; }55 56 virtual State description() const { return State(- 5, ""); }54 bool online() const { return info.second>-256; } 55 56 virtual State description() const { return State(-257, ""); } 57 57 }; 58 58 … … 64 64 out << kBold << s.server; 65 65 66 if (s.state()==- 4)66 if (s.state()==-256) 67 67 return out << ": Offline"; 68 68 69 if (rc.index==- 5)69 if (rc.index==-257) 70 70 return out; 71 71 72 72 out << ": "; 73 73 74 if (rc.index==-2)75 out << s.state();76 else74 // if (rc.index==-2) 75 // out << s.state(); 76 // else 77 77 out << rc.name << "[" << rc.index << "]"; 78 78 … … 106 106 { 107 107 states = State::SplitStates(evt.GetString()); 108 states.push_back(State(- 4, "Offline"));108 states.push_back(State(-256, "Offline")); 109 109 } 110 110 } … … 116 116 return *it; 117 117 118 return State(- 5, "n/a");118 return State(-257, "n/a"); 119 119 } 120 120 }; … … 129 129 DimState::Handler(evt); 130 130 131 info.second = evt.GetSize()==4 ? evt.GetInt() : -4;131 info.second = evt.GetSize()==4 ? evt.GetInt() : 0; 132 132 } 133 133 … … 157 157 string file; 158 158 string shortmsg; 159 int scriptdepth; 159 160 160 161 void AddCallback(const string &script, const callback &cb) … … 167 168 DimState::Handler(evt); 168 169 169 shortmsg = msg; 170 file = ""; 170 shortmsg = msg; 171 file = ""; 172 scriptdepth = -1; 171 173 172 174 // Evaluate msg … … 175 177 return; 176 178 179 // Evaluate scriptdepth 180 const size_t ps = msg.find_first_of('-'); 181 if (ps!=string::npos) 182 scriptdepth = atoi(msg.c_str()+ps+1); 183 184 // Find filename 177 185 const size_t p1 = msg.find_last_of('['); 178 186 if (p1==string::npos)
Note:
See TracChangeset
for help on using the changeset viewer.