From b36fa03407f43dfc8e93a719186264b8d3e6db52 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 8 Jan 2021 13:12:34 +0100 Subject: uhd: Fix radio_control-related method constness The const-ness of some radio_control differed between base class and implementation. This fixes the consistency, but also makes sure these methods follow the rules for when to make methods 'const'. The following rules apply: - Methods that query static capabilities are const. Here, we made get_tx_lo_sources() const (the RX version was already const). - Getters that may have to interact with the device (e.g., peek a register) are not const, because the act of peeking is usually also non-const. Here, we changed get_rx_lo_export_enabled() to non-const. - All base classes are fixed such that the derived classes and the base classes have the same const-ness. Clang was warning about differences. This can cause very tricky bugs, where the radio_control_impl version can get called instead of the intended child class. --- host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'host/lib/include/uhdlib') diff --git a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp index ba11e50bf..7d9ce6ec2 100644 --- a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp +++ b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp @@ -131,14 +131,13 @@ public: const std::string& name, const size_t chan) override; void set_rx_lo_export_enabled( bool enabled, const std::string& name, const size_t chan) override; - bool get_rx_lo_export_enabled( - const std::string& name, const size_t chan) const override; + bool get_rx_lo_export_enabled(const std::string& name, const size_t chan) override; double set_rx_lo_freq( double freq, const std::string& name, const size_t chan) override; double get_rx_lo_freq(const std::string& name, const size_t chan) override; std::vector get_tx_lo_names(const size_t chan) const override; std::vector get_tx_lo_sources( - const std::string& name, const size_t chan) override; + const std::string& name, const size_t chan) const override; freq_range_t get_tx_lo_freq_range( const std::string& name, const size_t chan) override; void set_tx_lo_source( -- cgit v1.2.3