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 "JoystickPort.hh"
6 #include "serialize_meta.hh"
7 #include "static_string_view.hh"
8 #include <optional>
9 
10 namespace openmsx {
11 
12 class PluggingController;
13 
21 class JoyTap : public JoystickDevice
22 {
23 public:
24  JoyTap(PluggingController& pluggingController, std::string name);
25 
26  // Pluggable
27  [[nodiscard]] std::string_view getName() const override;
28  [[nodiscard]] std::string_view getDescription() const override;
29  void plugHelper(Connector& connector, EmuTime::param time) override;
30  void unplugHelper(EmuTime::param time) override;
31 
32  // JoystickDevice
33  [[nodiscard]] byte read(EmuTime::param time) override;
34  void write(byte value, EmuTime::param time) override;
35 
36  template<typename Archive>
37  void serialize(Archive& ar, unsigned version);
38 
39 protected:
40  void createPorts(static_string_view description);
41 
42 protected:
43  std::optional<JoystickPort> slaves[4];
45 
46 private:
47  const std::string name;
48 };
49 
51 
52 } // namespace openmsx
53 
54 #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:41
byte read(EmuTime::param time) override
Read from the joystick device.
Definition: JoyTap.cc:49
void plugHelper(Connector &connector, EmuTime::param time) override
Definition: JoyTap.cc:36
std::string_view getDescription() const override
Description for this pluggable.
Definition: JoyTap.cc:26
void serialize(Archive &ar, unsigned version)
Definition: JoyTap.cc:66
void createPorts(static_string_view description)
Definition: JoyTap.cc:16
void write(byte value, EmuTime::param time) override
Write a value to the joystick device.
Definition: JoyTap.cc:58
std::optional< JoystickPort > slaves[4]
Definition: JoyTap.hh:43
JoyTap(PluggingController &pluggingController, std::string name)
Definition: JoyTap.cc:10
std::string_view getName() const override
Name used to identify this pluggable.
Definition: JoyTap.cc:31
PluggingController & pluggingController
Definition: JoyTap.hh:44
Central administration of Connectors and Pluggables.
static_string_view
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_BASE_NAME_HELPER(MSXFDC, "FDC")