Changeset 10294 for trunk/FACT++/src/StateMachineImp.cc
- Timestamp:
- 04/07/11 08:42:34 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/StateMachineImp.cc
r10289 r10294 472 472 //! received commands is properly extracted. No check is done. 473 473 // 474 EventImp *StateMachineImp::AddTransition(int targetstate, const char *name, const char *states, const char *fmt)474 EventImp &StateMachineImp::AddTransition(int targetstate, const char *name, const char *states, const char *fmt) 475 475 { 476 476 EventImp *evt = CreateEvent(targetstate, name, fmt); … … 483 483 fListOfEvents.push_back(evt); 484 484 485 return evt;485 return *evt; 486 486 } 487 487 … … 507 507 //! by this command. 508 508 // 509 EventImp *StateMachineImp::AddTransition(int targetstate, const char *name, int s1, int s2, int s3, int s4, int s5)509 EventImp &StateMachineImp::AddTransition(int targetstate, const char *name, int s1, int s2, int s3, int s4, int s5) 510 510 { 511 511 return AddTransition(targetstate, name, Form("%d %d %d %d %d", s1, s2, s3, s4, s5).c_str(), ""); … … 539 539 //! by this command. 540 540 // 541 EventImp *StateMachineImp::AddTransition(int targetstate, const char *name, const char *fmt, int s1, int s2, int s3, int s4, int s5)541 EventImp &StateMachineImp::AddTransition(int targetstate, const char *name, const char *fmt, int s1, int s2, int s3, int s4, int s5) 542 542 { 543 543 return AddTransition(targetstate, name, Form("%d %d %d %d %d", s1, s2, s3, s4, s5).c_str(), fmt); … … 566 566 //! received commands is properly extracted. No check is done. 567 567 //! 568 EventImp *StateMachineImp::AddConfiguration(const char *name, const char *states, const char *fmt)568 EventImp &StateMachineImp::AddConfiguration(const char *name, const char *states, const char *fmt) 569 569 { 570 570 return AddTransition(-1, name, states, fmt); … … 587 587 //! by this command. 588 588 // 589 EventImp *StateMachineImp::AddConfiguration(const char *name, int s1, int s2, int s3, int s4, int s5)589 EventImp &StateMachineImp::AddConfiguration(const char *name, int s1, int s2, int s3, int s4, int s5) 590 590 { 591 591 return AddTransition(-1, name, s1, s2, s3, s4, s5); … … 614 614 //! by this command. 615 615 // 616 EventImp *StateMachineImp::AddConfiguration(const char *name, const char *fmt, int s1, int s2, int s3, int s4, int s5)616 EventImp &StateMachineImp::AddConfiguration(const char *name, const char *fmt, int s1, int s2, int s3, int s4, int s5) 617 617 { 618 618 return AddTransition(-1, name, fmt, s1, s2, s3, s4, s5); … … 634 634 //! @todo FIX THE DOCU 635 635 // 636 void StateMachineImp::AddStateName(const int state, const std::string &name )637 { 638 if (fStateNames[state]. empty())639 fStateNames[state] = name;636 void StateMachineImp::AddStateName(const int state, const std::string &name, const std::string &doc) 637 { 638 if (fStateNames[state].first.empty()) 639 fStateNames[state] = make_pair(name, doc); 640 640 } 641 641 … … 652 652 const string StateMachineImp::GetStateName(int state) /*const*/ 653 653 { 654 const string &str = fStateNames[state] ;654 const string &str = fStateNames[state].first; 655 655 return str.empty() ? Form("%d", state) : str; 656 } 657 658 const string StateMachineImp::GetStateDoc(int state) /*const*/ 659 { 660 return fStateNames[state].second; 656 661 } 657 662 … … 673 678 const string StateMachineImp::GetStateDescription(int state) /*const*/ 674 679 { 675 const string &str = fStateNames[state];680 const string &str = GetStateName(state); 676 681 return str.empty() ? Form("%d", state) : (str+Form("[%d]", state)); 677 682 }
Note:
See TracChangeset
for help on using the changeset viewer.