From 01284980b1d7227f1c11496d2be939bb4b23adb1 Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Fri, 9 Aug 2019 11:18:35 -0700 Subject: transport: Add modeling of physical adapters Now link instances must have the ability to report the corresponding physical adapter that is used for the local side of the link. This information can be used to help identify when multiple links share the same adapter. --- host/lib/transport/adapter.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 host/lib/transport/adapter.cpp (limited to 'host/lib/transport/adapter.cpp') diff --git a/host/lib/transport/adapter.cpp b/host/lib/transport/adapter.cpp new file mode 100644 index 000000000..247b33868 --- /dev/null +++ b/host/lib/transport/adapter.cpp @@ -0,0 +1,24 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include +#include + +using namespace uhd::transport; + +adapter_id_t adapter_ctx::register_adapter(adapter_info& info) +{ + std::lock_guard lock(_mutex); + auto key = info.to_string(); + if (_id_map.count(key) > 0) { + return _id_map.at(key); + } else { + adapter_id_t id = _id_map.size() + 1; + _id_map.emplace(std::make_pair(key, id)); + return id; + } +} + -- cgit v1.2.3