USRP Hardware Driver and Device Manual Version: 4.11.0.0-0-unknown
UHD and USRP Manual
Loading...
Searching...
No Matches
discoverable_feature_getter_iface.hpp
Go to the documentation of this file.
1//
2// Copyright 2020 Ettus Research, a National Instruments Brand
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7#pragma once
8
9#include <uhd/exception.hpp>
11#include <vector>
12
13namespace uhd { namespace features {
14
18{
19public:
21
30 template <typename T>
32 {
33 auto p = get_feature_ptr(T::get_feature_id());
35 auto typed_p = dynamic_cast<T*>(p.get());
36 UHD_ASSERT_THROW(typed_p);
37 return *typed_p;
38 }
39
45 template <typename T>
47 {
48 return bool(get_feature_ptr(T::get_feature_id()));
49 }
50
56 virtual std::vector<std::string> enumerate_features() = 0;
57
58private:
63 virtual discoverable_feature::sptr get_feature_ptr(
65};
66
67}} // namespace uhd::features
Definition discoverable_feature_getter_iface.hpp:18
virtual std::vector< std::string > enumerate_features()=0
Enumerate all discoverable features present on the device.
T & get_feature()
Retrieves a feature of the specified type.
Definition discoverable_feature_getter_iface.hpp:31
bool has_feature()
Determines whether a given feature exists.
Definition discoverable_feature_getter_iface.hpp:46
feature_id_t
Definition discoverable_feature.hpp:33
std::shared_ptr< discoverable_feature > sptr
Definition discoverable_feature.hpp:28
#define UHD_API
Definition config.h:87
#define UHD_ASSERT_THROW(code)
Definition exception.hpp:321
Definition adc_self_calibration_iface.hpp:16
Definition build_info.hpp:12