123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include "Pluggable.hh"
- #include "PlugException.hh"
- #include "Connector.hh"
- #include "unreachable.hh"
- #include <cassert>
- using std::string;
- namespace openmsx {
- Pluggable::Pluggable()
- {
- setConnector(nullptr);
- }
- const string& Pluggable::getName() const
- {
- static const string name;
- return name;
- }
- void Pluggable::plug(Connector& newConnector, EmuTime::param time)
- {
- assert(getClass() == newConnector.getClass());
- if (connector) {
- throw PlugException(getName(), " already plugged in ",
- connector->getName(), '.');
- }
- plugHelper(newConnector, time);
- setConnector(&newConnector);
- }
- void Pluggable::unplug(EmuTime::param time)
- {
- try {
- unplugHelper(time);
- } catch (MSXException&) {
- UNREACHABLE;
- }
- setConnector(nullptr);
- }
- } // namespace openmsx
|