EduArt Sensor Ring Library 3.0.0
Loading...
Searching...
No Matches
ComInterfaceID.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <string>
13
14namespace eduart {
15
16namespace com {
17
22enum class InterfaceType {
23 Undefined,
24 SocketCan,
25 UsbTingo
26};
27
34 InterfaceType type = InterfaceType::Undefined;
35
37 std::string name = "";
38
40 bool operator==(const ComInterfaceID& other) const;
41
43 bool operator!=(const ComInterfaceID& other) const;
44};
45
46inline bool ComInterfaceID::operator==(const ComInterfaceID& other) const {
47 return type == other.type && name == other.name;
48}
49
50inline bool ComInterfaceID::operator!=(const ComInterfaceID& other) const {
51 return !(type == other.type && name == other.name);
52}
53
54} // namespace com
55
56} // namespace eduart
57
58namespace std {
59
64template <> struct hash<eduart::com::ComInterfaceID> {
70 std::size_t operator()(const eduart::com::ComInterfaceID& id) const noexcept {
71 auto h1 = std::hash<int>{}(static_cast<int>(id.type));
72 auto h2 = std::hash<std::string>{}(id.name);
73 return h1 ^ (h2 << 1);
74 }
75};
76
77} // namespace std
InterfaceType
Type of the communication interface.
Definition ComInterfaceID.hpp:22
Definition ComInterfaceID.hpp:32
bool operator!=(const ComInterfaceID &other) const
Inequality operator for ComInterfaceID.
Definition ComInterfaceID.hpp:50
bool operator==(const ComInterfaceID &other) const
Equality operators for ComInterfaceID.
Definition ComInterfaceID.hpp:46
std::string name
Name of the communication interface.
Definition ComInterfaceID.hpp:37
InterfaceType type
Type of the communication interface.
Definition ComInterfaceID.hpp:34
std::size_t operator()(const eduart::com::ComInterfaceID &id) const noexcept
Compute hash value for a ComInterfaceID.
Definition ComInterfaceID.hpp:70