openMSX
Connector.hh
Go to the documentation of this file.
1#ifndef CONNECTOR_HH
2#define CONNECTOR_HH
3
4#include "EmuTime.hh"
5#include "serialize_meta.hh"
6#include <memory>
7#include <string_view>
8
9namespace openmsx {
10
11class Pluggable;
12class PluggingController;
13
21{
22public:
23 Connector(const Connector&) = delete;
24 Connector(Connector&&) = delete;
25 Connector& operator=(const Connector&) = delete;
27
31 [[nodiscard]] const std::string& getName() const { return name; }
32
36 [[nodiscard]] virtual std::string_view getDescription() const = 0;
37
42 [[nodiscard]] virtual std::string_view getClass() const = 0;
43
49 virtual void plug(Pluggable& device, EmuTime::param time);
50
56 virtual void unplug(EmuTime::param time);
57
61 [[nodiscard]] Pluggable& getPlugged() const { return *plugged; }
62
64 return pluggingController;
65 }
66
67 template<typename Archive>
68 void serialize(Archive& ar, unsigned version);
69
70protected:
77 Connector(PluggingController& pluggingController,
78 std::string name, std::unique_ptr<Pluggable> dummy);
79
80 ~Connector();
81
82private:
83 PluggingController& pluggingController;
84 const std::string name;
85 const std::unique_ptr<Pluggable> dummy;
86 Pluggable* plugged;
87};
88
90
91} // namespace openmsx
92
93#endif
Represents something you can plug devices into.
Definition Connector.hh:21
const std::string & getName() const
Name that identifies this connector.
Definition Connector.hh:31
virtual std::string_view getClass() const =0
A Connector belong to a certain class.
Connector & operator=(Connector &&)=delete
Pluggable & getPlugged() const
Returns the Pluggable currently plugged in.
Definition Connector.hh:61
virtual std::string_view getDescription() const =0
Get a description for this connector.
void serialize(Archive &ar, unsigned version)
Definition Connector.cc:38
virtual void unplug(EmuTime::param time)
This unplugs the currently inserted Pluggable from this Connector.
Definition Connector.cc:31
PluggingController & getPluggingController() const
Definition Connector.hh:63
virtual void plug(Pluggable &device, EmuTime::param time)
This plugs a Pluggable in this Connector.
Definition Connector.cc:25
Connector(Connector &&)=delete
Connector & operator=(const Connector &)=delete
Connector(const Connector &)=delete
Central administration of Connectors and Pluggables.
This file implemented 3 utility functions:
Definition Autofire.cc:11
#define REGISTER_BASE_CLASS(CLASS, NAME)