Minor refactoring of AVox/SaveKey classes (use delegating c'tor).

This commit is contained in:
Stephen Anthony 2017-10-05 20:57:02 -02:30
parent 55a281bf34
commit f38b40415f
3 changed files with 12 additions and 19 deletions

View File

@ -119,4 +119,4 @@ void AtariVox::reset()
{
myLastDataWriteCycle = 0;
SaveKey::reset();
}
}

View File

@ -31,11 +31,8 @@ SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
const string& eepromfile)
: Controller(jack, event, system, Controller::SaveKey)
: SaveKey(jack, event, system, eepromfile, Controller::SaveKey)
{
myEEPROM = make_unique<MT24LC256>(eepromfile, system);
myDigitalPinState[One] = myDigitalPinState[Two] = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -79,4 +76,4 @@ void SaveKey::write(DigitalPin pin, bool value)
default:
break;
}
}
}

View File

@ -33,18 +33,6 @@
class SaveKey : public Controller
{
public:
/**
Create a new SaveKey controller plugged into the specified jack
@param jack The jack the controller is plugged into
@param event The event object to use for events
@param system The system using this controller
@param eepromfile The file containing the EEPROM data
@param type The type for this controller
*/
SaveKey(Jack jack, const Event& event, const System& system,
const string& eepromfile, Type type);
/**
Create a new SaveKey controller plugged into the specified jack
@ -55,9 +43,17 @@ class SaveKey : public Controller
*/
SaveKey(Jack jack, const Event& event, const System& system,
const string& eepromfile);
virtual ~SaveKey() = default;
protected:
/**
Delegating constructor currently used by both this class and classes
that inherit from SaveKey (currently, AtariVox)
*/
SaveKey(Jack jack, const Event& event, const System& system,
const string& eepromfile, Type type);
public:
using Controller::read;