Changeset 10386


Ignore:
Timestamp:
Apr 18, 2011, 1:58:04 PM (9 years ago)
Author:
tbretz
Message:
Removed obsolete DistStateName
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r10379 r10386  
    2020#include "StateMachineDim.h"
    2121
     22#include <boost/lexical_cast.hpp>
     23
    2224#include "tools.h"
    2325
     
    2628
    2729using namespace std;
     30using boost::lexical_cast;
    2831
    2932const int StateMachineDim::fVersion = 42;
     
    7174    // WARNING: This exit handler is GLOBAL!
    7275    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();
    7677}
    7778
     
    8990}
    9091
    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//!
     107void 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()));
    98118    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);
    105119}
    106120
  • trunk/FACT++/src/StateMachineDim.h

    r10379 r10386  
    5454
    5555    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="");
    5756};
    5857
Note: See TracChangeset for help on using the changeset viewer.