| e8555c89 Andy McCall |
1 |
#ifndef RECORDEDCOMMAND_HH |
| 2 |
#define RECORDEDCOMMAND_HH |
| 3 |
|
| 4 |
#include "Command.hh" |
| 5 |
#include "EmuTime.hh" |
| 6 |
#include "StateChange.hh" |
| 7 |
#include "StateChangeListener.hh" |
| 8 |
#include "TclObject.hh" |
| 9 |
|
| 10 |
#include "dynarray.hh" |
| 11 |
|
| 12 |
namespace openmsx { |
| 13 |
|
| 14 |
class CommandController; |
| 15 |
class StateChangeDistributor; |
| 16 |
class Scheduler; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
class RecordedCommand : public Command, private StateChangeListener |
| 29 |
{ |
| 30 |
public: |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
virtual void execute( |
| 35 |
std::span<const TclObject> tokens, TclObject& result, |
| 36 |
EmuTime time) = 0; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
[[nodiscard]] virtual bool needRecord(std::span<const TclObject> tokens) const; |
| 44 |
|
| 45 |
protected: |
| 46 |
RecordedCommand(CommandController& commandController, |
| 47 |
StateChangeDistributor& stateChangeDistributor, |
| 48 |
Scheduler& scheduler, |
| 49 |
std::string_view name); |
| 50 |
~RecordedCommand(); |
| 51 |
|
| 52 |
private: |
| 53 |
|
| 54 |
void execute(std::span<const TclObject> tokens, TclObject& result) override; |
| 55 |
|
| 56 |
|
| 57 |
void signalStateChange(const StateChange& event) override; |
| 58 |
void stopReplay(EmuTime time) noexcept override; |
| 59 |
|
| 60 |
private: |
| 61 |
StateChangeDistributor& stateChangeDistributor; |
| 62 |
Scheduler& scheduler; |
| 63 |
TclObject dummyResultObject; |
| 64 |
TclObject* currentResultObject; |
| 65 |
}; |
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
#endif |