|
TuringSim
C++ framework to simulate abstract computing models
|
3 #include <transition/amnesic/amnesicMachineTransition.h>
11 template<
typename StateType_>
20 static_assert(std::is_same_v<StateType, StateType_>);
21 static_assert(std::is_same_v<StorageType, std::monostate>);
22 static_assert(std::is_same_v<ApplyHelperType, std::monostate>);
30 preState(preState), postState(postState)
38 preState(preState), postState(postState), terminating(terminating)
67 if(state == preState) {
68 return {std::monostate{}};
74 running = !terminating;
104 if(preState < other.preState) {
107 if(preState > other.preState) {
110 if(postState < other.postState) {
113 if(postState > other.postState) {
116 if(terminating == other.terminating) {
119 return other.terminating;
125 bool terminating =
false;
The transition base class for AmnesicMachine.
std::monostate ApplyHelperType
The type of apply helpers.
SimpleAmnesicMachineTransition & operator=(SimpleAmnesicMachineTransition &&)=default
The default move assignment operator.
virtual std::optional< ApplyHelperType > matchFromState(const StateType &state) const override final
Test whether the transition matches a configuration. Returned optional is empty iff the transition do...
Transitions for amnesic machines.
SimpleAmnesicMachineTransition(const StateType &preState, const StateType &postState, bool terminating)
Build a non-halting transition from a pre-state and a post-state.
StateType_ StateType
The type of states.
bool operator<(const SimpleAmnesicMachineTransition &other) const
Less than operator. Strong order.
bool isTerminating() const noexcept
Whether the transition should halts the machine.
virtual StateType applyFromState(const StateType &, bool &running) const override final
Apply a previously matching transition and return the new state, without irrelevant parameters.
SimpleAmnesicMachineTransition(const StateType &preState, const StateType &postState)
Build a non-halting transition from a pre-state and a post-state.
SimpleAmnesicMachineTransition & operator=(const SimpleAmnesicMachineTransition &)=default
The default copy assignment operator.
SimpleAmnesicMachineTransition(SimpleAmnesicMachineTransition &&)=default
The default move constructor.
A simple transition of an amnesic machine: from an explicit state to an explicit state.
SimpleAmnesicMachineTransition(const SimpleAmnesicMachineTransition &)=default
The default copy constructor.
virtual ~SimpleAmnesicMachineTransition() override=default
The default virtual destructor.
const StateType & getPreState() const noexcept
Get the pre-state.
const StateType & getPostState() const noexcept
Get the post-state.
std::monostate StorageType
The type of storage.