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 "noncopyable.hh"
6 #include "serialize_meta.hh"
7 #include "string_ref.hh"
8 #include <memory>
9 
10 namespace openmsx {
11 
12 class Pluggable;
13 class PluggingController;
14 
21 class Connector : private noncopyable
22 {
23 public:
27  const std::string& getName() const;
28 
32  virtual const std::string getDescription() const = 0;
33 
38  virtual string_ref getClass() const = 0;
39 
45  virtual void plug(Pluggable& device, EmuTime::param time);
46 
52  virtual void unplug(EmuTime::param time);
53 
57  Pluggable& getPlugged() const;
58 
60  return pluggingController;
61  }
62 
63  template<typename Archive>
64  void serialize(Archive& ar, unsigned version);
65 
66 protected:
73  Connector(PluggingController& pluggingController,
74  string_ref name, std::unique_ptr<Pluggable> dummy);
75 
76  virtual ~Connector();
77 
78 private:
79  PluggingController& pluggingController;
80  const std::string name;
81  const std::unique_ptr<Pluggable> dummy;
82  Pluggable* plugged;
83 };
84 
85 REGISTER_BASE_CLASS(Connector, "Connector");
86 
87 } // namespace openmsx
88 
89 #endif