Changeset 14541
- Timestamp:
- 10/30/12 12:53:07 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/DimState.h
r14538 r14541 161 161 for (auto it=states.begin(); it!=states.end(); it++) 162 162 if (it->index==state()) 163 return *it;163 return State(it->index, it->name, it->comment, time()); 164 164 165 165 return State(kNotAvailable, "n/a"); … … 245 245 State description() const 246 246 { 247 return State(state(), version() );247 return State(state(), version(), "", time()); 248 248 } 249 249 }; … … 307 307 State description() const 308 308 { 309 return State(state(), "Current label" );309 return State(state(), "Current label", "", time()); 310 310 } 311 311 }; -
trunk/FACT++/src/State.cc
r10429 r14541 40 40 //! Descriptive text of the state, e.g. "Connection to hardware established." 41 41 // 42 State::State(int i, const std::string &n, const std::string &c )43 : index(i), name(Trim(n)), comment(Trim(c)) 42 State::State(int i, const std::string &n, const std::string &c, const Time &t) 43 : index(i), name(Trim(n)), comment(Trim(c)), time(t) 44 44 { 45 45 } -
trunk/FACT++/src/State.h
r10395 r14541 5 5 #include <vector> 6 6 7 #include "Time.h" 8 7 9 struct State 8 10 { … … 10 12 std::string name; /// Name (e.g. 'Connected') 11 13 std::string comment; /// Description (e.g. 'Connection to hardware established.') 14 Time time; /// Time of state change 12 15 13 16 static std::vector<State> SplitStates(const std::string &buffer); … … 15 18 static bool Compare(const State &i, const State &j) { return i.index<j.index; } 16 19 17 State(int i , const std::string &n, const std::string &c="");20 State(int i=-256, const std::string &n="", const std::string &c="", const Time &t=Time(Time::none)); 18 21 }; 19 22 -
trunk/FACT++/src/StateMachineDimControl.cc
r14440 r14541 294 294 fMutex.lock(); 295 295 const State state = dim->description(); 296 fCurrentStateList[server] = make_pair(dim->state(), state.index==DimState::kNotAvailable?"":state.name);297 fMutex.unlock(); 298 299 return GetCurrentState(); 300 } 301 302 pair<int32_t, string>StateMachineDimControl::GetServerState(const std::string &server)296 fCurrentStateList[server] = State(state.index, state.index==DimState::kNotAvailable?"":state.name, state.comment, state.time); 297 fMutex.unlock(); 298 299 return GetCurrentState(); 300 } 301 302 State StateMachineDimControl::GetServerState(const std::string &server) 303 303 { 304 304 const lock_guard<mutex> guard(fMutex); 305 305 306 306 const auto it = fCurrentStateList.find(server); 307 return it==fCurrentStateList.end() ? make_pair(-256, string()) : it->second;307 return it==fCurrentStateList.end() ? State() : it->second; 308 308 } 309 309 -
trunk/FACT++/src/StateMachineDimControl.h
r14132 r14541 18 18 std::set<Service> fServiceList; 19 19 std::map<std::string, std::vector<std::string>> fCommandList; 20 std::map<std::string, std::pair<int32_t, std::string>> fCurrentStateList;20 std::map<std::string, State> fCurrentStateList; 21 21 std::map<std::pair<std::string, int32_t>, std::pair<std::string, std::string>> fStateDescriptionList; 22 22 std::map<std::string, std::vector<Description>> fServiceDescriptionList; … … 59 59 int PrintDescription(std::ostream &out, bool iscmd, const std::string &serv="", const std::string &service=""); 60 60 61 std::pair<int32_t, std::string>GetServerState(const std::string &server);61 State GetServerState(const std::string &server); 62 62 63 63 void SendDimCommand(const std::string &server, std::string str, std::ostream &lout);
Note:
See TracChangeset
for help on using the changeset viewer.