mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-15 21:01:26 +00:00
Classes which want to implement discoverable_feature can simply inherit from this registry and get access to an ergonomic map-backed registry of features.
34 lines
870 B
C++
34 lines
870 B
C++
//
|
|
// Copyright 2020 Ettus Research, a National Instruments Brand
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
//
|
|
|
|
#include <uhd/exception.hpp>
|
|
#include <uhd/features/discoverable_feature.hpp>
|
|
#include <uhdlib/features/discoverable_feature_registry.hpp>
|
|
#include <vector>
|
|
|
|
namespace uhd { namespace features {
|
|
|
|
std::vector<std::string>
|
|
discoverable_feature_registry::enumerate_features()
|
|
{
|
|
std::vector<std::string> features;
|
|
for (auto& entry : _features) {
|
|
features.push_back(entry.second->get_feature_name());
|
|
}
|
|
return features;
|
|
}
|
|
|
|
discoverable_feature::sptr discoverable_feature_registry::get_feature_ptr(
|
|
discoverable_feature::feature_id_t feature_id)
|
|
{
|
|
auto it = _features.find(feature_id);
|
|
if (it == _features.end()) {
|
|
return discoverable_feature::sptr();
|
|
}
|
|
return it->second;
|
|
}
|
|
|
|
}} // namespace uhd::features
|