11 std::string name_, std::unique_ptr<Pluggable> dummy_)
12 : pluggingController(pluggingController_)
13 , name(
std::move(name_))
14 , dummy(
std::move(dummy_))
15 , plugged(dummy.get())
27 device.
plug(*
this, time);
34 plugged = dummy.get();
37template<
typename Archive>
41 if constexpr (!Archive::IS_LOADER) {
42 if (plugged != dummy.get()) {
46 ar.serialize(
"plugName", plugName);
48 if constexpr (!Archive::IS_LOADER) {
49 if (!plugName.empty()) {
51 ar.serializePolymorphic(
"pluggable", *plugged);
55 if (plugName.empty()) {
57 plugged = dummy.get();
64 ar.skipSection(
false);
66 ar.serializePolymorphic(
"pluggable", *plugged);
69 "Pluggable \"", plugName,
"\" failed to replug: ",
71 pluggable->setConnector(
nullptr);
72 plugged = dummy.get();
77 "Pluggable \"", plugName,
"\" was plugged in, "
78 "but is not available anymore on this system, "
79 "so it will be ignored.");
81 plugged = dummy.get();
void printWarning(std::string_view message)
Represents something you can plug devices into.
void serialize(Archive &ar, unsigned version)
virtual void unplug(EmuTime::param time)
This unplugs the currently inserted Pluggable from this Connector.
virtual void plug(Pluggable &device, EmuTime::param time)
This plugs a Pluggable in this Connector.
Connector(const Connector &)=delete
Thrown when a plug action fails.
void plug(Connector &connector, EmuTime::param time)
This method is called when this pluggable is inserted in a connector.
void unplug(EmuTime::param time)
This method is called when this pluggable is removed from a connector.
void setConnector(Connector *conn)
virtual std::string_view getName() const
Name used to identify this pluggable.
Central administration of Connectors and Pluggables.
void unregisterConnector(Connector &connector)
Pluggable * findPluggable(std::string_view name) const
Return the Pluggable with given name or nullptr if there is none with this name.
void registerConnector(Connector &connector)
Connectors must be (un)registered.
CliComm & getCliComm()
Access to the MSX specific CliComm, so that Connectors can get it.
This file implemented 3 utility functions:
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)