openMSX
|
#include <StateChangeDistributor.hh>
Public Member Functions | |
StateChangeDistributor ()=default | |
StateChangeDistributor (const StateChangeDistributor &)=delete | |
StateChangeDistributor (StateChangeDistributor &&)=delete | |
StateChangeDistributor & | operator= (const StateChangeDistributor &)=delete |
StateChangeDistributor & | operator= (StateChangeDistributor &&)=delete |
~StateChangeDistributor () | |
void | registerListener (StateChangeListener &listener) |
(Un)registers the given object to receive state change events. | |
void | unregisterListener (StateChangeListener &listener) |
void | registerRecorder (ReverseManager &recorder) |
(Un)registers the given object to receive state change events. | |
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. | |
void | distributeReplay (const StateChange &event) const |
void | stopReplay (EmuTime::param time) |
Explicitly stop replay. | |
void | setViewOnlyMode (bool value) |
Set viewOnlyMode. | |
bool | isViewOnlyMode () const |
auto | tempBlockNewEventsDuringReplay () |
bool | isReplaying () const |
Definition at line 14 of file StateChangeDistributor.hh.
|
default |
|
delete |
|
delete |
openmsx::StateChangeDistributor::~StateChangeDistributor | ( | ) |
Definition at line 12 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 54 of file StateChangeDistributor.hh.
References isReplaying(), openmsx::ReverseManager::record(), and stopReplay().
|
inline |
Definition at line 69 of file StateChangeDistributor.hh.
References isReplaying().
bool openmsx::StateChangeDistributor::isReplaying | ( | ) | const |
Definition at line 73 of file StateChangeDistributor.cc.
References openmsx::ReverseManager::isReplaying().
Referenced by distributeNew(), distributeReplay(), and stopReplay().
|
inline |
Definition at line 88 of file StateChangeDistributor.hh.
Referenced by openmsx::ReverseManager::isViewOnlyMode().
|
delete |
|
delete |
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 22 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 33 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 87 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 63 of file StateChangeDistributor.cc.
References isReplaying(), and openmsx::ReverseManager::stopReplay().
Referenced by distributeNew().
|
inline |
Definition at line 90 of file StateChangeDistributor.hh.
void openmsx::StateChangeDistributor::unregisterListener | ( | StateChangeListener & | listener | ) |
Definition at line 28 of file StateChangeDistributor.cc.
References move_pop_back(), and rfind_unguarded().
Referenced by openmsx::Autofire::~Autofire(), openmsx::DiskChanger::~DiskChanger(), openmsx::Keyboard::~Keyboard(), and openmsx::RecordedCommand::~RecordedCommand().
void openmsx::StateChangeDistributor::unregisterRecorder | ( | ReverseManager & | recorder | ) |
Definition at line 39 of file StateChangeDistributor.cc.