DiaDes  0.1
DIAgnosis of Discrete-Event System
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Diades::Automata::Experimental::AutFileDescriptor< _Event > Class Template Reference

#include <AutFileDescriptor.hh>

Classes

class  Transition
 

Public Types

using State = size_t
 
using Event = _Event
 
using MyReadEvent = ReadEvent< Event >
 
using MyPrintEvent = PrintEvent< Event >
 
using ConstTransitionIterator = typename std::set< Transition >::const_iterator
 
using TransitionIterator = typename std::set< Transition >::iterator
 
using ConstInitialIterator = typename std::set< State >::const_iterator
 
using InitialIterator = typename std::set< State >::iterator
 

Public Member Functions

 AutFileDescriptor ()=default
 
 AutFileDescriptor (AutFileDescriptor const &other)=default
 
AutFileDescriptoroperator= (AutFileDescriptor const &other)=default
 
 AutFileDescriptor (AutFileDescriptor &&other)=default
 
AutFileDescriptoroperator= (AutFileDescriptor &&other)=default
 
virtual ~AutFileDescriptor ()=default
 
virtual bool readStream (std::istream &stream)
 
virtual bool toStream (std::ostream &stream)
 
size_t numberOfStates () const
 
size_t setNumberOfStates (size_t nbStates)
 
size_t numberOfTransitions () const
 
ConstTransitionIterator transBegin () const
 
ConstTransitionIterator transEnd () const
 
std::pair< AutFileDescriptor::TransitionIterator, bool > addTransition (Transition &&transition)
 
TransitionIterator removeTransition (const Transition &transition)
 
virtual void clear ()
 
ConstInitialIterator initialBegin () const
 
ConstInitialIterator initialEnd () const
 
std::pair< InitialIterator, bool > setInitial (State s)
 
size_t numberOfInitialStates () const
 
void clearInitial ()
 

Private Member Functions

bool autFileTransitionEvent (const std::string &betweenFirstAndLastComma, Event &event)
 
bool autFileSourceState (const std::string &beforeFirstComma, State &source)
 
bool autFileTargetState (const std::string &afterLastComma, State &target)
 
std::istream & autFileTransition (std::istream &stream, State &source, Event &event, State &target, bool &ok)
 
std::istream & autFileHeader (std::istream &stream, State &initialState, size_t &numberOfTransitions, size_t &numberOfStates, bool &ok)
 

Private Attributes

size_t _nbStates
 
std::set< Transition_transitions
 
std::set< State_initials
 

Detailed Description

template<typename _Event>
class Diades::Automata::Experimental::AutFileDescriptor< _Event >

This class records as an object all the pieces of information that is contained in a '.aut' file

See also
http://cadp.inria.fr/man/aut.html about the aut file format: The first line of an AUT file has the following syntax: des (<initial-state>, <number-of-transitions>, <number-of-states>) The "des" keywords stands for "descriptor". The <number-of-states> must be greater or equal to 1, because there is always at least one state, the initial state. State numbers range between 0 and <number-of-states> - 1. The <initial-state> is always equal to 0. The remainder of the AUT file consists of one line per transition, in an arbitrary order. Each remaining line has the following syntax: (<from-state>, <label>, <to-state>) where <from-state> and <to-state> are state numbers and where <label> can take two possible forms: <unquoted-label> consists of a character string starting with a letter, and followed by zero, one, or many letters, digits, or underscore characters. <quoted-label> consists of a character string starting with a double quote and ending with a double quote. Between these two double quotes, there can be zero, one or many printable characters; the meaning of "printable" is given by the POSIX isprint() function with locale "C" (namely, ASCII characters with decimal codes in the range from 32 to 126, bounds included). No other assumption should be made about the characters present between these two double quotes. In particular, the double quote character itself may be present, and may not necessarily be "escaped" in some way (e.g., preceded by a backslash, as in C).

Definition at line 145 of file AutFileDescriptor.hh.

Member Typedef Documentation

◆ ConstInitialIterator

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::ConstInitialIterator = typename std::set< State >::const_iterator

Definition at line 334 of file AutFileDescriptor.hh.

◆ ConstTransitionIterator

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::ConstTransitionIterator = typename std::set< Transition >::const_iterator

Definition at line 332 of file AutFileDescriptor.hh.

◆ Event

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::Event = _Event

Definition at line 153 of file AutFileDescriptor.hh.

◆ InitialIterator

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::InitialIterator = typename std::set< State >::iterator

Definition at line 335 of file AutFileDescriptor.hh.

◆ MyPrintEvent

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::MyPrintEvent = PrintEvent<Event>

Definition at line 155 of file AutFileDescriptor.hh.

◆ MyReadEvent

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::MyReadEvent = ReadEvent<Event>

Definition at line 154 of file AutFileDescriptor.hh.

◆ State

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::State = size_t

Definition at line 152 of file AutFileDescriptor.hh.

◆ TransitionIterator

template<typename _Event>
using Diades::Automata::Experimental::AutFileDescriptor< _Event >::TransitionIterator = typename std::set< Transition >::iterator

Definition at line 333 of file AutFileDescriptor.hh.

Constructor & Destructor Documentation

◆ AutFileDescriptor() [1/3]

template<typename _Event>
Diades::Automata::Experimental::AutFileDescriptor< _Event >::AutFileDescriptor ( )
default

Default constructor

◆ AutFileDescriptor() [2/3]

template<typename _Event>
Diades::Automata::Experimental::AutFileDescriptor< _Event >::AutFileDescriptor ( AutFileDescriptor< _Event > const &  other)
default

Copy constructor (default)

Parameters
other

◆ AutFileDescriptor() [3/3]

template<typename _Event>
Diades::Automata::Experimental::AutFileDescriptor< _Event >::AutFileDescriptor ( AutFileDescriptor< _Event > &&  other)
default

Move constructor (default)

Parameters
other

◆ ~AutFileDescriptor()

template<typename _Event>
virtual Diades::Automata::Experimental::AutFileDescriptor< _Event >::~AutFileDescriptor ( )
virtualdefault

Destructor

Member Function Documentation

◆ addTransition()

template<typename _Event>
std::pair<AutFileDescriptor::TransitionIterator, bool> Diades::Automata::Experimental::AutFileDescriptor< _Event >::addTransition ( Transition &&  transition)
inline

Add a new transition

Parameters
transitiona new transition
Returns
the added transition as an pair with the iterator on the added transition and a boolean that asserts that the transition was not already added

Definition at line 508 of file AutFileDescriptor.hh.

◆ autFileHeader()

template<typename _Event>
std::istream& Diades::Automata::Experimental::AutFileDescriptor< _Event >::autFileHeader ( std::istream &  stream,
State initialState,
size_t &  numberOfTransitions,
size_t &  numberOfStates,
bool &  ok 
)
inlineprivate
Parameters
streamthe input stream
initialStatethe recorded initial state
numberOfTransitionsthe recorded number of transitions
numberOfStatesthe recorded number of states
okthe resulting status (true if the stream reading is ok and data are filled in, false otherwise)
Returns
the input stream

The first line of an AUT file has the following syntax: des (<initial-state>, <number-of-transitions>, <number-of-states>) The "des" keywords stands for "descriptor". The <number-of-states> must be greater or equal to 1, because there is always at least one state, the initial state. State numbers range between 0 and <number-of-states> - 1. The <initial-state> is always equal to 0.

Definition at line 794 of file AutFileDescriptor.hh.

◆ autFileSourceState()

template<typename _Event>
bool Diades::Automata::Experimental::AutFileDescriptor< _Event >::autFileSourceState ( const std::string &  beforeFirstComma,
State source 
)
inlineprivate
Parameters
beforeFirstCommastring like this: '(source'
sourcethe resulting source state
Returns
true if the parsing is successful

Definition at line 619 of file AutFileDescriptor.hh.

◆ autFileTargetState()

template<typename _Event>
bool Diades::Automata::Experimental::AutFileDescriptor< _Event >::autFileTargetState ( const std::string &  afterLastComma,
State target 
)
inlineprivate
Parameters
afterLastCommastring like this: 'target)'
targetthe resulting target state
Returns
true if the parsing is successful

Definition at line 674 of file AutFileDescriptor.hh.

◆ autFileTransition()

template<typename _Event>
std::istream& Diades::Automata::Experimental::AutFileDescriptor< _Event >::autFileTransition ( std::istream &  stream,
State source,
Event event,
State target,
bool &  ok 
)
inlineprivate
Parameters
streamthe input stream that should contain a line like this '(source,label,target)'
sourcethe resulting source
labelthe resulting label
targetthe resulting target
oktrue if the parsing is successful
Returns
the input stream

Definition at line 723 of file AutFileDescriptor.hh.

◆ autFileTransitionEvent()

template<typename _Event>
bool Diades::Automata::Experimental::AutFileDescriptor< _Event >::autFileTransitionEvent ( const std::string &  betweenFirstAndLastComma,
Event event 
)
inlineprivate
Parameters
betweenFirstAndLastCommastring like this: 'label'
labelthe resulting label
Returns
true if the parsing is successful

Definition at line 604 of file AutFileDescriptor.hh.

◆ clear()

template<typename _Event>
virtual void Diades::Automata::Experimental::AutFileDescriptor< _Event >::clear ( )
inlinevirtual

Clear the descriptor

Reimplemented in Diades::Automata::Experimental::DdAutFileDescriptor.

Definition at line 536 of file AutFileDescriptor.hh.

◆ clearInitial()

template<typename _Event>
void Diades::Automata::Experimental::AutFileDescriptor< _Event >::clearInitial ( )
inline

Clear the initial state

Definition at line 589 of file AutFileDescriptor.hh.

◆ initialBegin()

template<typename _Event>
ConstInitialIterator Diades::Automata::Experimental::AutFileDescriptor< _Event >::initialBegin ( ) const
inline
Returns
the begin iterator over the range of initial states

Definition at line 548 of file AutFileDescriptor.hh.

◆ initialEnd()

template<typename _Event>
ConstInitialIterator Diades::Automata::Experimental::AutFileDescriptor< _Event >::initialEnd ( ) const
inline
Returns
the end iterator over the range of initial states

Definition at line 558 of file AutFileDescriptor.hh.

◆ numberOfInitialStates()

template<typename _Event>
size_t Diades::Automata::Experimental::AutFileDescriptor< _Event >::numberOfInitialStates ( ) const
inline
Returns
the number of initial states

Definition at line 580 of file AutFileDescriptor.hh.

◆ numberOfStates()

template<typename _Event>
size_t Diades::Automata::Experimental::AutFileDescriptor< _Event >::numberOfStates ( ) const
inline
Returns
the number of states

Definition at line 455 of file AutFileDescriptor.hh.

◆ numberOfTransitions()

template<typename _Event>
size_t Diades::Automata::Experimental::AutFileDescriptor< _Event >::numberOfTransitions ( ) const
inline
Returns
the number of transitions

Definition at line 476 of file AutFileDescriptor.hh.

◆ operator=() [1/2]

template<typename _Event>
AutFileDescriptor& Diades::Automata::Experimental::AutFileDescriptor< _Event >::operator= ( AutFileDescriptor< _Event > const &  other)
default

Assignement (default)

Parameters
other
Returns
the current Transition

◆ operator=() [2/2]

template<typename _Event>
AutFileDescriptor& Diades::Automata::Experimental::AutFileDescriptor< _Event >::operator= ( AutFileDescriptor< _Event > &&  other)
default

Move assignement (default)

Parameters
other
Returns
the current Transition

◆ readStream()

template<typename _Event>
virtual bool Diades::Automata::Experimental::AutFileDescriptor< _Event >::readStream ( std::istream &  stream)
inlinevirtual
Parameters
streaminput stream Reads the stream to fill the AutFileDescriptor If the AutFileDescriptor was already filled, it is cleared first
Returns
true if the file parsing is a success. If not a success, the AutFileDescriptor is cleared.

Reimplemented in Diades::Automata::Experimental::DdAutFileDescriptor.

Definition at line 377 of file AutFileDescriptor.hh.

◆ removeTransition()

template<typename _Event>
TransitionIterator Diades::Automata::Experimental::AutFileDescriptor< _Event >::removeTransition ( const Transition transition)
inline

Remove a transition

Parameters
transitionto remove
Returns
an iterator on the transition after the one that is removed or transEnd() if not found

Definition at line 521 of file AutFileDescriptor.hh.

◆ setInitial()

template<typename _Event>
std::pair<InitialIterator, bool> Diades::Automata::Experimental::AutFileDescriptor< _Event >::setInitial ( State  s)
inline
Parameters
sa State
Returns
the iterator position of the state s in the initial states the boolean is true if the state was not previously in this set

Definition at line 570 of file AutFileDescriptor.hh.

◆ setNumberOfStates()

template<typename _Event>
size_t Diades::Automata::Experimental::AutFileDescriptor< _Event >::setNumberOfStates ( size_t  nbStates)
inline
Parameters
nbStatesthe number of states
Returns
the number of states

Definition at line 466 of file AutFileDescriptor.hh.

◆ toStream()

template<typename _Event>
virtual bool Diades::Automata::Experimental::AutFileDescriptor< _Event >::toStream ( std::ostream &  stream)
inlinevirtual
Parameters
streamoutput stream Write the content of the AutFileDescriptor in the output stream
Returns
true if the writing is a success (valid AutFileDescriptor).

Reimplemented in Diades::Automata::Experimental::DdAutFileDescriptor.

Definition at line 425 of file AutFileDescriptor.hh.

◆ transBegin()

template<typename _Event>
ConstTransitionIterator Diades::Automata::Experimental::AutFileDescriptor< _Event >::transBegin ( ) const
inline
Returns
an iterator on the first transition

Definition at line 486 of file AutFileDescriptor.hh.

◆ transEnd()

template<typename _Event>
ConstTransitionIterator Diades::Automata::Experimental::AutFileDescriptor< _Event >::transEnd ( ) const
inline
Returns
an iterator on the end of the transition range

Definition at line 496 of file AutFileDescriptor.hh.

Member Data Documentation

◆ _initials

template<typename _Event>
std::set<State> Diades::Automata::Experimental::AutFileDescriptor< _Event >::_initials
private

Definition at line 328 of file AutFileDescriptor.hh.

◆ _nbStates

template<typename _Event>
size_t Diades::Automata::Experimental::AutFileDescriptor< _Event >::_nbStates
private

Definition at line 326 of file AutFileDescriptor.hh.

◆ _transitions

template<typename _Event>
std::set< Transition > Diades::Automata::Experimental::AutFileDescriptor< _Event >::_transitions
private

Definition at line 327 of file AutFileDescriptor.hh.


The documentation for this class was generated from the following file: