Changeset 10386 for trunk/FACT++/src
- Timestamp:
- 04/18/11 13:58:04 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/StateMachineDim.cc
r10379 r10386 20 20 #include "StateMachineDim.h" 21 21 22 #include <boost/lexical_cast.hpp> 23 22 24 #include "tools.h" 23 25 … … 26 28 27 29 using namespace std; 30 using boost::lexical_cast; 28 31 29 32 const int StateMachineDim::fVersion = 42; … … 71 74 // WARNING: This exit handler is GLOBAL! 72 75 DimServer::addExitHandler(this); 73 74 for (StateNames::const_iterator i=fStateNames.begin(); i!=fStateNames.end(); i++) 75 DistStateName(i->first, i->second.first, i->second.second); 76 SetDefaultStateNames(); 76 77 } 77 78 … … 89 90 } 90 91 91 void StateMachineDim::DistStateName(const int state, const std::string &name, const std::string &doc) 92 { 93 ostringstream out; 94 out << reinterpret_cast<char*>(fDescriptionStates.itsData); 95 out << state << ':' << name << '=' << doc << '\n'; 96 97 fDescriptionStates.setData(const_cast<char*>(out.str().c_str())); 92 // -------------------------------------------------------------------------- 93 // 94 //! Overwrite StateMachineImp::AddStateName. In addition to storing the 95 //! state locally it is also propagated through Dim in the STATE_LIST 96 //! service. 97 //! 98 //! @param state 99 //! Number of the state to which a name should be assigned 100 //! 101 //! @param name 102 //! A name which should be assigned to the state, e.g. "Tracking" 103 //! 104 //! @param doc 105 //! A explanatory text describing the state 106 //! 107 void StateMachineDim::AddStateName(const int state, const std::string &name, const std::string &doc) 108 { 109 StateMachineImp::AddStateName(state, name, doc); 110 111 const string str0 = reinterpret_cast<char*>(fDescriptionStates.itsData); 112 const string str1 = lexical_cast<string>(state)+':'+name+'='; 113 114 if (str0.find(str1)!=string::npos) 115 return; 116 117 fDescriptionStates.setData(const_cast<char*>((str0+str1+doc+'\n').c_str())); 98 118 fDescriptionStates.updateService(); 99 }100 101 void StateMachineDim::AddStateName(const int state, const std::string &name, const std::string &doc)102 {103 StateMachineImp::AddStateName(state, name, doc);104 DistStateName(state, name, doc);105 119 } 106 120 -
trunk/FACT++/src/StateMachineDim.h
r10379 r10386 54 54 55 55 void AddStateName(const int state, const std::string &name, const std::string &doc=""); 56 void DistStateName(const int state, const std::string &name, const std::string &doc="");57 56 }; 58 57
Note:
See TracChangeset
for help on using the changeset viewer.