- Timestamp:
- 05/31/12 15:28:31 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/DimState.h
r13948 r13997 11 11 callback fCallback; 12 12 13 void HandlerImp(const EventImp &evt) 14 { 15 const bool disconnected = evt.GetSize()==0; 16 17 info = make_pair(evt.GetTime(), disconnected ? -256 : evt.GetQoS()); 18 19 msg = disconnected ? "" : evt.GetString(); 20 } 21 22 void Callback(const EventImp &evt) 23 { 24 if (fCallback) 25 fCallback(evt); 26 } 27 28 virtual void Handler(const EventImp &evt) 29 { 30 HandlerImp(evt); 31 Callback(evt); 32 } 33 13 34 public: 14 35 DimState(const string &n, const string s="STATE") : server(n), … … 36 57 fCallback = cb; 37 58 } 38 39 void HandlerImp(const EventImp &evt)40 {41 const bool disconnected = evt.GetSize()==0;42 43 info = make_pair(evt.GetTime(), disconnected ? -256 : evt.GetQoS());44 45 msg = disconnected ? "" : evt.GetString();46 }47 48 void Callback(const EventImp &evt)49 {50 if (fCallback)51 fCallback(evt);52 }53 54 virtual void Handler(const EventImp &evt)55 {56 HandlerImp(evt);57 Callback(evt);58 }59 60 59 61 60 const Time &time() const { return info.first; } … … 132 131 class DimVersion : public DimState 133 132 { 134 public:135 DimVersion() : DimState("DIS_DNS", "VERSION_NUMBER") { }136 137 133 void Handler(const EventImp &evt) 138 134 { … … 146 142 } 147 143 144 public: 145 DimVersion() : DimState("DIS_DNS", "VERSION_NUMBER") { } 146 148 147 string version() const 149 148 { … … 165 164 { 166 165 map<string, callback> fCallbacks; 167 168 public:169 DimControl() : DimState("DIM_CONTROL") { }170 171 string file;172 string shortmsg;173 int scriptdepth;174 175 void AddCallback(const string &script, const callback &cb)176 {177 fCallbacks[script] = cb;178 }179 166 180 167 void Handler(const EventImp &evt) … … 219 206 } 220 207 208 209 public: 210 DimControl() : DimState("DIM_CONTROL") { } 211 212 string file; 213 string shortmsg; 214 int scriptdepth; 215 216 void AddCallback(const string &script, const callback &cb) 217 { 218 fCallbacks[script] = cb; 219 } 220 221 221 State description() const 222 222 {
Note:
See TracChangeset
for help on using the changeset viewer.