openMSX
|
#include <StateChangeDistributor.hh>
Public Member Functions | |
StateChangeDistributor ()=default | |
~StateChangeDistributor () | |
void | registerListener (StateChangeListener &listener) |
(Un)registers the given object to receive state change events. More... | |
void | unregisterListener (StateChangeListener &listener) |
void | registerRecorder (ReverseManager &recorder) |
(Un)registers the given object to receive state change events. More... | |
void | unregisterRecorder (ReverseManager &recorder) |
template<typename T , typename... Args> | |
void | distributeNew (EmuTime::param time, Args &&...args) |
Deliver the event to all registered listeners MSX input devices should call the distributeNew() version, only the replayer should call the distributeReplay() version. More... | |
void | distributeReplay (const StateChange &event) |
void | stopReplay (EmuTime::param time) |
Explicitly stop replay. More... | |
void | setViewOnlyMode (bool value) |
Set viewOnlyMode. More... | |
bool | isViewOnlyMode () const |
bool | isReplaying () const |
Definition at line 12 of file StateChangeDistributor.hh.
|
default |
openmsx::StateChangeDistributor::~StateChangeDistributor | ( | ) |
Definition at line 9 of file StateChangeDistributor.cc.
|
inline |
Deliver the event to all registered listeners MSX input devices should call the distributeNew() version, only the replayer should call the distributeReplay() version.
These two different versions are used to detect the transition from replayed events to live events. Note that a transition from live to replay is not allowed. This transition should be done by creating a new StateChangeDistributor object (object always starts in replay state), but this is automatically taken care of because replay always starts from a freshly restored snapshot. Instead of a 'StateChange' parameter this method takes a template-parameter 'T' and run-time parameters 'time' and '...arg' that together can construct a 'StateChange' subclass 'T'.
Definition at line 48 of file StateChangeDistributor.hh.
References isReplaying(), openmsx::ReverseManager::record(), and stopReplay().
|
inline |
Definition at line 63 of file StateChangeDistributor.hh.
References isReplaying().
bool openmsx::StateChangeDistributor::isReplaying | ( | ) | const |
Definition at line 70 of file StateChangeDistributor.cc.
References openmsx::ReverseManager::isReplaying().
Referenced by distributeNew(), distributeReplay(), and stopReplay().
|
inline |
Definition at line 82 of file StateChangeDistributor.hh.
Referenced by openmsx::ReverseManager::isViewOnlyMode().
void openmsx::StateChangeDistributor::registerListener | ( | StateChangeListener & | listener | ) |
(Un)registers the given object to receive state change events.
listener | Listener that will be notified when an event arrives. |
Definition at line 19 of file StateChangeDistributor.cc.
Referenced by openmsx::Autofire::Autofire(), openmsx::Keyboard::Keyboard(), and openmsx::RecordedCommand::RecordedCommand().
void openmsx::StateChangeDistributor::registerRecorder | ( | ReverseManager & | recorder | ) |
(Un)registers the given object to receive state change events.
recorder | Listener that will be notified when an event arrives. These two methods are very similar to the two above. The difference is that there can be at most one registered recorder. This recorder object is always the first object that gets informed about state changing events. |
Definition at line 30 of file StateChangeDistributor.cc.
|
inline |
Set viewOnlyMode.
Call this if you don't want distributeNew events to stop replaying and go to live events (value=true).
value | false if new events stop replay mode |
Definition at line 81 of file StateChangeDistributor.hh.
void openmsx::StateChangeDistributor::stopReplay | ( | EmuTime::param | time | ) |
Explicitly stop replay.
Should be called when replay->live transition cannot be signaled via a new event, so for example when we reach the end of the replay log. It's OK to call this method when replay was already stopped, in that case this call has no effect.
Definition at line 60 of file StateChangeDistributor.cc.
References isReplaying(), and openmsx::ReverseManager::stopReplay().
Referenced by distributeNew().
void openmsx::StateChangeDistributor::unregisterListener | ( | StateChangeListener & | listener | ) |
Definition at line 25 of file StateChangeDistributor.cc.
References move_pop_back(), and rfind_unguarded().
Referenced by openmsx::Joystick::unplugHelper(), openmsx::Autofire::~Autofire(), openmsx::DiskChanger::~DiskChanger(), openmsx::Keyboard::~Keyboard(), and openmsx::RecordedCommand::~RecordedCommand().
void openmsx::StateChangeDistributor::unregisterRecorder | ( | ReverseManager & | recorder | ) |
Definition at line 36 of file StateChangeDistributor.cc.