// // Copyright 2020 Ettus Research, a National Instruments Brand // // SPDX-License-Identifier: GPL-3.0-or-later // #pragma once #include #include #include #include #include #include namespace uhd { namespace features { /*! Map-based registry to implement discoverable_feature_getter_iface */ class discoverable_feature_registry : public virtual discoverable_feature_getter_iface { public: ~discoverable_feature_registry() override = default; std::vector enumerate_features() override; template void register_feature(std::shared_ptr feature) { if (!_features.emplace(T::get_feature_id(), feature).second) { UHD_ASSERT_THROW(false); } } private: discoverable_feature::sptr get_feature_ptr( discoverable_feature::feature_id_t feature_id) override; std::map _features; }; }} // namespace uhd::features