diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-01-08 13:12:34 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-03-17 15:49:26 -0500 |
commit | b36fa03407f43dfc8e93a719186264b8d3e6db52 (patch) | |
tree | 9957b776d6e3b199597ab597cde68e5111d37b88 /host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp | |
parent | 668a04befdc4ec43b2a6e86992c672ef5f8408e0 (diff) | |
download | uhd-b36fa03407f43dfc8e93a719186264b8d3e6db52.tar.gz uhd-b36fa03407f43dfc8e93a719186264b8d3e6db52.tar.bz2 uhd-b36fa03407f43dfc8e93a719186264b8d3e6db52.zip |
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.
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp')
-rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp index 897e00868..f80f75f00 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp @@ -116,13 +116,14 @@ public: const std::string& name, const size_t chan) const override; void set_rx_lo_source( const std::string& src, const std::string& name, const size_t chan) override; - const std::string get_rx_lo_source(const std::string& name, const size_t chan) const; + const std::string get_rx_lo_source( + 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<std::string> get_tx_lo_names(const size_t chan) const override; std::vector<std::string> get_tx_lo_sources( - const std::string& name, const size_t chan) const; + 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( @@ -150,9 +151,9 @@ public: /************************************************************************** * Sensor API *************************************************************************/ - std::vector<std::string> get_rx_sensor_names(size_t chan); + std::vector<std::string> get_rx_sensor_names(size_t chan) const override; uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan) override; - std::vector<std::string> get_tx_sensor_names(size_t chan); + std::vector<std::string> get_tx_sensor_names(size_t chan) const override; uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) override; /************************************************************************** |