1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 08:31:11 +00:00

Clean ups along the Electron::Tape line: ensured that the ClockReceiver is opted into only once, and that its run_for propagates all the way along the chain.

This commit is contained in:
Thomas Harte 2017-07-25 20:01:30 -04:00
parent 545683df6f
commit 8d1dacd951
3 changed files with 5 additions and 2 deletions

View File

@ -19,13 +19,13 @@
namespace Electron { namespace Electron {
class Tape: class Tape:
public ClockReceiver<Tape>,
public Storage::Tape::TapePlayer, public Storage::Tape::TapePlayer,
public Storage::Tape::Acorn::Shifter::Delegate { public Storage::Tape::Acorn::Shifter::Delegate {
public: public:
Tape(); Tape();
void run_for(const Cycles &cycles); void run_for(const Cycles &cycles);
using Storage::Tape::TapePlayer::run_for;
uint8_t get_data_register(); uint8_t get_data_register();
void set_data_register(uint8_t value); void set_data_register(uint8_t value);

View File

@ -92,7 +92,7 @@ class Tape {
Will call @c process_input_pulse instantaneously upon reaching *the end* of a pulse. Therefore a subclass Will call @c process_input_pulse instantaneously upon reaching *the end* of a pulse. Therefore a subclass
can decode pulses into data within process_input_pulse, using the supplied pulse's @c length and @c type. can decode pulses into data within process_input_pulse, using the supplied pulse's @c length and @c type.
*/ */
class TapePlayer: public ClockReceiver<TapePlayer>, public TimedEventLoop { class TapePlayer: public TimedEventLoop {
public: public:
TapePlayer(unsigned int input_clock_rate); TapePlayer(unsigned int input_clock_rate);
@ -101,6 +101,8 @@ class TapePlayer: public ClockReceiver<TapePlayer>, public TimedEventLoop {
std::shared_ptr<Storage::Tape::Tape> get_tape(); std::shared_ptr<Storage::Tape::Tape> get_tape();
void run_for(const Cycles &cycles); void run_for(const Cycles &cycles);
using TimedEventLoop::run_for;
void run_for_input_pulse(); void run_for_input_pulse();
protected: protected:

View File

@ -48,6 +48,7 @@ namespace Storage {
Advances the event loop by @c number_of_cycles cycles. Advances the event loop by @c number_of_cycles cycles.
*/ */
void run_for(const Cycles &cycles); void run_for(const Cycles &cycles);
using ClockReceiver<TimedEventLoop>::run_for;
/*! /*!
@returns the number of whole cycles remaining until the next event is triggered. @returns the number of whole cycles remaining until the next event is triggered.