- Timestamp:
- 04/07/11 15:46:15 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/StateMachineImp.cc
r10300 r10309 650 650 //! as string. 651 651 //! 652 const string StateMachineImp::GetStateName(int state) /*const*/653 { 654 const string &str = fStateNames[state].first;655 return str.empty() ? Form("%d", state) : str;652 const string StateMachineImp::GetStateName(int state) const 653 { 654 const StateNames::const_iterator i = fStateNames.find(state); 655 return i==fStateNames.end() || i->second.first.empty() ? Form("%d", state) : i->second.first; 656 656 } 657 657 … … 666 666 //! returned. 667 667 //! 668 const string StateMachineImp::GetStateDesc(int state) /*const*/ 669 { 670 return fStateNames[state].second; 668 const string StateMachineImp::GetStateDesc(int state) const 669 { 670 const StateNames::const_iterator i = fStateNames.find(state); 671 return i==fStateNames.end() ? "" : i->second.second; 671 672 } 672 673 … … 685 686 //! 686 687 // 687 const string StateMachineImp::GetStateDescription(int state) /*const*/688 const string StateMachineImp::GetStateDescription(int state) const 688 689 { 689 690 const string &str = GetStateName(state); -
trunk/FACT++/src/StateMachineImp.h
r10294 r10309 31 31 int fCurrentState; /// Current state of the state machine 32 32 33 typedef std::map<const int, std::pair<std::string, std::string>> StateNames; 34 33 35 /// Human readable names associated with the states 34 std::map<const int, std::pair<std::string, std::string>>fStateNames;36 StateNames fStateNames; 35 37 36 38 std::vector<EventImp*> fListOfEvents; /// List of available commands as setup by user … … 121 123 122 124 123 const std::string GetStateName(int state) /*const*/;124 const std::string GetStateName() { return GetStateName(fCurrentState); }125 126 const std::string GetStateDesc(int state) /*const*/;127 const std::string GetStateDesc() { return GetStateDesc(fCurrentState); }128 129 const std::string GetStateDescription(int state) /*const*/;130 const std::string GetStateDescription() { return GetStateDescription(fCurrentState); }125 const std::string GetStateName(int state) const; 126 const std::string GetStateName() const { return GetStateName(fCurrentState); } 127 128 const std::string GetStateDesc(int state) const; 129 const std::string GetStateDesc() const { return GetStateDesc(fCurrentState); } 130 131 const std::string GetStateDescription(int state) const; 132 const std::string GetStateDescription() const { return GetStateDescription(fCurrentState); } 131 133 }; 132 134
Note:
See TracChangeset
for help on using the changeset viewer.