|
TuringSim
C++ framework to simulate abstract computing models
|
3 #include <listener/listener.h>
4 #include <utils/uidDispenser.h>
11 template<
typename MachineType_>
22 static_assert(MachineType::IsDeterministic::value,
23 "Machine must be deterministic.");
62 #pragma clang diagnostic push
63 #pragma clang diagnostic ignored "-Wunused-parameter"
91 numberOfTransitions++;
93 #pragma clang diagnostic pop
99 return numberOfTransitions;
104 unsigned long long int initialId = dispenser();
105 unsigned long long int numberOfTransitions{};
MachineType::StorageType StorageType
The type of the memory of the machine.
virtual ~DeterministicCounterListener() override=default
The default destructor.
virtual IdType registerPreTransition(const StateType &state, const StorageType &storage, const IdType &preId) override
Return a new unique identifier.
virtual void registerNoTransition(const IdType &id, const StateType &state, const StorageType &storage) override
Called by a TuringSim::Runner::Runner when no transition matches. Does nothing.
DeterministicCounterListener & operator=(const DeterministicCounterListener &other)=default
Copy assignment operator.
The base class for listeners.
A listener that counts transitions of deterministic machines.
virtual void registerPostTransition(const IdType &id, const StateType &state, const StorageType &storage, const TransitionType &transition, const ApplyHelperType &applyHelper, bool running) override
Called by a TuringSim::Runner::Runner after executing a transition. Increments the number of transiti...
DeterministicCounterListener & operator=(DeterministicCounterListener &&other)=default
Move assignment operator.
DeterministicCounterListener()=default
Default constructor.
unsigned long long int IdType
The type of identifiers of the listener.
MachineType::ApplyHelperType ApplyHelperType
The type of the transitions apply helper of the machine.
unsigned long long int getNumberOfTransitions() const
Gets the number of transitions executed so far.
MachineType_ MachineType
The type of the listened machine.
DeterministicCounterListener(const DeterministicCounterListener &other)=default
Copy constructor.
MachineType::TransitionType TransitionType
The type of the transitions of the machine.
The namespace of runner listener, used to follow the execution of a Machine.
MachineType::StateType StateType
The type of states of the machine.
virtual IdType getInitialId() override
Get the initial identifier, before any transition.
DeterministicCounterListener(DeterministicCounterListener &&other)=default
Move constructor.