Go to the documentation of this file.
37 #include "boost/format.hpp"
57 int transitionCount) :
59 transitionTypeCount_(transitionCount), transitionNames_(transitionCount),
60 defaultState_(defaultState) {
121 TransitionNameIndex::const_iterator i =
237 std::ostringstream s;
238 s <<
"digraph G {" << std::endl;
242 s <<
"\tS" << i <<
" [label=\"S" << i <<
"\\n" <<
stateName(i)
243 <<
"\"]; " << std::endl;
256 s <<
"\t/* No transition " << edgeLabel <<
" from S" << i
257 <<
" possible */" << std::endl;
260 s <<
"\t/* Transition " << edgeLabel <<
" from S" << i
261 <<
" not initialized yet */" << std::endl;
264 s <<
"\tS" << i <<
" -> " <<
"S" << vec.at(t) <<
"[label=\""
265 << edgeLabel <<
"\"];" << std::endl;
270 s <<
"}" << std::endl;
static const FSAStateIndex ILLEGAL_STATE
A state id which denotes an illegal state.
int stateCount_
Count of states in the automaton.
int FSAStateIndex
Type used for indexing the states.
TransitionMap transitions_
The state transitions. In protected to allow fast access from derived classes.
virtual std::string stateName(FSAStateIndex state) const
virtual FSAStateIndex startState() const
virtual const std::string & transitionName(FSAStateTransitionIndex transition) const
std::vector< FSAStateIndex > TransitionVector
Vector which stores the target states of for each transition type.
FiniteStateAutomaton(FSAStateTransitionIndex defaultState=ILLEGAL_STATE, int transitionCount=0)
static std::ostream & logStream()
static std::string toString(const T &source)
static const FSAStateIndex UNKNOWN_STATE
A state id which denotes an unknown (unresolved) state. Used for lazy construction of states.
TransitionNameIndex transitionIndices_
Indices of the state transition types.
virtual void setTransition(FSAStateIndex source, FSAStateIndex destination, FSAStateTransitionIndex transition)
const FSAStateTransitionIndex defaultState_
The default target state for state transitions.
virtual std::string toDotString() const
virtual bool isLegalTransition(FSAStateIndex source, FSAStateTransitionIndex transition)
virtual FSAStateTransitionIndex transitionIndex(const std::string &transitionName) const
virtual FSAStateIndex addState()
int FSAStateTransitionIndex
Type used for indexing the transitions.
virtual void setTransitionName(FSAStateTransitionIndex transition, const std::string &name)
int transitionTypeCount_
Count of different transition types in the automaton.
std::vector< std::string > transitionNames_
Names of the state transitions types (indexed from 0).
virtual ~FiniteStateAutomaton()
virtual FSAStateTransitionIndex addTransitionType(const std::string &name)
virtual FSAStateIndex destinationState(FSAStateIndex source, FSAStateTransitionIndex transition)