1#ifndef STATECHANGEDISTRIBUTOR_HH
2#define STATECHANGEDISTRIBUTOR_HH
53 template<
typename T,
typename... Args>
57 if (viewOnlyMode || blockNewEventsDuringReplay)
return;
61 const auto&
event = recorder->
record<T>(time, std::forward<Args>(args)...);
64 T event(time, std::forward<Args>(args)...);
101 std::vector<StateChangeListener*> listeners;
103 bool viewOnlyMode =
false;
104 bool blockNewEventsDuringReplay =
false;
Assign new value to some variable and restore the original value when this object goes out of scope.
StateChange & record(EmuTime::param time, Args &&...args)
void unregisterRecorder(ReverseManager &recorder)
StateChangeDistributor(const StateChangeDistributor &)=delete
auto tempBlockNewEventsDuringReplay()
void registerListener(StateChangeListener &listener)
(Un)registers the given object to receive state change events.
void distributeNew(EmuTime::param time, Args &&...args)
Deliver the event to all registered listeners MSX input devices should call the distributeNew() versi...
StateChangeDistributor()=default
StateChangeDistributor & operator=(StateChangeDistributor &&)=delete
StateChangeDistributor(StateChangeDistributor &&)=delete
void registerRecorder(ReverseManager &recorder)
(Un)registers the given object to receive state change events.
void distributeReplay(const StateChange &event) const
void unregisterListener(StateChangeListener &listener)
bool isViewOnlyMode() const
void setViewOnlyMode(bool value)
Set viewOnlyMode.
void stopReplay(EmuTime::param time)
Explicitly stop replay.
StateChangeDistributor & operator=(const StateChangeDistributor &)=delete
~StateChangeDistributor()
Base class for all external MSX state changing events.
This file implemented 3 utility functions: