Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

mpcl::automaton::TStreamableDfa< TState, TEvent > Class Template Reference

#include <streamable_dfa.hh>

Inheritance diagram for mpcl::automaton::TStreamableDfa< TState, TEvent >:

mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent > mpcl::automaton::TExecutableStreamableDfa< TState, TEvent > List of all members.

Public Types

typedef IStreamable::char_type char_type
 Character type.

typedef IStreamable::traits_type traits_type
 Traits type.


Public Methods

 TStreamableDfa (TEventHandler< TEvent > &rtSOURCE_EVENT_HANDLER)
void start (void)
 Starts the automaton.

bool isFinal (const TString &rkySOURCE_STATE) const
bool isFinal (const char *pkcSOURCE_STATE) const

Protected Types

typedef TDeterministicFiniteAutomaton<
TState, TEvent >::TPair 
TPair
 Imports class 'TPair'.

typedef TDeterministicFiniteAutomaton<
TState, TEvent >::TTransitionMap 
TTransitionMap
 Imports class 'TTransitionMap'.

typedef TDeterministicFiniteAutomaton<
TState, TEvent >::TStateSet 
TStateSet
 Imports class 'TStateSet'.

typedef TMap< TString, TEvent > TStringToEventMap
 String to event map type.

typedef TMap< TString, TState > TStringToStateMap
 String to state map type.


Protected Methods

void read (std::basic_istream< char_type, traits_type > &rtSOURCE_ISTREAM)
void readFooter (TMatcher &rtSOURCE_REM)
void readHeader (TMatcher &rtSOURCE_REM)
void readTransitionTable (TMatcher &rtSOURCE_REM)
virtual void check (void) const
 Check invariants.

TString eventToString (const TEvent &krtSOURCE_EVENT) const throw (TNotFoundException)
TString stateToString (const TState &krtSOURCE_STATE) const throw (TNotFoundException)
void write (std::basic_ostream< char_type, traits_type > &rtTARGET_OSTREAM) const
void writeFooter (std::basic_ostream< char_type, traits_type > &rtTARGET_OSTREAM) const
void writeHeader (std::basic_ostream< char_type, traits_type > &rtTARGET_OSTREAM) const
void writeTransitionTable (std::basic_ostream< char_type, traits_type > &rtTARGET_OSTREAM) const

Protected Attributes

TEventHandler< TEvent > & rtEventHandler
 Event handler.

TStringToEventMap tStringToEventMap
 String to event map.

TStringToStateMap tStringToStateMap
 String to state map.

TString yDescription
 String with DESC-tag text.

TString yName
 String with DFAML-tag attribute named 'name'.

TString yPublic
 String with !DOCTYPE-tag attribute named 'public'.

TString ySystem
 String with !DOCTYPE-tag attribute named 'system'.


Detailed Description

template<typename TState, typename TEvent>
class mpcl::automaton::TStreamableDfa< TState, TEvent >

Streamable Deterministic Finite Automaton.
Parameters:
TState  State type name (must be an integer type like).
TEvent  Event type name.
Warning:
All string elements contained once read are converted to lowercase.

Definition at line 61 of file streamable_dfa.hh.


Constructor & Destructor Documentation

template<typename TState, typename TEvent>
mpcl::automaton::TStreamableDfa< TState, TEvent >::TStreamableDfa TEventHandler< TEvent > &    rtSOURCE_EVENT_HANDLER [inline]
 

Builds a new instance without loading any DFAML document. This is due to that at this stage, it has no information about states nor events.

Definition at line 173 of file streamable_dfa.hh.


Member Function Documentation

template<typename TState, typename TEvent>
mpcl::text::TString mpcl::automaton::TStreamableDfa< TState, TEvent >::eventToString const TEvent &    krtSOURCE_EVENT const throw (TNotFoundException) [inline, protected]
 

Returns the string corresponding to event krtSOURCE_EVENT.

Parameters:
krtSOURCE_EVENT  Source event.
Exceptions:
TNotFoundException  If there is no such event.

Definition at line 586 of file streamable_dfa.hh.

Referenced by mpcl::automaton::TStreamableDfa< TState, TEvent >::writeTransitionTable().

template<typename TState, typename TEvent>
bool mpcl::automaton::TStreamableDfa< TState, TEvent >::isFinal const char *    pkcSOURCE_STATE const [inline]
 

Returns true if pkcSOURCE_STATE is a final state.

Parameters:
pkcSOURCE_STATE  Source state.
Returns:
True if pkcSOURCE_STATE is a final state.

Definition at line 269 of file streamable_dfa.hh.

template<typename TState, typename TEvent>
bool mpcl::automaton::TStreamableDfa< TState, TEvent >::isFinal const TString &    rkySOURCE_STATE const [inline]
 

Returns true if rkySOURCE_STATE is a final state.

Parameters:
rkySOURCE_STATE  Source state.
Returns:
True if rkySOURCE_STATE is a final state.

Definition at line 259 of file streamable_dfa.hh.

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::read std::basic_istream< char_type, traits_type > &    rtSOURCE_ISTREAM [inline, protected]
 

Reads the instance from stream rtSOURCE_STREAM.

Parameters:
rtSOURCE_STREAM  Source stream.

Reimplemented in mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >.

Definition at line 287 of file streamable_dfa.hh.

References mpcl::automaton::TStreamableDfa< TState, TEvent >::check(), mpcl::automaton::TStreamableDfa< TState, TEvent >::readFooter(), mpcl::automaton::TStreamableDfa< TState, TEvent >::readHeader(), mpcl::automaton::TStreamableDfa< TState, TEvent >::readTransitionTable(), mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tTransitionMap, and mpcl::automaton::TStreamableDfa< TState, TEvent >::yPublic.

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::readFooter TMatcher &    rtSOURCE_REM [inline, protected]
 

Reads footer using rtSOURCE_REM for parsing.

Parameters:
rtSOURCE_REM  Source regular expression matcher.

Definition at line 318 of file streamable_dfa.hh.

Referenced by mpcl::automaton::TStreamableDfa< TState, TEvent >::read(), and mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >::read().

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::readHeader TMatcher &    rtSOURCE_REM [inline, protected]
 

Reads header using rtSOURCE_REM for parsing.

Parameters:
rtSOURCE_REM  Source regular expression matcher.

Definition at line 333 of file streamable_dfa.hh.

References mpcl::automaton::TStreamableDfa< TState, TEvent >::yDescription, mpcl::automaton::TStreamableDfa< TState, TEvent >::yName, mpcl::automaton::TStreamableDfa< TState, TEvent >::yPublic, and mpcl::automaton::TStreamableDfa< TState, TEvent >::ySystem.

Referenced by mpcl::automaton::TStreamableDfa< TState, TEvent >::read(), and mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >::read().

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::readTransitionTable TMatcher &    rtSOURCE_REM [inline, protected]
 

Reads transition table using rtSOURCE_REM for parsing.

Parameters:
rtSOURCE_REM  Source regular expression matcher.

Definition at line 380 of file streamable_dfa.hh.

References mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tFinalStateSet, mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tInitialState, mpcl::text::TString, mpcl::automaton::TStreamableDfa< TState, TEvent >::tStringToEventMap, mpcl::automaton::TStreamableDfa< TState, TEvent >::tStringToStateMap, and mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tTransitionMap.

Referenced by mpcl::automaton::TStreamableDfa< TState, TEvent >::read(), and mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >::read().

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::start void    [inline]
 

Starts the automaton.

Map with state with input event to state name transitions type. It's used to hold the unresolved bindings from pairs of state and event, to state names.

Definition at line 499 of file streamable_dfa.hh.

References mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::current(), mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::move(), mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::next(), mpcl::automaton::TStreamableDfa< TState, TEvent >::rtEventHandler, and mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tInitialState.

template<typename TState, typename TEvent>
mpcl::text::TString mpcl::automaton::TStreamableDfa< TState, TEvent >::stateToString const TState &    krtSOURCE_STATE const throw (TNotFoundException) [inline, protected]
 

Returns the string corresponding to state krtSOURCE_STATE.

Parameters:
krtSOURCE_STATE  Source state.
Exceptions:
TNotFoundException  If there is no such state.

Definition at line 611 of file streamable_dfa.hh.

Referenced by mpcl::automaton::TStreamableDfa< TState, TEvent >::writeTransitionTable().

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::write std::basic_ostream< char_type, traits_type > &    rtTARGET_OSTREAM const [inline, protected]
 

Writes the instance onto stream rtTARGET_OSTREAM.

Parameters:
rtTARGET_OSTREAM  Target output stream.

Reimplemented in mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >.

Definition at line 217 of file streamable_dfa.hh.

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::writeFooter std::basic_ostream< char_type, traits_type > &    rtTARGET_OSTREAM const [inline, protected]
 

Writes footer onto stream rtTARGET_OSTREAM.

Parameters:
rtTARGET_OSTREAM  Target output stream.

Definition at line 228 of file streamable_dfa.hh.

Referenced by mpcl::automaton::TStreamableDfa< int, TTestEvent >::write(), and mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >::write().

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::writeHeader std::basic_ostream< char_type, traits_type > &    rtTARGET_OSTREAM const [inline, protected]
 

Writes header onto stream rtTARGET_OSTREAM.

Parameters:
rtTARGET_OSTREAM  Target output stream.

Definition at line 636 of file streamable_dfa.hh.

References mpcl::automaton::TStreamableDfa< TState, TEvent >::yDescription, mpcl::automaton::TStreamableDfa< TState, TEvent >::yName, mpcl::automaton::TStreamableDfa< TState, TEvent >::yPublic, and mpcl::automaton::TStreamableDfa< TState, TEvent >::ySystem.

Referenced by mpcl::automaton::TStreamableDfa< int, TTestEvent >::write(), and mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >::write().

template<typename TState, typename TEvent>
void mpcl::automaton::TStreamableDfa< TState, TEvent >::writeTransitionTable std::basic_ostream< char_type, traits_type > &    rtTARGET_OSTREAM const [inline, protected]
 

Writes transition table onto stream rtTARGET_OSTREAM.

Parameters:
rtTARGET_OSTREAM  Target output stream.

Definition at line 662 of file streamable_dfa.hh.

References mpcl::automaton::TStreamableDfa< TState, TEvent >::eventToString(), mpcl::automaton::TStreamableDfa< TState, TEvent >::stateToString(), mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tFinalStateSet, mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tInitialState, mpcl::automaton::TStreamableDfa< TState, TEvent >::tStringToStateMap, and mpcl::automaton::TDeterministicFiniteAutomaton< TState, TEvent >::tTransitionMap.

Referenced by mpcl::automaton::TStreamableDfa< int, TTestEvent >::write(), and mpcl::automaton::TExecutableStreamableDfa< TState, TEvent >::write().


The documentation for this class was generated from the following file:
Generated on Mon Oct 13 02:35:25 2003 for MPCL by doxygen1.2.18