openMSX
JoyTap.hh
Go to the documentation of this file.
1 #ifndef JOYTAP_HH
2 #define JOYTAP_HH
3 
4 #include "JoystickDevice.hh"
5 #include "serialize_meta.hh"
6 #include "static_string_view.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class PluggingController;
12 class JoystickPort;
13 
21 class JoyTap : public JoystickDevice
22 {
23 public:
24  JoyTap(PluggingController& pluggingController, std::string name);
25  ~JoyTap() override;
26 
27  // Pluggable
28  [[nodiscard]] std::string_view getName() const override;
29  [[nodiscard]] std::string_view getDescription() const override;
30  void plugHelper(Connector& connector, EmuTime::param time) override;
31  void unplugHelper(EmuTime::param time) override;
32 
33  // JoystickDevice
34  [[nodiscard]] byte read(EmuTime::param time) override;
35  void write(byte value, EmuTime::param time) override;
36 
37  template<typename Archive>
38  void serialize(Archive& ar, unsigned version);
39 
40 protected:
41  void createPorts(static_string_view description);
42 
43 protected:
44  std::unique_ptr<JoystickPort> slaves[4];
46 
47 private:
48  const std::string name;
49 };
50 
52 
53 } // namespace openmsx
54 
55 #endif
Represents something you can plug devices into.
Definition: Connector.hh:21
This device is plugged in into the joyports and consolidates several other joysticks plugged into it.
Definition: JoyTap.hh:22
void unplugHelper(EmuTime::param time) override
Definition: JoyTap.cc:45
std::unique_ptr< JoystickPort > slaves[4]
Definition: JoyTap.hh:44
byte read(EmuTime::param time) override
Read from the joystick device.
Definition: JoyTap.cc:53
void plugHelper(Connector &connector, EmuTime::param time) override
Definition: JoyTap.cc:40
std::string_view getDescription() const override
Description for this pluggable.
Definition: JoyTap.cc:30
~JoyTap() override
void serialize(Archive &ar, unsigned version)
Definition: JoyTap.cc:70
void createPorts(static_string_view description)
Definition: JoyTap.cc:21
void write(byte value, EmuTime::param time) override
Write a value to the joystick device.
Definition: JoyTap.cc:62
JoyTap(PluggingController &pluggingController, std::string name)
Definition: JoyTap.cc:13
std::string_view getName() const override
Name used to identify this pluggable.
Definition: JoyTap.cc:35
PluggingController & pluggingController
Definition: JoyTap.hh:45
Central administration of Connectors and Pluggables.
static_string_view
This file implemented 3 utility functions:
Definition: Autofire.cc:5
REGISTER_BASE_NAME_HELPER(MSXFDC, "FDC")