TuringSim
C++ framework to simulate abstract computing models
listener.h
1 #pragma once
2 
6 namespace TuringSim::Listener {
17  template<typename MachineType_, typename IdType_>
18  class Listener {
19  public:
23  typedef IdType_ IdType;
24 
28  typedef MachineType_ MachineType;
29 
33  typedef typename MachineType::StateType StateType;
34 
38  typedef typename MachineType::StorageType StorageType;
39 
43  typedef typename MachineType::TransitionType TransitionType;
44 
48  typedef typename MachineType::ApplyHelperType ApplyHelperType;
49 
52  Listener() = default;
53 
57  Listener(const Listener& other) = default;
58 
62  Listener(Listener&& other) = default;
63 
68  Listener& operator=(const Listener& other) = default;
69 
74  Listener& operator=(Listener&& other) = default;
75 
78  virtual ~Listener() = default;
79 
83  virtual IdType getInitialId() = 0;
84 
93  virtual IdType registerPreTransition(const StateType& state, const StorageType& storage, const IdType& preId) = 0;
94 
100  virtual void registerNoTransition(const IdType& id, const StateType& state, const StorageType& storage) = 0;
101 
110  virtual void registerPostTransition(const IdType& id, const StateType& state, const StorageType& storage, const TransitionType& transition, const ApplyHelperType& applyHelper, bool running) = 0;
111  };
112 }
TuringSim::Listener::Listener::StorageType
MachineType::StorageType StorageType
The type of the memory of the machine.
Definition: listener.h:38
TuringSim::Listener::Listener::operator=
Listener & operator=(Listener &&other)=default
Move assignment operator.
TuringSim::Listener::Listener::registerPreTransition
virtual IdType registerPreTransition(const StateType &state, const StorageType &storage, const IdType &preId)=0
Called by a TuringSim::Runner::Runner before a transition.
TuringSim::Listener::Listener
The base class for listeners.
Definition: listener.h:18
TuringSim::Listener::Listener::Listener
Listener(Listener &&other)=default
Move constructor.
TuringSim::Listener::Listener::getInitialId
virtual IdType getInitialId()=0
Get the initial identifier, before any transition.
TuringSim::Listener::Listener::registerPostTransition
virtual void registerPostTransition(const IdType &id, const StateType &state, const StorageType &storage, const TransitionType &transition, const ApplyHelperType &applyHelper, bool running)=0
Called by a TuringSim::Runner::Runner after executing a transition.
TuringSim::Listener::Listener::~Listener
virtual ~Listener()=default
The default destructor.
TuringSim::Listener::Listener::IdType
IdType_ IdType
The type of identifiers of the listener.
Definition: listener.h:23
TuringSim::Listener::Listener::registerNoTransition
virtual void registerNoTransition(const IdType &id, const StateType &state, const StorageType &storage)=0
Called by a TuringSim::Runner::Runner when no transition matches.
TuringSim::Listener::Listener::ApplyHelperType
MachineType::ApplyHelperType ApplyHelperType
The type of the transitions apply helper of the machine.
Definition: listener.h:48
TuringSim::Listener::Listener::MachineType
MachineType_ MachineType
The type of the listened machine.
Definition: listener.h:28
TuringSim::Listener::Listener::TransitionType
MachineType::TransitionType TransitionType
The type of the transitions of the machine.
Definition: listener.h:43
TuringSim::Listener
The namespace of runner listener, used to follow the execution of a Machine.
Definition: deterministicCounterListener.h:6
TuringSim::Listener::Listener::Listener
Listener()=default
Default constructor.
TuringSim::Listener::Listener::StateType
MachineType::StateType StateType
The type of states of the machine.
Definition: listener.h:33
TuringSim::Listener::Listener::Listener
Listener(const Listener &other)=default
Copy constructor.
TuringSim::Listener::Listener::operator=
Listener & operator=(const Listener &other)=default
Copy assignment operator.