|
TuringSim
C++ framework to simulate abstract computing models
|
3 #include <transition/transition.h>
4 #include <machine/acceptingMachine.h>
27 typename TransitionType,
30 template <
typename...>
class TransitionContainer = std::vector,
31 template <
typename...>
class InitialStateContainer = std::vector
49 typename TransitionType_,
51 template <
typename...>
class TransitionContainer_,
52 template <
typename...>
class InitialStateContainer_
54 class Machine<TransitionType_, false, acceptingStyle, TransitionContainer_, InitialStateContainer_> :
67 typedef typename TransitionType::StateType
StateType;
116 "TransitionType must be a derived class from Transition::Transition<StateType, StorageType, ApplyHelperType>.");
197 typename TransitionType_,
199 template <typename...> class TransitionContainer_,
200 template <typename...> class InitialStateContainer_
202 class
Machine<TransitionType_, true, acceptingStyle, TransitionContainer_, InitialStateContainer_> :
206 using typename AcceptingMachine_::IsAccepting;
207 using typename AcceptingMachine_::IsAlternating;
265 "TransitionType must be a derived class from Transition::Transition<StateType, StorageType, ApplyHelperType>.");
338 std::optional<std::pair<TransitionType, ApplyHelperType>> transition = this->getMatchingTransition(state, storage);
TransitionType::ApplyHelperType ApplyHelperType
The type of the apply helper. Got from TransitionType.
Machine & operator=(const Machine &)=default
The default copy assignment operator.
Machine()=default
The default constructor.
Base class for transitions.
Machine(Machine &&)=default
The default move constructor.
InitialStateContainer_< StateType > InitialStateContainer
The type returned by getInitialStates() const that contains initial states.
Machine(const Machine &)=default
The default copy constructor.
Machine & operator=(const Machine &)=default
The default copy assignment operator.
Machine & operator=(Machine &&)=default
The default move assignment operator.
InitialStateContainer_< StateType > InitialStateContainer
The type returned by getInitialStates() const that contains initial states.
virtual ~Machine()=default
The default virtual destructor.
TransitionType::ApplyHelperType ApplyHelperType
The type of the apply helper. Got from TransitionType.
Machine(const Machine &)=default
The default copy constructor.
The namespace that contains machines. To run them, see TuringSim::Runner.
std::optional< std::pair< const TransitionType &, ApplyHelperType > > OptionalHelpedTransition
The type returned by getMatchingTransition(const StateType&, const StorageType&) const that contains ...
TransitionType::StateType StateType
The type of the machine states. Got from TransitionType.
virtual TransitionContainer getMatchingTransitions(const StateType &state, const StorageType &storage) const noexcept final
Get matching transitions for the next step.
TransitionType::StateType StateType
The type of the machine states. Got from TransitionType.
Machine(Machine &&)=default
The default move constructor.
Base class for accepting machines.
virtual StateType getInitialState() const noexcept=0
Returns the initial state of the machine.
AcceptingStyle
Whether the machine is accepting, alternating or nothing.
TransitionContainer_< std::pair< const TransitionType &, ApplyHelperType > > TransitionContainer
The type returned by getMatchingTransitions(const StateType&, const StorageType&) const that contains...
TransitionType_ TransitionType
The type of the transitions.
TransitionType::StorageType StorageType
The type of the machine memoryGot from TransitionType.
std::true_type IsDeterministic
std::true_type
TransitionContainer_< std::pair< const TransitionType &, ApplyHelperType > > TransitionContainer
The type returned by getMatchingTransitions(const StateType&, const StorageType&) const that contains...
TransitionType::StorageType StorageType
The type of the machine memoryGot from TransitionType.
Machine()=default
The default constructor.
std::optional< std::pair< const TransitionType &, ApplyHelperType > > OptionalHelpedTransition
Useless in non-deterministic machine. Is guaranteed to exist for compatibility with deterministic mac...
virtual OptionalHelpedTransition getMatchingTransition(const StateType &state, const StorageType &storage) const noexcept=0
Get matching transition for the next step.
virtual bool isHaltingConfiguration(const StateType &state, const StorageType &storage) const noexcept=0
Test if a given configuration is a halting one.
virtual InitialStateContainer getInitialStates() const noexcept=0
Returns the initial states of the machine.
TransitionType_ TransitionType
The type of the transitions.
std::false_type IsDeterministic
std::false_type
Machine & operator=(Machine &&)=default
The default move assignment operator.
virtual ~Machine()=default
The default virtual destructor.