diff options
author | Alex Williams <alex.williams@ni.com> | 2019-08-09 11:18:35 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:38 -0800 |
commit | 01284980b1d7227f1c11496d2be939bb4b23adb1 (patch) | |
tree | 3bf21c2ece1296640a8854ea229960e5c937ebdd /host/lib/transport/adapter.cpp | |
parent | af5b2b5e778ead57b0fe9e72561227f1ebbbfc42 (diff) | |
download | uhd-01284980b1d7227f1c11496d2be939bb4b23adb1.tar.gz uhd-01284980b1d7227f1c11496d2be939bb4b23adb1.tar.bz2 uhd-01284980b1d7227f1c11496d2be939bb4b23adb1.zip |
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.
Diffstat (limited to 'host/lib/transport/adapter.cpp')
-rw-r--r-- | host/lib/transport/adapter.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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 <uhd/exception.hpp> +#include <uhdlib/transport/adapter.hpp> + +using namespace uhd::transport; + +adapter_id_t adapter_ctx::register_adapter(adapter_info& info) +{ + std::lock_guard<std::mutex> 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; + } +} + |