TuringSim
C++ framework to simulate abstract computing models
Public Member Functions | List of all members
TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle > Class Template Reference

The class to represent a simple turing machine. More...

#include <machine/simpleTuringMachine.h>

Inheritance diagram for TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle >:
Inheritance graph
[legend]
Collaboration diagram for TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle >:
Collaboration graph
[legend]

Public Member Functions

 SimpleTuringMachine ()=delete
 The default deleted constructor.
 
 SimpleTuringMachine (const SimpleTuringMachine &)=default
 The default copy constructor.
 
 SimpleTuringMachine (SimpleTuringMachine &&)=default
 The default move constructor.
 
SimpleTuringMachineoperator= (const SimpleTuringMachine &)=default
 The default copy assignment operator. More...
 
SimpleTuringMachineoperator= (SimpleTuringMachine &&)=default
 The default move assignment operator. More...
 
virtual ~SimpleTuringMachine () override=default
 The default virtual destructor.
 
 SimpleTuringMachine (const std::set< StateType > &finalStates)
 Build a SimpleTuringMachine from a set of final states. More...
 
virtual bool isHaltingState (const StateType &state) const noexcept override final
 Test if a given state is a halting one. More...
 

Detailed Description

template<typename StateType_, typename SymbolType_, bool deterministic = false, bool hasHalfTape = false, AcceptingStyle acceptingStyle = AcceptingStyle::NonAccepting>
class TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle >

The class to represent a simple turing machine.

A simple Turing machine is a Turing machine which only has simple transitions. Simple transitions are transitions that are explicit 5-tuple (pre-state, pre-symbol, post-state, post-symbol, movement). These transitions are objects of class Transition::SimpleTuringMachineTransition.

This class has a single data member: the set of final states.

All typedef types in Machine::LocalTuringMachine (and above) are still accessible.

Template Parameters
StateType_the type of the states. std::less<StateType_> and std::allocator<StateType_> must exist.
SymbolType_the type of symbols on the tape. std::less<StateType_> and std::allocator<StateType_> must exist.
deterministicwhether the machine is deterministic.
hasHalfTapewhether the tape is a half-tape or a actual complete tape.
acceptingStylewhether the machine is alternating, regularly accepting, or not.

Definition at line 34 of file simpleTuringMachine.h.

Constructor & Destructor Documentation

◆ SimpleTuringMachine()

template<typename StateType_ , typename SymbolType_ , bool deterministic = false, bool hasHalfTape = false, AcceptingStyle acceptingStyle = AcceptingStyle::NonAccepting>
TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle >::SimpleTuringMachine ( const std::set< StateType > &  finalStates)
inline

Build a SimpleTuringMachine from a set of final states.

Parameters
[in]finalStatesthe set of final states.

Definition at line 96 of file simpleTuringMachine.h.

Member Function Documentation

◆ isHaltingState()

template<typename StateType_ , typename SymbolType_ , bool deterministic = false, bool hasHalfTape = false, AcceptingStyle acceptingStyle = AcceptingStyle::NonAccepting>
virtual bool TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle >::isHaltingState ( const StateType &  state) const
inlinefinaloverridevirtualnoexcept

Test if a given state is a halting one.

Parameters
[in]statea const reference to a StateType. It represents the current state of the machine.
Returns
whether the given state is a terminal state.

Parameter state must come from getInitialStates() const, or a sequence of valid transition applications from an initial state.

Termination of Turing machines does not depend on the current storage.

See Machine::isHaltingConfiguration(const StateType& state, const StorageType& storage) const for more details on termination.

Definition at line 111 of file simpleTuringMachine.h.

◆ operator=() [1/2]

template<typename StateType_ , typename SymbolType_ , bool deterministic = false, bool hasHalfTape = false, AcceptingStyle acceptingStyle = AcceptingStyle::NonAccepting>
SimpleTuringMachine& TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle >::operator= ( const SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle > &  )
default

The default copy assignment operator.

Returns
a reference to *this.

◆ operator=() [2/2]

template<typename StateType_ , typename SymbolType_ , bool deterministic = false, bool hasHalfTape = false, AcceptingStyle acceptingStyle = AcceptingStyle::NonAccepting>
SimpleTuringMachine& TuringSim::Machine::Turing::SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle >::operator= ( SimpleTuringMachine< StateType_, SymbolType_, deterministic, hasHalfTape, acceptingStyle > &&  )
default

The default move assignment operator.

Returns
a reference to *this.

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