|
TuringSim
C++ framework to simulate abstract computing models
|
Base class for transitions. More...
#include <transition/transition.h>
Public Types | |
| typedef StateType_ | StateType |
| The type of states. | |
| typedef StorageType_ | StorageType |
| The type of storage. | |
| typedef ApplyHelperType_ | ApplyHelperType |
| The type of apply helpers. | |
Public Member Functions | |
| Transition ()=default | |
| The default constructor. | |
| Transition (const Transition &)=default | |
| The default copy constructor. | |
| Transition (Transition &&)=default | |
| The default move constructor. | |
| Transition & | operator= (const Transition &)=default |
| The default copy assignment operator. More... | |
| Transition & | operator= (Transition &&)=default |
| The default move assignment operator. More... | |
| virtual | ~Transition ()=default |
| The default virtual destructor. | |
| virtual std::optional< ApplyHelperType > | match (const StateType &state, const StorageType &storage) 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 =0 |
| Apply a previously matching transition and return the new state. More... | |
Base class for transitions.
| StateType_ | Type of states. |
| StorageType_ | Type of storage. |
| ApplyHelperType_ | Type used to forward information from match to apply. |
Definition at line 67 of file transition.h.
|
pure virtual |
Apply a previously matching transition and return the new state.
| [in] | state | the pre-state. |
| [in,out] | storage | the storage, modified in place. |
| [in] | helper | the helper, returned by Transition::match(const StateType& state, const StorageType& storage) const. |
| [in,out] | running | whether 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. |
| ConfigurationDoesNotMatchException | if 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::AmnesicMachineTransition< StateType_ >.
|
pure virtual |
Test whether the transition matches a configuration. Returned optional is empty iff the transition does not match.
| [in] | state | the pre-state. |
| [in] | storage | the pre-storage. |
The helper is valid as long as state exists and storage is not modified
Implemented in TuringSim::Transition::Turing::LocalTuringMachineTransition< StateType_, SymbolType_, ApplyHelperType_, hasHalfTape >, TuringSim::Transition::Turing::LocalTuringMachineTransition< std::shared_ptr< const State::MConfiguration::MConfiguration< NodeStateType_ > >, SymbolType_, MConfigurationTuringMachineTransitionApplyHelper< NodeStateType_ >, hasHalfTape >, TuringSim::Transition::Turing::LocalTuringMachineTransition< std::shared_ptr< const State::MConfiguration::MConfiguration< T > >, T, MConfigurationTuringMachineTransitionApplyHelper< T >, hasHalfTape >, TuringSim::Transition::Turing::LocalTuringMachineTransition< StateType_, SymbolType_, std::monostate, hasHalfTape >, TuringSim::Transition::Turing::LocalTuringMachineTransition< std::shared_ptr< const State::MConfiguration::MConfiguration< std::string > >, std::string, MConfigurationTuringMachineTransitionApplyHelper< std::string >, hasHalfTape >, TuringSim::Transition::FSM::FiniteStateMachineTransition< StateType_, SymbolType_ >, and TuringSim::Transition::Amnesic::AmnesicMachineTransition< StateType_ >.
|
default |
The default copy assignment operator.
*this.
|
default |
The default move assignment operator.
*this.