From 0f8bd14d3487c35280c33bbfd133dd9e37c8f07e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Nov 2020 15:58:38 +0100 Subject: Index clients and ports by ID --- src/ClientID.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/ClientID.hpp') diff --git a/src/ClientID.hpp b/src/ClientID.hpp index 43b56ec..639cbbf 100644 --- a/src/ClientID.hpp +++ b/src/ClientID.hpp @@ -85,6 +85,24 @@ operator<<(std::ostream& os, const ClientID& id) return os; } +static inline bool +operator==(const ClientID& lhs, const ClientID& rhs) +{ + if (lhs.type() != rhs.type()) { + return false; + } + + switch (lhs.type()) { + case ClientID::Type::jack: + return lhs.jack_name() == rhs.jack_name(); + case ClientID::Type::alsa: + return lhs.alsa_id() == rhs.alsa_id(); + } + + assert(false); + return false; +} + static inline bool operator<(const ClientID& lhs, const ClientID& rhs) { -- cgit v1.2.1