TuringSim
C++ framework to simulate abstract computing models
Public Member Functions | List of all members
TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ > Class Template Referenceabstract

The transition base class for AmnesicMachine. More...

#include <transition/amnesic/amnesicMachineTransition.h>

Inheritance diagram for TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >:
Inheritance graph
[legend]
Collaboration diagram for TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >:
Collaboration graph
[legend]

Public Member Functions

 AmnesicMachineTransition ()=default
 The default constructor.
 
 AmnesicMachineTransition (const AmnesicMachineTransition &)=default
 The default copy constructor.
 
 AmnesicMachineTransition (AmnesicMachineTransition &&)=default
 The default move constructor.
 
AmnesicMachineTransitionoperator= (const AmnesicMachineTransition &)=default
 The default copy assignment operator. More...
 
AmnesicMachineTransitionoperator= (AmnesicMachineTransition &&)=default
 The default move assignment operator. More...
 
virtual ~AmnesicMachineTransition () override=default
 The default virtual destructor.
 
virtual std::optional< ApplyHelperTypematch (const StateType &state, const StorageType &storage) const override final
 Test whether the transition matches a configuration. Returned optional is empty iff the transition does not match. More...
 
virtual std::optional< ApplyHelperTypematchFromState (const StateType &state) const =0
 Test whether the transition matches a configuration. Returned optional is empty iff the transition does not match. More...
 
virtual StateType apply (const StateType &state, StorageType &storage, ApplyHelperType &&helper, bool &running) const override final
 Apply a previously matching transition and return the new state. More...
 
virtual StateType applyFromState (const StateType &state, bool &running) const =0
 Apply a previously matching transition and return the new state, without irrelevant parameters. More...
 
- Public Member Functions inherited from TuringSim::Transition::Transition< StateType_, std::monostate, std::monostate >
 Transition ()=default
 The default constructor.
 
 Transition (const Transition &)=default
 The default copy constructor.
 
 Transition (Transition &&)=default
 The default move constructor.
 
Transitionoperator= (const Transition &)=default
 The default copy assignment operator. More...
 
Transitionoperator= (Transition &&)=default
 The default move assignment operator. More...
 
virtual ~Transition ()=default
 The default virtual destructor.
 

Additional Inherited Members

- Public Types inherited from TuringSim::Transition::Transition< StateType_, std::monostate, std::monostate >
typedef StateType_ StateType
 The type of states.
 
typedef std::monostate StorageType
 The type of storage.
 
typedef std::monostate ApplyHelperType
 The type of apply helpers.
 

Detailed Description

template<typename StateType_>
class TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >

The transition base class for AmnesicMachine.

Template Parameters
StateType_the type of states.

This class holds no data member.

Definition at line 16 of file amnesicMachineTransition.h.

Member Function Documentation

◆ apply()

template<typename StateType_ >
virtual StateType TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >::apply ( const StateType state,
StorageType storage,
ApplyHelperType &&  helper,
bool &  running 
) const
inlinefinaloverridevirtual

Apply a previously matching transition and return the new state.

Parameters
[in]statethe pre-state.
[in]storagethe pre-storage.
[in]helperthe helper, returned by Transition::match(const StateType& state, const StorageType& storage) const.
[in,out]runningwhether the machine is still running. If false, the same state is returned, and running is not updated. If true, the transition is applied, and running may be changed if the transition stop the machine.
Returns
The new state.
Exceptions
ConfigurationDoesNotMatchExceptionif the transition does not match, optionally.

If we try to apply a transition that does not match, the behavior is undefined.

Implements TuringSim::Transition::Transition< StateType_, std::monostate, std::monostate >.

Definition at line 83 of file amnesicMachineTransition.h.

Here is the call graph for this function:

◆ applyFromState()

template<typename StateType_ >
virtual StateType TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >::applyFromState ( const StateType state,
bool &  running 
) const
pure virtual

Apply a previously matching transition and return the new state, without irrelevant parameters.

Parameters
[in]statethe pre-state.
[in,out]runningwhether the machine is still running. If false, the same state is returned, and running is not updated. If true, the transition is applied, and running may be changed if the transition stop the machine.
Returns
The new state.
Exceptions
ConfigurationDoesNotMatchExceptionif the transition does not match, optionally.

If we try to apply a transition that does not match, the behavior is undefined.

Implemented in TuringSim::Transition::Amnesic::SimpleAmnesicMachineTransition< StateType_ >.

Here is the caller graph for this function:

◆ match()

template<typename StateType_ >
virtual std::optional<ApplyHelperType> TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >::match ( const StateType state,
const StorageType storage 
) const
inlinefinaloverridevirtual

Test whether the transition matches a configuration. Returned optional is empty iff the transition does not match.

Parameters
[in]statethe pre-state.
[in]storagethe pre-storage.
Returns
If the transition matches, a non-empty apply helper. If it does not matches, an empty option.

A FSM transition looks only at the current letter.

Implements TuringSim::Transition::Transition< StateType_, std::monostate, std::monostate >.

Definition at line 59 of file amnesicMachineTransition.h.

Here is the call graph for this function:

◆ matchFromState()

template<typename StateType_ >
virtual std::optional<ApplyHelperType> TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >::matchFromState ( const StateType state) const
pure virtual

Test whether the transition matches a configuration. Returned optional is empty iff the transition does not match.

Parameters
[in]statethe pre-state.
Returns
If the transition matches, a non-empty apply helper. If it does not matches, an empty option.

A FSM transition looks only at the current letter.

Implemented in TuringSim::Transition::Amnesic::SimpleAmnesicMachineTransition< StateType_ >.

Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename StateType_ >
AmnesicMachineTransition& TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >::operator= ( AmnesicMachineTransition< StateType_ > &&  )
default

The default move assignment operator.

Returns
a reference to *this.

◆ operator=() [2/2]

template<typename StateType_ >
AmnesicMachineTransition& TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >::operator= ( const AmnesicMachineTransition< StateType_ > &  )
default

The default copy assignment operator.

Returns
a reference to *this.

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