From: Ron F. <ro...@us...> - 2006-09-21 14:54:48
|
Update of /cvsroot/nscldaq/clients/HPReadout In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5072/HPReadout Modified Files: StateMachine.cpp StateMachine.h Log Message: Close off work for 8.1 and start maintenance work for 8.1-001. Index: StateMachine.cpp =================================================================== RCS file: /cvsroot/nscldaq/clients/HPReadout/StateMachine.cpp,v retrieving revision 8.2 retrieving revision 8.3 diff -C2 -d -r8.2 -r8.3 *** StateMachine.cpp 24 Jun 2005 11:31:17 -0000 8.2 --- StateMachine.cpp 21 Sep 2006 14:54:42 -0000 8.3 *************** *** 1030,1031 **** --- 1030,1065 ---- } } + /*! + + Allow an existing state processor to be replaced. + The new state processor is initialized, and the + old state processor returned. If there is no old + processor, NULL is returned, and the operation is equivalent to AddState. + If there are transitions to/from the state they will not be affected. + + \param name : std::string + Name of the state to replace + \param newState : CState* + Pointer to the new state. + \return CState* + \retval NULL - this is a new state. + \retval !NULL - Pointer to the previous state by that name. + */ + State* + StateMachine::replaceState(string name, + State* newState) + { + int oldId = NameToState(name); + if (oldId < 0) { + // New state: + + AddState(newState, name); + return NULL; + } + else { + State* pOld = m_StateList[oldId]; + m_StateList[oldId] = newState; + newState->OnInitialize(*this); + return pOld; + } + } Index: StateMachine.h =================================================================== RCS file: /cvsroot/nscldaq/clients/HPReadout/StateMachine.h,v retrieving revision 8.2 retrieving revision 8.3 diff -C2 -d -r8.2 -r8.3 *** StateMachine.h 24 Jun 2005 11:31:17 -0000 8.2 --- StateMachine.h 21 Sep 2006 14:54:42 -0000 8.3 *************** *** 405,408 **** --- 405,410 ---- STD(string) EventIdToName (unsigned nEvent) const; int NameToEventId (const STD(string)& rName) const; + State* replaceState(STD(string) name, + State* newState); // Operations: |