TuringSim
C++ framework to simulate abstract computing models
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ > Class Template Referenceabstract

A class to run a simulate the execution of a Machine. More...

#include <runner/machineRunner.h>

Inheritance diagram for TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >:
Inheritance graph
[legend]
Collaboration diagram for TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >:
Collaboration graph
[legend]

Public Types

typedef MachineType_ MachineType
 The type of the simulated machine.
 
typedef ListenerType_ ListenerType
 The type of the listener.
 
typedef MachineType::StateType StateType
 The type of states of the machine.
 
typedef MachineType::StorageType StorageType
 The type of the memory of the machine.
 
typedef MachineType::TransitionType TransitionType
 The type of transitions of the machine.
 
typedef MachineType::ApplyHelperType ApplyHelperType
 The type of transitions apply helpers of the machine.
 
typedef ListenerType::IdType ListenerIdType
 The type of identifiers used by the listener.
 

Public Member Functions

 MachineRunner (const MachineType &machine, ListenerType &listener)
 Construct a MachineRunner from a Machine. More...
 
constexpr MachineRunner (const MachineRunner &other)=default
 Copy a runner. More...
 
constexpr MachineRunner (MachineRunner &&other)=default
 Move a runner. More...
 
constexpr MachineRunneroperator= (const MachineRunner &other)=default
 Copy a runner. More...
 
constexpr MachineRunneroperator= (MachineRunner &&other)=default
 Move a runner. More...
 
virtual ~MachineRunner () override=default
 Destroy the runner.
 
virtual void step (size_t nbIter=1)=0
 Execute a given number of steps of the machine, one step by default. More...
 
virtual void exec ()=0
 Run the machine until it halts. More...
 

Protected Member Functions

virtual void oneStep ()=0
 Execute one step of the machine.
 

Protected Attributes

const MachineTypemachine
 The simulated machine.
 
ListenerTypelistener
 The listener.
 

Detailed Description

template<typename MachineType_, typename ListenerType_>
class TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >

A class to run a simulate the execution of a Machine.

Template Parameters
MachineType_the type of the simulated machine. Must be a subclass of TuringSim::Machine::Machine.
ListenerType_the type of the listener that follows the execution of the listener.

The listener is used to observe the execution of the machine.

This base class if pretty poor since we want to allow deterministic and non-deterministic executions, using arbitrary strategy.

Definition at line 132 of file machineRunner.h.

Constructor & Destructor Documentation

◆ MachineRunner() [1/3]

template<typename MachineType_ , typename ListenerType_ >
TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >::MachineRunner ( const MachineType machine,
ListenerType listener 
)
inline

Construct a MachineRunner from a Machine.

Parameters
[in]machinethe machine to run.
[in]listenerthe listener that monitors the machine execution. The machine is capture by const reference.

Definition at line 181 of file machineRunner.h.

◆ MachineRunner() [2/3]

template<typename MachineType_ , typename ListenerType_ >
constexpr TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >::MachineRunner ( const MachineRunner< MachineType_, ListenerType_ > &  other)
constexprdefault

Copy a runner.

Parameters
[in]otherthe runner to copy.

◆ MachineRunner() [3/3]

template<typename MachineType_ , typename ListenerType_ >
constexpr TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >::MachineRunner ( MachineRunner< MachineType_, ListenerType_ > &&  other)
constexprdefault

Move a runner.

Parameters
[in,out]otherthe runner to move.

Member Function Documentation

◆ exec()

template<typename MachineType_ , typename ListenerType_ >
virtual void TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >::exec ( )
pure virtual

◆ operator=() [1/2]

template<typename MachineType_ , typename ListenerType_ >
constexpr MachineRunner& TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >::operator= ( const MachineRunner< MachineType_, ListenerType_ > &  other)
constexprdefault

Copy a runner.

Parameters
[in]otherthe runner to copy.
Returns
a reference to *this.

◆ operator=() [2/2]

template<typename MachineType_ , typename ListenerType_ >
constexpr MachineRunner& TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >::operator= ( MachineRunner< MachineType_, ListenerType_ > &&  other)
constexprdefault

Move a runner.

Parameters
[in,out]otherthe runner to move.
Returns
a reference to *this.

◆ step()

template<typename MachineType_ , typename ListenerType_ >
virtual void TuringSim::Runner::MachineRunner< MachineType_, ListenerType_ >::step ( size_t  nbIter = 1)
pure virtual

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