- Timestamp:
- 04/07/11 16:38:02 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/StateMachineImp.cc
r10309 r10314 124 124 fRunning(false), fExitRequested(0) 125 125 { 126 AddStateName(kSM_NotReady, "NotReady" );127 AddStateName(kSM_Ready, "Ready" );128 AddStateName(kSM_Error, "ERROR" );129 AddStateName(kSM_FatalError, "FATAL" );126 AddStateName(kSM_NotReady, "NotReady", "State machine not ready, events are ignored."); 127 AddStateName(kSM_Ready, "Ready", "State machine ready to receive events."); 128 AddStateName(kSM_Error, "ERROR", "Common error state."); 129 AddStateName(kSM_FatalError, "FATAL", "A fatal error occured, the eventloop is stopped."); 130 130 } 131 131 … … 363 363 //! ostream to which the output should be redirected 364 364 // 365 void StateMachineImp::PrintListOfEvents(std::ostream &out) 366 { 367 for (vector<EventImp*>:: iterator c=fListOfEvents.begin(); c!=fListOfEvents.end(); c++)365 void StateMachineImp::PrintListOfEvents(std::ostream &out) const 366 { 367 for (vector<EventImp*>::const_iterator c=fListOfEvents.begin(); c!=fListOfEvents.end(); c++) 368 368 (*c)->Print(out); 369 369 } … … 373 373 //! Call PrintListOfEvents with fOut as the output stream 374 374 // 375 void StateMachineImp::PrintListOfEvents() 375 void StateMachineImp::PrintListOfEvents() const 376 376 { 377 377 PrintListOfEvents(Out()); 378 } 379 380 // -------------------------------------------------------------------------- 381 // 382 //! Print a list of all states with descriptions. 383 //! 384 //! @param out 385 //! ostream to which the output should be redirected 386 // 387 void StateMachineImp::PrintListOfStates(std::ostream &out) const 388 { 389 out << endl; 390 out << kBold << "List of available states:" << endl; 391 out << endl; 392 for (StateNames::const_iterator i=fStateNames.begin(); i!=fStateNames.end(); i++) 393 out << kBold << setw(5) << i->first << kReset << " - " << kBold << i->second.first << kReset << ": " << i->second.second << endl; 394 out << endl; 395 } 396 397 // -------------------------------------------------------------------------- 398 // 399 //! Print a list of all states with descriptions. 400 // 401 void StateMachineImp::PrintListOfStates() const 402 { 403 PrintListOfStates(Out()); 378 404 } 379 405 … … 689 715 { 690 716 const string &str = GetStateName(state); 717 if (str==Form("%d", state)) 718 return str; 691 719 return str.empty() ? Form("%d", state) : (str+Form("[%d]", state)); 692 720 } -
trunk/FACT++/src/StateMachineImp.h
r10309 r10314 119 119 const std::vector<std::string> GetEventNames() const; 120 120 121 void PrintListOfEvents(std::ostream &out); 122 void PrintListOfEvents(); 121 void PrintListOfEvents(std::ostream &out) const; 122 void PrintListOfEvents() const; 123 124 void PrintListOfStates(std::ostream &out) const; 125 void PrintListOfStates() const; 123 126 124 127
Note:
See TracChangeset
for help on using the changeset viewer.