WiimoteDevice: Make equality actually constant

This commit is contained in:
capitalistspz 2024-09-26 05:52:40 +01:00
parent e66984bd41
commit b21c8dedd7
5 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ public:
virtual bool write_data(const std::vector<uint8>& data) = 0;
virtual std::optional<std::vector<uint8_t>> read_data() = 0;
virtual bool operator==(WiimoteDevice& o) const = 0;
virtual bool operator==(const WiimoteDevice& o) const = 0;
};
using WiimoteDevicePtr = std::shared_ptr<WiimoteDevice>;

View File

@ -47,8 +47,8 @@ std::vector<WiimoteDevicePtr> HidapiWiimote::get_devices() {
return wiimote_devices;
}
bool HidapiWiimote::operator==(WiimoteDevice& rhs) const {
auto other = dynamic_cast<HidapiWiimote*>(&rhs);
bool HidapiWiimote::operator==(const WiimoteDevice& rhs) const {
auto other = dynamic_cast<const HidapiWiimote*>(&rhs);
if (!other)
return false;
return m_path == other->m_path;

View File

@ -10,7 +10,7 @@ public:
bool write_data(const std::vector<uint8> &data) override;
std::optional<std::vector<uint8>> read_data() override;
bool operator==(WiimoteDevice& o) const override;
bool operator==(const WiimoteDevice& o) const override;
static std::vector<WiimoteDevicePtr> get_devices();

View File

@ -112,7 +112,7 @@ std::optional<std::vector<uint8>> L2CapWiimote::read_data()
}
bool L2CapWiimote::operator==(WiimoteDevice& rhs) const
bool L2CapWiimote::operator==(const WiimoteDevice& rhs) const
{
auto mote = dynamic_cast<const L2CapWiimote*>(&rhs);
if (!mote)

View File

@ -10,7 +10,7 @@ class L2CapWiimote : public WiimoteDevice
bool write_data(const std::vector<uint8>& data) override;
std::optional<std::vector<uint8>> read_data() override;
bool operator==(WiimoteDevice& o) const override;
bool operator==(const WiimoteDevice& o) const override;
static void AddCandidateAddress(bdaddr_t addr);
static std::vector<WiimoteDevicePtr> get_devices();