Ignore:
Timestamp:
Apr 7, 2011, 3:46:15 PM (9 years ago)
Author:
tbretz
Message:
Added typedef for StateNames; changed the getter such that they can now be declared const.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/StateMachineImp.cc

    r10300 r10309  
    650650//!    as string.
    651651//!
    652 const string StateMachineImp::GetStateName(int state) /*const*/
    653 {
    654     const string &str = fStateNames[state].first;
    655     return str.empty() ? Form("%d", state) : str;
     652const 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;
    656656}
    657657
     
    666666//!    returned.
    667667//!
    668 const string StateMachineImp::GetStateDesc(int state) /*const*/
    669 {
    670     return fStateNames[state].second;
     668const string StateMachineImp::GetStateDesc(int state) const
     669{
     670    const StateNames::const_iterator i = fStateNames.find(state);
     671    return i==fStateNames.end() ? "" : i->second.second;
    671672}
    672673
     
    685686//!
    686687//
    687 const string StateMachineImp::GetStateDescription(int state) /*const*/
     688const string StateMachineImp::GetStateDescription(int state) const
    688689{
    689690    const string &str = GetStateName(state);
Note: See TracChangeset for help on using the changeset viewer.