diff options
212 files changed, 2215 insertions, 2114 deletions
diff --git a/host/examples/gpio.cpp b/host/examples/gpio.cpp index 12bcd26f7..d4a188c66 100644 --- a/host/examples/gpio.cpp +++ b/host/examples/gpio.cpp @@ -214,9 +214,9 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) std::cout << "Using GPIO bank: " << gpio << std::endl; // subdev spec - if (tx_subdev_spec != "") + if (!tx_subdev_spec.empty()) usrp->set_tx_subdev_spec(tx_subdev_spec); - if (rx_subdev_spec != "") + if (!rx_subdev_spec.empty()) usrp->set_rx_subdev_spec(rx_subdev_spec); std::cout << boost::format(" rx_subdev_spec: %s") % usrp->get_rx_subdev_spec(0).to_string() diff --git a/host/examples/test_dboard_coercion.cpp b/host/examples/test_dboard_coercion.cpp index 0fb6f1872..7dd053610 100644 --- a/host/examples/test_dboard_coercion.cpp +++ b/host/examples/test_dboard_coercion.cpp @@ -44,7 +44,7 @@ std::string return_usrp_config_string( std::string rx_serial, rx_subdev_name, rx_subdev_spec; mboard_id = tx_info.get("mboard_id"); - if (tx_info.get("mboard_serial") == "") + if (tx_info.get("mboard_serial").empty()) mboard_serial = "no serial"; else mboard_serial = tx_info.get("mboard_serial"); @@ -53,7 +53,7 @@ std::string return_usrp_config_string( str(boost::format("Motherboard: %s (%s)\n") % mboard_id % mboard_serial); if (test_tx) { - if (tx_info.get("tx_serial") == "") + if (tx_info.get("tx_serial").empty()) tx_serial = "no serial"; else tx_serial = tx_info.get("tx_serial"); @@ -68,7 +68,7 @@ std::string return_usrp_config_string( if (test_tx and test_rx) info_string += "\n"; if (test_rx) { - if (rx_info.get("rx_serial") == "") + if (rx_info.get("rx_serial").empty()) rx_serial = "no serial"; else rx_serial = rx_info.get("rx_serial"); diff --git a/host/include/uhd/exception.hpp b/host/include/uhd/exception.hpp index bda2c18da..f48f97ba3 100644 --- a/host/include/uhd/exception.hpp +++ b/host/include/uhd/exception.hpp @@ -48,9 +48,9 @@ struct UHD_API exception : std::runtime_error struct UHD_API assertion_error : exception { assertion_error(const std::string& what); - virtual unsigned code(void) const; - virtual assertion_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + assertion_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! The base class for exceptions that are raised when a key or index is @@ -59,9 +59,9 @@ struct UHD_API assertion_error : exception struct UHD_API lookup_error : exception { lookup_error(const std::string& what); - virtual unsigned code(void) const; - virtual lookup_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + lookup_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when a sequence index is out of range. @@ -69,9 +69,9 @@ struct UHD_API lookup_error : exception struct UHD_API index_error : lookup_error { index_error(const std::string& what); - virtual unsigned code(void) const; - virtual index_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + index_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when a dictionary-like object is trying to be indexed by an @@ -82,9 +82,9 @@ struct UHD_API index_error : lookup_error struct UHD_API key_error : lookup_error { key_error(const std::string& what); - virtual unsigned code(void) const; - virtual key_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + key_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when an operation or function is executed with a value of @@ -96,9 +96,9 @@ struct UHD_API key_error : lookup_error struct UHD_API type_error : exception { type_error(const std::string& what); - virtual unsigned code(void) const; - virtual type_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + type_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when an operation or function receives an argument that has the @@ -108,9 +108,9 @@ struct UHD_API type_error : exception struct UHD_API value_error : exception { value_error(const std::string& what); - virtual unsigned code(void) const; - virtual value_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + value_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when a value is inappropriate because it can't be narrowed as @@ -121,9 +121,9 @@ struct UHD_API value_error : exception struct UHD_API narrowing_error : value_error { narrowing_error(const std::string& what); - virtual unsigned code(void) const; - virtual narrowing_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + narrowing_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when an error is detected that doesn't fall into any of the @@ -132,9 +132,9 @@ struct UHD_API narrowing_error : value_error struct UHD_API runtime_error : exception { runtime_error(const std::string& what); - virtual unsigned code(void) const; - virtual runtime_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + runtime_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when an error occurs during a USB transaction. @@ -143,12 +143,12 @@ struct UHD_API usb_error : runtime_error { int _code; usb_error(int code, const std::string& what); - virtual unsigned code(void) const + unsigned code(void) const override { return _code; }; - virtual usb_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + usb_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when a function is stubbed out but doesn't actually do anything @@ -157,9 +157,9 @@ struct UHD_API usb_error : runtime_error struct UHD_API not_implemented_error : runtime_error { not_implemented_error(const std::string& what); - virtual unsigned code(void) const; - virtual not_implemented_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + not_implemented_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when a resource is being accessed without having the appropriate @@ -168,9 +168,9 @@ struct UHD_API not_implemented_error : runtime_error struct UHD_API access_error : runtime_error { access_error(const std::string& what); - virtual unsigned code(void) const; - virtual access_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + access_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Base class for errors that occur outside of UHD. @@ -178,9 +178,9 @@ struct UHD_API access_error : runtime_error struct UHD_API environment_error : exception { environment_error(const std::string& what); - virtual unsigned code(void) const; - virtual environment_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + environment_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when an I/O operation fails for an I/O-related reason. @@ -188,9 +188,9 @@ struct UHD_API environment_error : exception struct UHD_API io_error : environment_error { io_error(const std::string& what); - virtual unsigned code(void) const; - virtual io_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + io_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when a function returns a system-related error. @@ -198,9 +198,9 @@ struct UHD_API io_error : environment_error struct UHD_API os_error : environment_error { os_error(const std::string& what); - virtual unsigned code(void) const; - virtual os_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + os_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! \deprecated @@ -208,9 +208,9 @@ struct UHD_API os_error : environment_error struct UHD_API system_error : exception { system_error(const std::string& what); - virtual unsigned code(void) const; - virtual system_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + system_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Raised when a parser encounters a syntax error. @@ -220,9 +220,9 @@ struct UHD_API system_error : exception struct UHD_API syntax_error : exception { syntax_error(const std::string& what); - virtual unsigned code(void) const; - virtual syntax_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + syntax_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Base class for RFNoC-related errors @@ -230,9 +230,9 @@ struct UHD_API syntax_error : exception struct UHD_API rfnoc_error : exception { rfnoc_error(const std::string& what); - virtual unsigned code(void) const; - virtual rfnoc_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + rfnoc_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Gets thrown when a transaction with an RFNoC block fails (IO error) @@ -240,9 +240,9 @@ struct UHD_API rfnoc_error : exception struct UHD_API op_failed : rfnoc_error { op_failed(const std::string& what); - virtual unsigned code(void) const; - virtual op_failed* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + op_failed* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Gets thrown when a transaction with an RFNoC block times out (e.g., no ACK @@ -251,9 +251,9 @@ struct UHD_API op_failed : rfnoc_error struct UHD_API op_timeout : rfnoc_error { op_timeout(const std::string& what); - virtual unsigned code(void) const; - virtual op_timeout* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + op_timeout* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Gets thrown when a transaction with an RFNoC yields a sequence error @@ -261,9 +261,9 @@ struct UHD_API op_timeout : rfnoc_error struct UHD_API op_seqerr : rfnoc_error { op_seqerr(const std::string& what); - virtual unsigned code(void) const; - virtual op_seqerr* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + op_seqerr* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Gets thrown when a transaction with an RFNoC yields a time error (late command) @@ -271,9 +271,9 @@ struct UHD_API op_seqerr : rfnoc_error struct UHD_API op_timerr : rfnoc_error { op_timerr(const std::string& what); - virtual unsigned code(void) const; - virtual op_timerr* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + op_timerr* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Gets thrown when a property resolution fails @@ -281,9 +281,9 @@ struct UHD_API op_timerr : rfnoc_error struct UHD_API resolve_error : rfnoc_error { resolve_error(const std::string& what); - virtual unsigned code(void) const; - virtual resolve_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + resolve_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! Gets thrown when there is a routing-related failure in RFNoC @@ -291,9 +291,9 @@ struct UHD_API resolve_error : rfnoc_error struct UHD_API routing_error : rfnoc_error { routing_error(const std::string& what); - virtual unsigned code(void) const; - virtual routing_error* dynamic_clone(void) const; - virtual void dynamic_throw(void) const; + unsigned code(void) const override; + routing_error* dynamic_clone(void) const override; + void dynamic_throw(void) const override; }; /*! diff --git a/host/include/uhd/rfnoc/dirtifier.hpp b/host/include/uhd/rfnoc/dirtifier.hpp index 48c514f1a..fde4810c2 100644 --- a/host/include/uhd/rfnoc/dirtifier.hpp +++ b/host/include/uhd/rfnoc/dirtifier.hpp @@ -25,43 +25,43 @@ public: } //! This property is always dirty - bool is_dirty() const + bool is_dirty() const override { return true; } //! This property is always invalid - bool is_valid() const + bool is_valid() const override { return false; } //! This property is never equal to anything else - bool equal(property_base_t*) const + bool equal(property_base_t*) const override { return false; } //! Always dirty, so this can be called as often as we like - void force_dirty() {} + void force_dirty() override {} - void set_from_str(const std::string&) + void set_from_str(const std::string&) override { throw uhd::runtime_error("Dirtifier property can never be set!"); } private: //! This property cannot be marked clean, but nothing happens if you try - void mark_clean() {} + void mark_clean() override {} //! The value from this property cannot be forwarded - void forward(property_base_t*) + void forward(property_base_t*) override { throw uhd::type_error("Cannot forward to or from dirtifier property!"); } //! This property never has the same type as another type - bool is_type_equal(property_base_t*) const + bool is_type_equal(property_base_t*) const override { return false; } diff --git a/host/include/uhd/rfnoc/mock_block.hpp b/host/include/uhd/rfnoc/mock_block.hpp index a456d30a6..fe275ba53 100644 --- a/host/include/uhd/rfnoc/mock_block.hpp +++ b/host/include/uhd/rfnoc/mock_block.hpp @@ -28,12 +28,12 @@ class UHD_API mock_reg_iface_t : public register_iface { public: mock_reg_iface_t() = default; - virtual ~mock_reg_iface_t() = default; + ~mock_reg_iface_t() override = default; /************************************************************************** * API *************************************************************************/ - void poke32(uint32_t addr, uint32_t data, uhd::time_spec_t time, bool ack) + void poke32(uint32_t addr, uint32_t data, uhd::time_spec_t time, bool ack) override { write_memory[addr] = data; _poke_cb(addr, data, time, ack); @@ -42,7 +42,7 @@ public: void multi_poke32(const std::vector<uint32_t> addrs, const std::vector<uint32_t> data, uhd::time_spec_t time, - bool ack) + bool ack) override { if (addrs.size() != data.size()) { throw uhd::value_error("addrs and data vectors must be of the same length"); @@ -55,14 +55,14 @@ public: void block_poke32(uint32_t first_addr, const std::vector<uint32_t> data, uhd::time_spec_t timestamp, - bool ack) + bool ack) override { for (size_t i = 0; i < data.size(); i++) { poke32(first_addr + 4 * i, data[i], timestamp, ack); } } - uint32_t peek32(uint32_t addr, uhd::time_spec_t time) + uint32_t peek32(uint32_t addr, uhd::time_spec_t time) override { _peek_cb(addr, time); try { @@ -74,7 +74,7 @@ public: } std::vector<uint32_t> block_peek32( - uint32_t first_addr, size_t length, uhd::time_spec_t time) + uint32_t first_addr, size_t length, uhd::time_spec_t time) override { std::vector<uint32_t> result(length, 0); for (size_t i = 0; i < length; ++i) { @@ -88,7 +88,7 @@ public: uint32_t mask, uhd::time_spec_t /* timeout */, uhd::time_spec_t time = uhd::time_spec_t::ASAP, - bool /* ack */ = false) + bool /* ack */ = false) override { if (force_timeout) { throw uhd::op_timeout("timeout"); @@ -101,33 +101,33 @@ public: } } - void sleep(uhd::time_spec_t /*duration*/, bool /*ack*/) + void sleep(uhd::time_spec_t /*duration*/, bool /*ack*/) override { // nop } - void register_async_msg_validator(async_msg_validator_t /*callback_f*/) + void register_async_msg_validator(async_msg_validator_t /*callback_f*/) override { // nop } - void register_async_msg_handler(async_msg_callback_t /*callback_f*/) + void register_async_msg_handler(async_msg_callback_t /*callback_f*/) override { // nop } - void set_policy(const std::string& name, const uhd::device_addr_t& args) + void set_policy(const std::string& name, const uhd::device_addr_t& args) override { UHD_LOG_INFO("MOCK_REG_IFACE", "Requested to set policy for " << name << " to " << args.to_string()); } - uint16_t get_src_epid() const + uint16_t get_src_epid() const override { return 0; } - uint16_t get_port_num() const + uint16_t get_port_num() const override { return 0; } diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp index 633046c41..67ca0fb37 100644 --- a/host/include/uhd/rfnoc/noc_block_base.hpp +++ b/host/include/uhd/rfnoc/noc_block_base.hpp @@ -52,13 +52,13 @@ public: //! Opaque pointer to the constructor arguments using make_args_ptr = std::unique_ptr<make_args_t>; - virtual ~noc_block_base(); + ~noc_block_base() override; /************************************************************************** * node_t API calls *************************************************************************/ //! Unique ID for an RFNoC block is its block ID - std::string get_unique_id() const + std::string get_unique_id() const override { return get_block_id().to_string(); } @@ -69,7 +69,7 @@ public: // Note: This may be overridden by the block (e.g., the X300 radio may not // have all ports available if no TwinRX board is plugged in), but the // subclassed version may never report more ports than this. - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return _num_input_ports; } @@ -80,7 +80,7 @@ public: // Note: This may be overridden by the block (e.g., the X300 radio may not // have all ports available if no TwinRX board is plugged in), but the // subclassed version may never report more ports than this. - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return _num_output_ports; } @@ -262,7 +262,7 @@ private: * - Call deinit() * - Invalidate regs() */ - void shutdown(); + void shutdown() override; /************************************************************************** * Attributes diff --git a/host/include/uhd/rfnoc/property.hpp b/host/include/uhd/rfnoc/property.hpp index ab773da21..e7642a6f1 100644 --- a/host/include/uhd/rfnoc/property.hpp +++ b/host/include/uhd/rfnoc/property.hpp @@ -165,7 +165,7 @@ public: // // If true, this means the value was recently changed, but it wasn't marked // clean yet. - bool is_dirty() const + bool is_dirty() const override { return _data.is_dirty(); } @@ -174,12 +174,12 @@ public: // // If it's false, that means this property has a default value that should // NOT be used. - bool is_valid() const + bool is_valid() const override { return _valid; } - bool equal(property_base_t* rhs) const + bool equal(property_base_t* rhs) const override { if (!is_type_equal(rhs)) { return false; @@ -193,7 +193,7 @@ public: new property_t<data_t>(get_id(), get(), new_src_info)); } - void set_from_str(const std::string& new_val_str) + void set_from_str(const std::string& new_val_str) override { try { set(uhd::cast::from_str<data_t>(new_val_str)); @@ -228,7 +228,7 @@ public: } } - void force_dirty() + void force_dirty() override { if (write_access_granted()) { _data.force_dirty(); @@ -279,12 +279,12 @@ public: } private: - void mark_clean() + void mark_clean() override { _data.mark_clean(); } - void forward(property_base_t* next_prop) + void forward(property_base_t* next_prop) override { if (not _valid) { throw uhd::resolve_error( @@ -300,7 +300,7 @@ private: prop_ptr->set(get()); } - bool is_type_equal(property_base_t* other_prop) const + bool is_type_equal(property_base_t* other_prop) const override { return dynamic_cast<property_t<data_t>*>(other_prop) != nullptr; } diff --git a/host/include/uhd/transport/tcp_zero_copy.hpp b/host/include/uhd/transport/tcp_zero_copy.hpp index c834d653d..d55a87a48 100644 --- a/host/include/uhd/transport/tcp_zero_copy.hpp +++ b/host/include/uhd/transport/tcp_zero_copy.hpp @@ -21,7 +21,7 @@ namespace uhd { namespace transport { */ struct UHD_API tcp_zero_copy : public virtual zero_copy_if { - virtual ~tcp_zero_copy(void); + ~tcp_zero_copy(void) override; /*! * Make a new zero copy TCP transport: diff --git a/host/include/uhd/transport/usb_zero_copy.hpp b/host/include/uhd/transport/usb_zero_copy.hpp index 6de0ab33e..3f6845ab2 100644 --- a/host/include/uhd/transport/usb_zero_copy.hpp +++ b/host/include/uhd/transport/usb_zero_copy.hpp @@ -28,7 +28,7 @@ class UHD_API usb_zero_copy : public virtual zero_copy_if public: typedef std::shared_ptr<usb_zero_copy> sptr; - virtual ~usb_zero_copy(void); + ~usb_zero_copy(void) override; /*! * Make a new zero copy USB transport: diff --git a/host/include/uhd/types/filters.hpp b/host/include/uhd/types/filters.hpp index 83941ac9a..90992ba47 100644 --- a/host/include/uhd/types/filters.hpp +++ b/host/include/uhd/types/filters.hpp @@ -77,7 +77,7 @@ public: return _analog_type; } - virtual std::string to_pp_string(); + std::string to_pp_string() override; }; class UHD_API analog_filter_lp : public analog_filter_base @@ -115,7 +115,7 @@ public: _cutoff = cutoff; } - virtual std::string to_pp_string(); + std::string to_pp_string() override; }; template <typename tap_t> @@ -181,7 +181,7 @@ public: return _taps; } - virtual std::string to_pp_string() + std::string to_pp_string() override { std::ostringstream os; os << filter_info_base::to_pp_string() << "\t[digital_filter_base]" << std::endl diff --git a/host/include/uhd/usrp/dboard_base.hpp b/host/include/uhd/usrp/dboard_base.hpp index 9fd789081..17b15adf8 100644 --- a/host/include/uhd/usrp/dboard_base.hpp +++ b/host/include/uhd/usrp/dboard_base.hpp @@ -64,7 +64,7 @@ public: * Create a new xcvr dboard object, override in subclasses. */ xcvr_dboard_base(ctor_args_t); - virtual ~xcvr_dboard_base() {} + ~xcvr_dboard_base() override {} }; /*! @@ -78,7 +78,7 @@ public: * Create a new rx dboard object, override in subclasses. */ rx_dboard_base(ctor_args_t); - virtual ~rx_dboard_base() {} + ~rx_dboard_base() override {} }; /*! @@ -92,7 +92,7 @@ public: * Create a new rx dboard object, override in subclasses. */ tx_dboard_base(ctor_args_t); - virtual ~tx_dboard_base() {} + ~tx_dboard_base() override {} }; }} // namespace uhd::usrp diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp index e89c4f064..35f1effbd 100644 --- a/host/include/uhd/usrp/dboard_iface.hpp +++ b/host/include/uhd/usrp/dboard_iface.hpp @@ -75,7 +75,7 @@ public: typedef uhd::usrp::gpio_atr::gpio_atr_reg_t atr_reg_t; - virtual ~dboard_iface(void){}; + ~dboard_iface(void) override{}; /*! * Get special properties information for this dboard slot. diff --git a/host/include/uhd/utils/soft_register.hpp b/host/include/uhd/utils/soft_register.hpp index 45dd9d573..e38ffedfe 100644 --- a/host/include/uhd/utils/soft_register.hpp +++ b/host/include/uhd/utils/soft_register.hpp @@ -171,7 +171,7 @@ public: * Can be optionally synced with hardware. * NOTE: Memory management of the iface is up to the caller */ - UHD_INLINE void initialize(wb_iface& iface, bool sync = false) + UHD_INLINE void initialize(wb_iface& iface, bool sync = false) override { _iface = &iface; @@ -207,7 +207,7 @@ public: /*! * Write the contents of the soft-copy to hardware. */ - UHD_INLINE void flush() + UHD_INLINE void flush() override { if (writable && _iface) { // If optimized flush then poke only if soft copy is dirty @@ -233,7 +233,7 @@ public: /*! * Read the contents of the register from hardware and update the soft copy. */ - UHD_INLINE void refresh() + UHD_INLINE void refresh() override { if (readable && _iface) { if (get_bitwidth() <= 32) { @@ -272,7 +272,7 @@ public: /*! * Get bitwidth for this register */ - UHD_INLINE size_t get_bitwidth() + UHD_INLINE size_t get_bitwidth() override { static const size_t BITS_IN_BYTE = 8; return sizeof(reg_data_t) * BITS_IN_BYTE; @@ -281,7 +281,7 @@ public: /*! * Is the register readable? */ - UHD_INLINE bool is_readable() + UHD_INLINE bool is_readable() override { return readable; } @@ -289,7 +289,7 @@ public: /*! * Is the register writable? */ - UHD_INLINE bool is_writable() + UHD_INLINE bool is_writable() override { return writable; } @@ -465,12 +465,12 @@ class UHD_API soft_regmap_t : public soft_regmap_accessor_t, public uhd::noncopy { public: soft_regmap_t(const std::string& name) : _name(name) {} - virtual ~soft_regmap_t(){}; + ~soft_regmap_t() override{}; /*! * Get the name of this register map */ - virtual UHD_INLINE const std::string& get_name() const + UHD_INLINE const std::string& get_name() const override { return _name; } @@ -519,7 +519,7 @@ public: * Lookup a register object by name. * If a register with "name" is not found, runtime_error is thrown */ - virtual soft_register_base& lookup(const std::string& name) const + soft_register_base& lookup(const std::string& name) const override { regmap_t::const_iterator iter = _regmap.find(name); if (iter != _regmap.end()) { @@ -533,7 +533,7 @@ public: * Enumerate all the registers in this map. * Return fully qualified paths. */ - virtual std::vector<std::string> enumerate() const + std::vector<std::string> enumerate() const override { std::vector<std::string> temp; for (const regmap_t::value_type& reg : _regmap) { @@ -601,7 +601,7 @@ public: /*! * Get the name of this register map */ - const std::string& get_name() const + const std::string& get_name() const override { return _name; } @@ -638,7 +638,7 @@ public: * For example: * radio0/spi_regmap/spi_control_reg */ - soft_register_base& lookup(const std::string& path) const + soft_register_base& lookup(const std::string& path) const override { // Turn the slash separated path string into tokens std::list<std::string> tokens; @@ -647,8 +647,8 @@ public: tokens.push_back(node); } if ((tokens.size() > 2 && tokens.front() == _name) || // If this is a nested DB - (tokens.size() > 1 && _name == "")) { // If this is a top-level DB - if (_name != "") + (tokens.size() > 1 && _name.empty())) { // If this is a top-level DB + if (!_name.empty()) tokens.pop_front(); if (tokens.size() == 2) { // 2 tokens => regmap/register path for (const soft_regmap_accessor_t* regmap : _regmaps) { @@ -680,7 +680,7 @@ public: /*! * Enumerate the paths of all registers that this DB can access */ - virtual std::vector<std::string> enumerate() const + std::vector<std::string> enumerate() const override { std::vector<std::string> paths; for (const soft_regmap_accessor_t* regmap : _regmaps) { diff --git a/host/lib/cal/iq_cal.cpp b/host/lib/cal/iq_cal.cpp index f5640b01e..f891f4f2c 100644 --- a/host/lib/cal/iq_cal.cpp +++ b/host/lib/cal/iq_cal.cpp @@ -34,31 +34,31 @@ public: { } - std::string get_name() const + std::string get_name() const override { return _name; } //! Return the name of this calibration table - std::string get_serial() const + std::string get_serial() const override { return _serial; } //! Timestamp of acquisition time - uint64_t get_timestamp() const + uint64_t get_timestamp() const override { return _timestamp; } - void set_interp_mode(const interp_mode interp) + void set_interp_mode(const interp_mode interp) override { UHD_ASSERT_THROW( interp == interp_mode::LINEAR || interp == interp_mode::NEAREST_NEIGHBOR); _interp = interp; } - std::complex<double> get_cal_coeff(const double freq) const + std::complex<double> get_cal_coeff(const double freq) const override { UHD_ASSERT_THROW(!_coeffs.empty()); // Find the first coefficient in the map that maps to a larger frequency @@ -95,13 +95,13 @@ public: void set_cal_coeff(const double freq, const std::complex<double> coeff, const double suppression_abs = 0, - const double suppression_delta = 0) + const double suppression_delta = 0) override { _coeffs[freq] = coeff; _supp[freq] = {suppression_abs, suppression_delta}; } - void clear() + void clear() override { _coeffs.clear(); _supp.clear(); @@ -110,7 +110,7 @@ public: /************************************************************************** * Container API (Serialization/Deserialization) *************************************************************************/ - std::vector<uint8_t> serialize() + std::vector<uint8_t> serialize() override { // This is a magic value to estimate the amount of space the builder will // have to reserve on top of the coeff data. @@ -151,7 +151,7 @@ public: // This will amend the existing table. If that's not desired, then it is // necessary to call clear() ahead of time. - void deserialize(const std::vector<uint8_t>& data) + void deserialize(const std::vector<uint8_t>& data) override { auto verifier = flatbuffers::Verifier(data.data(), data.size()); if (!VerifyIQCalCoeffsBuffer(verifier)) { diff --git a/host/lib/cal/pwr_cal.cpp b/host/lib/cal/pwr_cal.cpp index 82af208df..ef7128f97 100644 --- a/host/lib/cal/pwr_cal.cpp +++ b/host/lib/cal/pwr_cal.cpp @@ -55,17 +55,17 @@ public: /************************************************************************** * Container API (Basics) *************************************************************************/ - std::string get_name() const + std::string get_name() const override { return _name; } - std::string get_serial() const + std::string get_serial() const override { return _serial; } - uint64_t get_timestamp() const + uint64_t get_timestamp() const override { return _timestamp; } @@ -77,7 +77,7 @@ public: const double min_power, const double max_power, const double freq, - const boost::optional<int> temperature = boost::none) + const boost::optional<int> temperature = boost::none) override { if (min_power > max_power) { throw uhd::runtime_error( @@ -96,7 +96,7 @@ public: // a struct). double get_power(const double gain, const double freq, - const boost::optional<int> temperature = boost::none) const + const boost::optional<int> temperature = boost::none) const override { UHD_ASSERT_THROW(!_data.empty()); const uint64_t freqi = static_cast<uint64_t>(freq); @@ -134,33 +134,33 @@ public: freq, gain, f1, gain1, f2, gain2, power11, power12, power21, power22); } - void clear() + void clear() override { _data.clear(); } - void set_temperature(const int temperature) + void set_temperature(const int temperature) override { _default_temp = temperature; } - int get_temperature() const + int get_temperature() const override { return _default_temp; } - void set_ref_gain(const double gain) + void set_ref_gain(const double gain) override { _ref_gain = gain; } - double get_ref_gain() const + double get_ref_gain() const override { return _ref_gain; } - uhd::meta_range_t get_power_limits( - const double freq, const boost::optional<int> temperature = boost::none) const + uhd::meta_range_t get_power_limits(const double freq, + const boost::optional<int> temperature = boost::none) const override { const auto table = at_nearest(_get_table(temperature), uint64_t(freq)); return uhd::meta_range_t(table.min_power, table.max_power); @@ -168,7 +168,7 @@ public: double get_gain(const double power_dbm, const double freq, - const boost::optional<int> temperature = boost::none) const + const boost::optional<int> temperature = boost::none) const override { UHD_ASSERT_THROW(!_data.empty()); const uint64_t freqi = static_cast<uint64_t>(freq); @@ -223,7 +223,7 @@ public: /************************************************************************** * Container API (Serialization/Deserialization) *************************************************************************/ - std::vector<uint8_t> serialize() + std::vector<uint8_t> serialize() override { const size_t initial_size_bytes = 1024 * 20; // 20 kiB as an initial guess flatbuffers::FlatBufferBuilder builder(initial_size_bytes); @@ -268,7 +268,7 @@ public: // This will amend the existing table. If that's not desired, then it is // necessary to call clear() ahead of time. - void deserialize(const std::vector<uint8_t>& data) + void deserialize(const std::vector<uint8_t>& data) override { auto verifier = flatbuffers::Verifier(data.data(), data.size()); if (!VerifyPowerCalBuffer(verifier)) { diff --git a/host/lib/convert/convert_fc32_item32.cpp b/host/lib/convert/convert_fc32_item32.cpp index 713f565f5..842485162 100644 --- a/host/lib/convert/convert_fc32_item32.cpp +++ b/host/lib/convert/convert_fc32_item32.cpp @@ -23,13 +23,14 @@ struct convert_fc32_item32_1_to_star_1 : public converter // NOP } - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { _scalar = scalar; } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const item32_t* input = reinterpret_cast<const item32_t*>(inputs[0]); std::complex<type>* output = reinterpret_cast<std::complex<type>*>(outputs[0]); @@ -56,13 +57,14 @@ struct convert_star_1_to_fc32_item32_1 : public converter // NOP } - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { _scalar = scalar; } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const std::complex<type>* input = reinterpret_cast<const std::complex<type>*>(inputs[0]); diff --git a/host/lib/convert/convert_pack_sc12.cpp b/host/lib/convert/convert_pack_sc12.cpp index ee28e00cd..5e4c00414 100644 --- a/host/lib/convert/convert_pack_sc12.cpp +++ b/host/lib/convert/convert_pack_sc12.cpp @@ -17,13 +17,14 @@ struct convert_star_1_to_sc12_item32_1 : public converter // NOP } - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { _scalar = scalar; } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const std::complex<type>* input = reinterpret_cast<const std::complex<type>*>(inputs[0]); diff --git a/host/lib/convert/convert_unpack_sc12.cpp b/host/lib/convert/convert_unpack_sc12.cpp index 9ec43a5c3..6d8a48876 100644 --- a/host/lib/convert/convert_unpack_sc12.cpp +++ b/host/lib/convert/convert_unpack_sc12.cpp @@ -17,7 +17,7 @@ struct convert_sc12_item32_1_to_star_1 : public converter // NOP } - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { const int unpack_growth = 16; _scalar = scalar / unpack_growth; @@ -31,8 +31,9 @@ struct convert_sc12_item32_1_to_star_1 : public converter * converter must be aware where it is supposed to start within 3 lines. * */ - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { /* * Looking at the line structure above we can identify 4 cases. diff --git a/host/lib/convert/convert_with_tables.cpp b/host/lib/convert/convert_with_tables.cpp index 86637171a..3df510092 100644 --- a/host/lib/convert/convert_with_tables.cpp +++ b/host/lib/convert/convert_with_tables.cpp @@ -26,7 +26,7 @@ class convert_sc16_1_to_sc8_item32_1 : public converter public: convert_sc16_1_to_sc8_item32_1(void) : _table(sc16_table_len) {} - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { for (size_t i = 0; i < sc16_table_len; i++) { const int16_t val = uint16_t(i); @@ -34,8 +34,9 @@ public: } } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const sc16_t* input = reinterpret_cast<const sc16_t*>(inputs[0]); item32_t* output = reinterpret_cast<item32_t*>(outputs[0]); @@ -79,7 +80,7 @@ class convert_sc16_item32_1_to_fcxx_1 : public converter public: convert_sc16_item32_1_to_fcxx_1(void) : _table(sc16_table_len) {} - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { for (size_t i = 0; i < sc16_table_len; i++) { const uint16_t val = tohost(uint16_t(i & 0xffff)); @@ -87,8 +88,9 @@ public: } } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const item32_t* input = reinterpret_cast<const item32_t*>(inputs[0]); std::complex<type>* output = reinterpret_cast<std::complex<type>*>(outputs[0]); @@ -123,7 +125,7 @@ public: return type(num * scalar); } - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { for (size_t i = 0; i < sc16_table_len; i++) { const uint16_t val = tohost(uint16_t(i & 0xffff)); @@ -133,8 +135,9 @@ public: } } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const item32_t* input = reinterpret_cast<const item32_t*>(size_t(inputs[0]) & ~0x3); diff --git a/host/lib/convert/ssse3_pack_sc12.cpp b/host/lib/convert/ssse3_pack_sc12.cpp index 4ba14db3b..a8b415a2c 100644 --- a/host/lib/convert/ssse3_pack_sc12.cpp +++ b/host/lib/convert/ssse3_pack_sc12.cpp @@ -117,13 +117,14 @@ struct convert_star_1_to_sc12_item32_2 : public converter { convert_star_1_to_sc12_item32_2(void) : _scalar(0.0) {} - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { _scalar = scalar; } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const std::complex<type>* input = reinterpret_cast<const std::complex<type>*>(inputs[0]); diff --git a/host/lib/convert/ssse3_unpack_sc12.cpp b/host/lib/convert/ssse3_unpack_sc12.cpp index 5494e0fd7..351e1d821 100644 --- a/host/lib/convert/ssse3_unpack_sc12.cpp +++ b/host/lib/convert/ssse3_unpack_sc12.cpp @@ -127,14 +127,15 @@ struct convert_sc12_item32_1_to_star_2 : public converter // NOP } - void set_scalar(const double scalar) + void set_scalar(const double scalar) override { const int unpack_growth = 16; _scalar = scalar / unpack_growth; } - void operator()( - const input_type& inputs, const output_type& outputs, const size_t nsamps) + void operator()(const input_type& inputs, + const output_type& outputs, + const size_t nsamps) override { const size_t head_samps = size_t(inputs[0]) & 0x3; size_t rewind = 0; diff --git a/host/lib/device.cpp b/host/lib/device.cpp index 7bf362753..62277134b 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -130,7 +130,7 @@ device::sptr device::make(const device_addr_t& hint, device_filter_t filter, siz } // check that we found any devices - if (dev_addr_makers.size() == 0) { + if (dev_addr_makers.empty()) { throw uhd::key_error( str(boost::format("No devices found for ----->\n%s") % hint.to_pp_string())); } diff --git a/host/lib/experts/expert_container.cpp b/host/lib/experts/expert_container.cpp index 6f7dc2c78..0658e9fa3 100644 --- a/host/lib/experts/expert_container.cpp +++ b/host/lib/experts/expert_container.cpp @@ -67,17 +67,17 @@ private: // Visitor class for cycle detection algorithm public: expert_container_impl(const std::string& name) : _name(name) {} - ~expert_container_impl() + ~expert_container_impl() override { clear(); } - const std::string& get_name() const + const std::string& get_name() const override { return _name; } - void resolve_all(bool force = false) + void resolve_all(bool force = false) override { boost::lock_guard<boost::recursive_mutex> resolve_lock(_resolve_mutex); boost::lock_guard<boost::mutex> lock(_mutex); @@ -86,7 +86,7 @@ public: _resolve_helper("", "", force); } - void resolve_from(const std::string&) + void resolve_from(const std::string&) override { boost::lock_guard<boost::recursive_mutex> resolve_lock(_resolve_mutex); boost::lock_guard<boost::mutex> lock(_mutex); @@ -96,7 +96,7 @@ public: _resolve_helper("", "", false); } - void resolve_to(const std::string&) + void resolve_to(const std::string&) override { boost::lock_guard<boost::recursive_mutex> resolve_lock(_resolve_mutex); boost::lock_guard<boost::mutex> lock(_mutex); @@ -106,7 +106,7 @@ public: _resolve_helper("", "", false); } - dag_vertex_t& retrieve(const std::string& name) const + dag_vertex_t& retrieve(const std::string& name) const override { try { expert_graph_t::vertex_descriptor vertex = _lookup_vertex(name); @@ -116,17 +116,17 @@ public: } } - const dag_vertex_t& lookup(const std::string& name) const + const dag_vertex_t& lookup(const std::string& name) const override { return retrieve(name); } - const node_retriever_t& node_retriever() const + const node_retriever_t& node_retriever() const override { return *this; } - std::string to_dot() const + std::string to_dot() const override { static const std::string DATA_SHAPE("ellipse"); static const std::string WORKER_SHAPE("box"); @@ -161,7 +161,7 @@ public: return dot_str; } - void debug_audit() const + void debug_audit() const override { #ifdef UHD_EXPERT_LOGGING EX_LOG(0, "debug_audit()"); @@ -271,13 +271,13 @@ public: #endif } - inline boost::recursive_mutex& resolve_mutex() + inline boost::recursive_mutex& resolve_mutex() override { return _resolve_mutex; } protected: - void add_data_node(dag_vertex_t* data_node, auto_resolve_mode_t resolve_mode) + void add_data_node(dag_vertex_t* data_node, auto_resolve_mode_t resolve_mode) override { boost::lock_guard<boost::mutex> lock(_mutex); @@ -328,7 +328,7 @@ protected: } } - void add_worker(worker_node_t* worker) + void add_worker(worker_node_t* worker) override { boost::lock_guard<boost::mutex> lock(_mutex); @@ -398,7 +398,7 @@ protected: } } - void clear() + void clear() override { boost::lock_guard<boost::mutex> lock(_mutex); EX_LOG(0, "clear()"); diff --git a/host/lib/include/uhdlib/experts/expert_container.hpp b/host/lib/include/uhdlib/experts/expert_container.hpp index a0245d598..bb05ae334 100644 --- a/host/lib/include/uhdlib/experts/expert_container.hpp +++ b/host/lib/include/uhdlib/experts/expert_container.hpp @@ -27,7 +27,7 @@ class UHD_API expert_container : private uhd::noncopyable, public node_retriever public: // Methods typedef std::shared_ptr<expert_container> sptr; - virtual ~expert_container(){}; + ~expert_container() override{}; /*! * Return the name of this container @@ -121,8 +121,8 @@ private: * \param name Name of the node to find * */ - virtual const dag_vertex_t& lookup(const std::string& name) const = 0; - virtual dag_vertex_t& retrieve(const std::string& name) const = 0; + const dag_vertex_t& lookup(const std::string& name) const override = 0; + dag_vertex_t& retrieve(const std::string& name) const override = 0; /*! * expert_factory is a friend of expert_container and diff --git a/host/lib/include/uhdlib/experts/expert_nodes.hpp b/host/lib/include/uhdlib/experts/expert_nodes.hpp index 7b8a62110..ce061ca26 100644 --- a/host/lib/include/uhdlib/experts/expert_nodes.hpp +++ b/host/lib/include/uhdlib/experts/expert_nodes.hpp @@ -149,13 +149,13 @@ public: } // Basic info - virtual const std::string& get_dtype() const + const std::string& get_dtype() const override { static const std::string dtype(boost::core::demangle(typeid(data_t).name())); return dtype; } - virtual std::string to_string() const + std::string to_string() const override { return data_node_printer::print(get()); } @@ -166,17 +166,17 @@ public: } // Graph resolution specific - virtual bool is_dirty() const + bool is_dirty() const override { return _data.is_dirty(); } - virtual void mark_clean() + void mark_clean() override { _data.mark_clean(); } - void resolve() + void resolve() override { // NOP } @@ -222,32 +222,32 @@ public: private: // External callbacks - virtual void set_write_callback(const callback_func_t& func) + void set_write_callback(const callback_func_t& func) override { _wr_callback = func; } - virtual bool has_write_callback() const + bool has_write_callback() const override { return bool(_wr_callback); } - virtual void clear_write_callback() + void clear_write_callback() override { _wr_callback = nullptr; } - virtual void set_read_callback(const callback_func_t& func) + void set_read_callback(const callback_func_t& func) override { _rd_callback = func; } - virtual bool has_read_callback() const + bool has_read_callback() const override { return bool(_rd_callback); } - virtual void clear_read_callback() + void clear_read_callback() override { _rd_callback = nullptr; } @@ -306,14 +306,14 @@ template <typename data_t> class data_accessor_base : public data_accessor_t { public: - virtual ~data_accessor_base() {} + ~data_accessor_base() override {} - virtual bool is_reader() const + bool is_reader() const override { return _access == ACCESS_READER; } - virtual bool is_writer() const + bool is_writer() const override { return _access == ACCESS_WRITER; } @@ -350,7 +350,7 @@ protected: const node_access_t _access; private: - virtual dag_vertex_t& node() const + dag_vertex_t& node() const override { return _vertex; } @@ -499,7 +499,7 @@ protected: private: // Graph resolution specific - virtual bool is_dirty() const + bool is_dirty() const override { bool inputs_dirty = false; for (data_accessor_t* acc : _inputs) { @@ -508,40 +508,40 @@ private: return inputs_dirty; } - virtual void mark_clean() + void mark_clean() override { for (data_accessor_t* acc : _inputs) { acc->node().mark_clean(); } } - virtual void resolve() = 0; + void resolve() override = 0; // Basic type info - virtual const std::string& get_dtype() const + const std::string& get_dtype() const override { static const std::string dtype = "<worker>"; return dtype; } - virtual std::string to_string() const + std::string to_string() const override { return "<worker>"; } // Workers don't have callbacks so implement stubs - virtual void set_write_callback(const callback_func_t&) {} - virtual bool has_write_callback() const + void set_write_callback(const callback_func_t&) override {} + bool has_write_callback() const override { return false; } - virtual void clear_write_callback() {} - virtual void set_read_callback(const callback_func_t&) {} - virtual bool has_read_callback() const + void clear_write_callback() override {} + void set_read_callback(const callback_func_t&) override {} + bool has_read_callback() const override { return false; } - virtual void clear_read_callback() {} + void clear_read_callback() override {} std::list<data_accessor_t*> _inputs; std::list<data_accessor_t*> _outputs; diff --git a/host/lib/include/uhdlib/features/discoverable_feature_registry.hpp b/host/lib/include/uhdlib/features/discoverable_feature_registry.hpp index f27f1a4f1..7a0d7c8bf 100644 --- a/host/lib/include/uhdlib/features/discoverable_feature_registry.hpp +++ b/host/lib/include/uhdlib/features/discoverable_feature_registry.hpp @@ -20,7 +20,7 @@ namespace uhd { namespace features { class discoverable_feature_registry : public virtual discoverable_feature_getter_iface { public: - virtual ~discoverable_feature_registry() = default; + ~discoverable_feature_registry() override = default; std::vector<std::string> enumerate_features() override; diff --git a/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp index ecedd09ca..b16b5d03b 100644 --- a/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp +++ b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp @@ -28,7 +28,7 @@ public: //! The function to call when sending a packet to a remote device using send_fn_t = std::function<void(const chdr::ctrl_payload&, double)>; - virtual ~ctrlport_endpoint() = 0; + ~ctrlport_endpoint() override = 0; //! Handles an incoming control packet (request and response) // diff --git a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp index 2a93fbfa5..ba11e50bf 100644 --- a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp +++ b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp @@ -38,151 +38,153 @@ public: *************************************************************************/ radio_control_impl(make_args_ptr make_args); - virtual void deinit() {} + void deinit() override {} - virtual ~radio_control_impl() {} + ~radio_control_impl() override {} /************************************************************************** * Stream control API calls *************************************************************************/ - void issue_stream_cmd(const uhd::stream_cmd_t& stream_cmd, const size_t port); + void issue_stream_cmd( + const uhd::stream_cmd_t& stream_cmd, const size_t port) override; - void enable_rx_timestamps(const bool enable, const size_t chan); + void enable_rx_timestamps(const bool enable, const size_t chan) override; /************************************************************************** * Rate-Related API Calls *************************************************************************/ - virtual double set_rate(const double rate); - virtual double get_rate() const; - virtual meta_range_t get_rate_range() const; + double set_rate(const double rate) override; + double get_rate() const override; + meta_range_t get_rate_range() const override; /************************************************************************** * RF-specific API calls *************************************************************************/ // Setters - virtual void set_tx_antenna(const std::string& ant, const size_t chan); - virtual void set_rx_antenna(const std::string& ant, const size_t chan); - virtual double set_tx_frequency(const double freq, const size_t chan); - virtual double set_rx_frequency(const double freq, const size_t chan); - virtual void set_tx_tune_args(const uhd::device_addr_t&, const size_t chan); - virtual void set_rx_tune_args(const uhd::device_addr_t&, const size_t chan); - virtual double set_tx_gain(const double gain, const size_t chan); - virtual double set_tx_gain( - const double gain, const std::string& name, const size_t chan); - virtual double set_rx_gain(const double gain, const size_t chan); - virtual double set_rx_gain( - const double gain, const std::string& name, const size_t chan); - virtual void set_rx_agc(const bool enable, const size_t chan); - virtual double set_tx_bandwidth(const double bandwidth, const size_t chan); - virtual double set_rx_bandwidth(const double bandwidth, const size_t chan); - virtual void set_tx_gain_profile(const std::string& profile, const size_t chan); - virtual void set_rx_gain_profile(const std::string& profile, const size_t chan); - virtual void set_rx_power_reference(const double power_dbm, const size_t chan); - virtual void set_tx_power_reference(const double power_dbm, const size_t chan); + void set_tx_antenna(const std::string& ant, const size_t chan) override; + void set_rx_antenna(const std::string& ant, const size_t chan) override; + double set_tx_frequency(const double freq, const size_t chan) override; + double set_rx_frequency(const double freq, const size_t chan) override; + void set_tx_tune_args(const uhd::device_addr_t&, const size_t chan) override; + void set_rx_tune_args(const uhd::device_addr_t&, const size_t chan) override; + double set_tx_gain(const double gain, const size_t chan) override; + double set_tx_gain( + const double gain, const std::string& name, const size_t chan) override; + double set_rx_gain(const double gain, const size_t chan) override; + double set_rx_gain( + const double gain, const std::string& name, const size_t chan) override; + void set_rx_agc(const bool enable, const size_t chan) override; + double set_tx_bandwidth(const double bandwidth, const size_t chan) override; + double set_rx_bandwidth(const double bandwidth, const size_t chan) override; + void set_tx_gain_profile(const std::string& profile, const size_t chan) override; + void set_rx_gain_profile(const std::string& profile, const size_t chan) override; + void set_rx_power_reference(const double power_dbm, const size_t chan) override; + void set_tx_power_reference(const double power_dbm, const size_t chan) override; // Getters - virtual std::string get_tx_antenna(const size_t chan) const; - virtual std::string get_rx_antenna(const size_t chan) const; - virtual std::vector<std::string> get_tx_antennas(const size_t chan) const; - virtual std::vector<std::string> get_rx_antennas(const size_t chan) const; - virtual double get_tx_frequency(const size_t); - virtual double get_rx_frequency(const size_t); - virtual uhd::freq_range_t get_tx_frequency_range(const size_t chan) const; - virtual uhd::freq_range_t get_rx_frequency_range(const size_t chan) const; - virtual std::vector<std::string> get_tx_gain_names(const size_t) const; - virtual std::vector<std::string> get_rx_gain_names(const size_t) const; - virtual double get_tx_gain(const size_t); - virtual double get_tx_gain(const std::string&, size_t); - virtual double get_rx_gain(const size_t); - virtual double get_rx_gain(const std::string&, size_t); - virtual uhd::gain_range_t get_tx_gain_range(const size_t) const; - virtual uhd::gain_range_t get_tx_gain_range(const std::string&, const size_t) const; - virtual uhd::gain_range_t get_rx_gain_range(const size_t) const; - virtual uhd::gain_range_t get_rx_gain_range(const std::string&, const size_t) const; - virtual std::vector<std::string> get_tx_gain_profile_names(const size_t chan) const; - virtual std::vector<std::string> get_rx_gain_profile_names(const size_t chan) const; - virtual std::string get_tx_gain_profile(const size_t chan) const; - virtual std::string get_rx_gain_profile(const size_t chan) const; - virtual double get_tx_bandwidth(const size_t); - virtual double get_rx_bandwidth(const size_t); - virtual meta_range_t get_tx_bandwidth_range(size_t chan) const; - virtual meta_range_t get_rx_bandwidth_range(size_t chan) const; - virtual bool has_rx_power_reference(const size_t chan); - virtual bool has_tx_power_reference(const size_t chan); - virtual double get_rx_power_reference(const size_t chan); - virtual double get_tx_power_reference(const size_t chan); - virtual std::vector<std::string> get_rx_power_ref_keys(const size_t); - virtual std::vector<std::string> get_tx_power_ref_keys(const size_t); - virtual meta_range_t get_rx_power_range(const size_t chan); - virtual meta_range_t get_tx_power_range(const size_t chan); + std::string get_tx_antenna(const size_t chan) const override; + std::string get_rx_antenna(const size_t chan) const override; + std::vector<std::string> get_tx_antennas(const size_t chan) const override; + std::vector<std::string> get_rx_antennas(const size_t chan) const override; + double get_tx_frequency(const size_t) override; + double get_rx_frequency(const size_t) override; + uhd::freq_range_t get_tx_frequency_range(const size_t chan) const override; + uhd::freq_range_t get_rx_frequency_range(const size_t chan) const override; + std::vector<std::string> get_tx_gain_names(const size_t) const override; + std::vector<std::string> get_rx_gain_names(const size_t) const override; + double get_tx_gain(const size_t) override; + double get_tx_gain(const std::string&, size_t) override; + double get_rx_gain(const size_t) override; + double get_rx_gain(const std::string&, size_t) override; + uhd::gain_range_t get_tx_gain_range(const size_t) const override; + uhd::gain_range_t get_tx_gain_range(const std::string&, const size_t) const override; + uhd::gain_range_t get_rx_gain_range(const size_t) const override; + uhd::gain_range_t get_rx_gain_range(const std::string&, const size_t) const override; + std::vector<std::string> get_tx_gain_profile_names(const size_t chan) const override; + std::vector<std::string> get_rx_gain_profile_names(const size_t chan) const override; + std::string get_tx_gain_profile(const size_t chan) const override; + std::string get_rx_gain_profile(const size_t chan) const override; + double get_tx_bandwidth(const size_t) override; + double get_rx_bandwidth(const size_t) override; + meta_range_t get_tx_bandwidth_range(size_t chan) const override; + meta_range_t get_rx_bandwidth_range(size_t chan) const override; + bool has_rx_power_reference(const size_t chan) override; + bool has_tx_power_reference(const size_t chan) override; + double get_rx_power_reference(const size_t chan) override; + double get_tx_power_reference(const size_t chan) override; + std::vector<std::string> get_rx_power_ref_keys(const size_t) override; + std::vector<std::string> get_tx_power_ref_keys(const size_t) override; + meta_range_t get_rx_power_range(const size_t chan) override; + meta_range_t get_tx_power_range(const size_t chan) override; /************************************************************************** * LO Controls *************************************************************************/ - virtual std::vector<std::string> get_rx_lo_names(const size_t chan) const; - virtual std::vector<std::string> get_rx_lo_sources( - const std::string& name, const size_t chan) const; - virtual freq_range_t get_rx_lo_freq_range( - const std::string& name, const size_t chan) const; - virtual void set_rx_lo_source( - const std::string& src, const std::string& name, const size_t chan); - virtual const std::string get_rx_lo_source( - const std::string& name, const size_t chan); - virtual void set_rx_lo_export_enabled( - bool enabled, const std::string& name, const size_t chan); - virtual bool get_rx_lo_export_enabled( - const std::string& name, const size_t chan) const; - virtual double set_rx_lo_freq( - double freq, const std::string& name, const size_t chan); - virtual double get_rx_lo_freq(const std::string& name, const size_t chan); - virtual std::vector<std::string> get_tx_lo_names(const size_t chan) const; - virtual std::vector<std::string> get_tx_lo_sources( - const std::string& name, const size_t chan); - virtual freq_range_t get_tx_lo_freq_range(const std::string& name, const size_t chan); - virtual void set_tx_lo_source( - const std::string& src, const std::string& name, const size_t chan); - virtual const std::string get_tx_lo_source( - const std::string& name, const size_t chan); - virtual void set_tx_lo_export_enabled( - const bool enabled, const std::string& name, const size_t chan); - virtual bool get_tx_lo_export_enabled(const std::string& name, const size_t chan); - virtual double set_tx_lo_freq( - const double freq, const std::string& name, const size_t chan); - virtual double get_tx_lo_freq(const std::string& name, const size_t chan); + std::vector<std::string> get_rx_lo_names(const size_t chan) const override; + std::vector<std::string> get_rx_lo_sources( + const std::string& name, const size_t chan) const override; + freq_range_t get_rx_lo_freq_range( + 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) 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; + 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) override; + freq_range_t get_tx_lo_freq_range( + const std::string& name, const size_t chan) override; + void set_tx_lo_source( + const std::string& src, const std::string& name, const size_t chan) override; + const std::string get_tx_lo_source( + const std::string& name, const size_t chan) override; + void set_tx_lo_export_enabled( + const bool enabled, const std::string& name, const size_t chan) override; + bool get_tx_lo_export_enabled(const std::string& name, const size_t chan) override; + double set_tx_lo_freq( + const double freq, const std::string& name, const size_t chan) override; + double get_tx_lo_freq(const std::string& name, const size_t chan) override; /************************************************************************** * Calibration-Related API Calls *************************************************************************/ - virtual void set_tx_dc_offset(const std::complex<double>& offset, size_t chan); - virtual meta_range_t get_tx_dc_offset_range(size_t chan) const; - virtual void set_tx_iq_balance(const std::complex<double>& correction, size_t chan); - virtual void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS); - virtual void set_rx_dc_offset(const std::complex<double>& offset, size_t chan); - virtual meta_range_t get_rx_dc_offset_range(size_t chan) const; - virtual void set_rx_iq_balance(const bool enb, size_t chan); - virtual void set_rx_iq_balance(const std::complex<double>& correction, size_t chan); + void set_tx_dc_offset(const std::complex<double>& offset, size_t chan) override; + meta_range_t get_tx_dc_offset_range(size_t chan) const override; + void set_tx_iq_balance(const std::complex<double>& correction, size_t chan) override; + void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) override; + void set_rx_dc_offset(const std::complex<double>& offset, size_t chan) override; + meta_range_t get_rx_dc_offset_range(size_t chan) const override; + void set_rx_iq_balance(const bool enb, size_t chan) override; + void set_rx_iq_balance(const std::complex<double>& correction, size_t chan) override; /************************************************************************** * GPIO Controls *************************************************************************/ - virtual std::vector<std::string> get_gpio_banks() const; - virtual void set_gpio_attr( - const std::string& bank, const std::string& attr, const uint32_t value); - virtual uint32_t get_gpio_attr(const std::string& bank, const std::string& attr); + std::vector<std::string> get_gpio_banks() const override; + void set_gpio_attr( + const std::string& bank, const std::string& attr, const uint32_t value) override; + uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) override; /************************************************************************** * Sensor API *************************************************************************/ - virtual std::vector<std::string> get_rx_sensor_names(size_t chan) const; - virtual uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan); - virtual std::vector<std::string> get_tx_sensor_names(size_t chan) const; - virtual uhd::sensor_value_t get_tx_sensor(const std::string& name, 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) const override; + uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) override; /************************************************************************** * Identification API *************************************************************************/ - virtual std::string get_fe_name( - const size_t chan, const uhd::direction_t direction) const + std::string get_fe_name( + const size_t chan, const uhd::direction_t direction) const override { return get_dboard_fe_from_chan(chan, direction); } @@ -190,8 +192,8 @@ public: /************************************************************************** * EEPROM API *************************************************************************/ - virtual void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom); - virtual uhd::eeprom_map_t get_db_eeprom(); + void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) override; + uhd::eeprom_map_t get_db_eeprom() override; /*********************************************************************** * Reg Map diff --git a/host/lib/include/uhdlib/rfnoc/reg_iface_adapter.hpp b/host/lib/include/uhdlib/rfnoc/reg_iface_adapter.hpp index 5e5d06288..3eacc7590 100644 --- a/host/lib/include/uhdlib/rfnoc/reg_iface_adapter.hpp +++ b/host/lib/include/uhdlib/rfnoc/reg_iface_adapter.hpp @@ -76,32 +76,32 @@ public: // nop } - void poke32(const uhd::wb_iface::wb_addr_type addr, const uint32_t data) + void poke32(const uhd::wb_iface::wb_addr_type addr, const uint32_t data) override { _regs_accessor().poke32(_base_offset + addr, data, _time_accessor()); } - void poke64(const uhd::wb_iface::wb_addr_type addr, const uint64_t data) + void poke64(const uhd::wb_iface::wb_addr_type addr, const uint64_t data) override { _regs_accessor().poke64(_base_offset + addr, data, _time_accessor()); } - uint32_t peek32(const uhd::wb_iface::wb_addr_type addr) + uint32_t peek32(const uhd::wb_iface::wb_addr_type addr) override { return _regs_accessor().peek32(_base_offset + addr, _time_accessor()); } - uint64_t peek64(const uhd::wb_iface::wb_addr_type addr) + uint64_t peek64(const uhd::wb_iface::wb_addr_type addr) override { return _regs_accessor().peek64(_base_offset + addr, _time_accessor()); } - uhd::time_spec_t get_time(void) + uhd::time_spec_t get_time(void) override { return _time_accessor(); } - void set_time(const uhd::time_spec_t& t) + void set_time(const uhd::time_spec_t& t) override { _time_setter(t); } diff --git a/host/lib/include/uhdlib/rfnoc/rfnoc_device.hpp b/host/lib/include/uhdlib/rfnoc/rfnoc_device.hpp index 4b2479ae5..de06c672f 100644 --- a/host/lib/include/uhdlib/rfnoc/rfnoc_device.hpp +++ b/host/lib/include/uhdlib/rfnoc/rfnoc_device.hpp @@ -39,19 +39,19 @@ public: } //! Directly getting a streamer no longer supported - uhd::rx_streamer::sptr get_rx_stream(const stream_args_t&) + uhd::rx_streamer::sptr get_rx_stream(const stream_args_t&) override { UHD_THROW_INVALID_CODE_PATH(); } //! Directly getting a streamer no longer supported - uhd::tx_streamer::sptr get_tx_stream(const stream_args_t&) + uhd::tx_streamer::sptr get_tx_stream(const stream_args_t&) override { UHD_THROW_INVALID_CODE_PATH(); } //! Directly getting async messages no longer supported - bool recv_async_msg(uhd::async_metadata_t&, double) + bool recv_async_msg(uhd::async_metadata_t&, double) override { UHD_THROW_INVALID_CODE_PATH(); } diff --git a/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp b/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp index 9cda81785..ca569e338 100644 --- a/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp +++ b/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp @@ -38,7 +38,7 @@ public: /*! Destructor */ - ~rfnoc_rx_streamer(); + ~rfnoc_rx_streamer() override; /*! Returns a unique identifier string for this node. In every RFNoC graph, * no two nodes cannot have the same ID. Returns a string in the form of @@ -46,13 +46,13 @@ public: * * \returns The unique ID as a string */ - std::string get_unique_id() const; + std::string get_unique_id() const override; /*! Returns the number of input ports for this block. * * \return noc_id The number of ports */ - size_t get_num_input_ports() const; + size_t get_num_input_ports() const override; /*! Returns the number of output ports for this block. * @@ -60,13 +60,13 @@ public: * * \return noc_id The number of ports */ - size_t get_num_output_ports() const; + size_t get_num_output_ports() const override; /*! Implementation of rx_streamer API method * * \param stream_cmd the stream command to issue */ - void issue_stream_cmd(const stream_cmd_t& stream_cmd); + void issue_stream_cmd(const stream_cmd_t& stream_cmd) override; /*! Returns stream args provided at creation * @@ -83,7 +83,7 @@ public: * \returns true if the block can deal with this configuration */ bool check_topology(const std::vector<size_t>& connected_inputs, - const std::vector<size_t>& connected_outputs); + const std::vector<size_t>& connected_outputs) override; /*! Connects a channel to the streamer port * @@ -92,7 +92,7 @@ public: * \param channel The streamer channel to which to connect * \param xport The transport for the specified channel */ - void connect_channel(const size_t channel, chdr_rx_data_xport::uptr xport); + void connect_channel(const size_t channel, chdr_rx_data_xport::uptr xport) override; private: void _register_props(const size_t chan, const std::string& otw_format); diff --git a/host/lib/include/uhdlib/rfnoc/rfnoc_tx_streamer.hpp b/host/lib/include/uhdlib/rfnoc/rfnoc_tx_streamer.hpp index 5d741a844..a071d7248 100644 --- a/host/lib/include/uhdlib/rfnoc/rfnoc_tx_streamer.hpp +++ b/host/lib/include/uhdlib/rfnoc/rfnoc_tx_streamer.hpp @@ -38,7 +38,7 @@ public: /*! Destructor */ - ~rfnoc_tx_streamer(); + ~rfnoc_tx_streamer() override; /*! Returns a unique identifier string for this node. In every RFNoC graph, * no two nodes cannot have the same ID. Returns a string in the form of @@ -46,7 +46,7 @@ public: * * \returns The unique ID as a string */ - std::string get_unique_id() const; + std::string get_unique_id() const override; /*! Returns the number of input ports for this block. * @@ -54,13 +54,13 @@ public: * * \return noc_id The number of ports */ - size_t get_num_input_ports() const; + size_t get_num_input_ports() const override; /*! Returns the number of output ports for this block. * * \return noc_id The number of ports */ - size_t get_num_output_ports() const; + size_t get_num_output_ports() const override; /*! Returns stream args provided at creation * @@ -77,7 +77,7 @@ public: * \returns true if the block can deal with this configuration */ bool check_topology(const std::vector<size_t>& connected_inputs, - const std::vector<size_t>& connected_outputs); + const std::vector<size_t>& connected_outputs) override; /*! Connects a channel to the streamer port * @@ -86,7 +86,7 @@ public: * \param channel The streamer channel to which to connect * \param xport The transport for the specified channel */ - void connect_channel(const size_t channel, chdr_tx_data_xport::uptr xport); + void connect_channel(const size_t channel, chdr_tx_data_xport::uptr xport) override; /*! Receive an asynchronous message from this tx stream * @@ -96,7 +96,7 @@ public: * \param timeout the timeout in seconds to wait for a message * \return true when the async_metadata is valid, false for timeout */ - bool recv_async_msg(uhd::async_metadata_t& async_metadata, double timeout); + bool recv_async_msg(uhd::async_metadata_t& async_metadata, double timeout) override; private: void _register_props(const size_t chan, const std::string& otw_format); diff --git a/host/lib/include/uhdlib/transport/dpdk_simple.hpp b/host/lib/include/uhdlib/transport/dpdk_simple.hpp index 072edbf9f..229e6b0be 100644 --- a/host/lib/include/uhdlib/transport/dpdk_simple.hpp +++ b/host/lib/include/uhdlib/transport/dpdk_simple.hpp @@ -13,7 +13,7 @@ namespace uhd { namespace transport { class dpdk_simple : public udp_simple { public: - virtual ~dpdk_simple(void) = 0; + ~dpdk_simple(void) override = 0; static udp_simple::sptr make_connected( const std::string& addr, const std::string& port); @@ -27,7 +27,7 @@ public: * \param buff single asio buffer * \return the number of bytes sent */ - virtual size_t send(const boost::asio::const_buffer& buff) = 0; + size_t send(const boost::asio::const_buffer& buff) override = 0; /*! * Receive into the provided buffer. @@ -36,19 +36,19 @@ public: * \param timeout the timeout in seconds * \return the number of bytes received or zero on timeout */ - virtual size_t recv( - const boost::asio::mutable_buffer& buff, double timeout = 0.1) = 0; + size_t recv( + const boost::asio::mutable_buffer& buff, double timeout = 0.1) override = 0; /*! * Get the last IP address as seen by recv(). * Only use this with the broadcast socket. */ - virtual std::string get_recv_addr(void) = 0; + std::string get_recv_addr(void) override = 0; /*! * Get the IP address for the destination */ - virtual std::string get_send_addr(void) = 0; + std::string get_send_addr(void) override = 0; }; }} // namespace uhd::transport diff --git a/host/lib/include/uhdlib/transport/inline_io_service.hpp b/host/lib/include/uhdlib/transport/inline_io_service.hpp index a9616dd86..b44b0bad5 100644 --- a/host/lib/include/uhdlib/transport/inline_io_service.hpp +++ b/host/lib/include/uhdlib/transport/inline_io_service.hpp @@ -33,18 +33,18 @@ public: ~inline_io_service(); - void attach_recv_link(recv_link_if::sptr link); - void attach_send_link(send_link_if::sptr link); + void attach_recv_link(recv_link_if::sptr link) override; + void attach_send_link(send_link_if::sptr link) override; - void detach_recv_link(recv_link_if::sptr link); - void detach_send_link(send_link_if::sptr link); + void detach_recv_link(recv_link_if::sptr link) override; + void detach_send_link(send_link_if::sptr link) override; recv_io_if::sptr make_recv_client(recv_link_if::sptr data_link, size_t num_recv_frames, recv_callback_t cb, send_link_if::sptr fc_link, size_t num_send_frames, - recv_io_if::fc_callback_t fc_cb); + recv_io_if::fc_callback_t fc_cb) override; send_io_if::sptr make_send_client(send_link_if::sptr send_link, size_t num_send_frames, @@ -52,7 +52,7 @@ public: recv_link_if::sptr recv_link, size_t num_recv_frames, recv_callback_t recv_cb, - send_io_if::fc_callback_t fc_cb); + send_io_if::fc_callback_t fc_cb) override; private: friend class inline_recv_io; diff --git a/host/lib/include/uhdlib/transport/link_base.hpp b/host/lib/include/uhdlib/transport/link_base.hpp index 078b82fc6..e2b0425bd 100644 --- a/host/lib/include/uhdlib/transport/link_base.hpp +++ b/host/lib/include/uhdlib/transport/link_base.hpp @@ -74,17 +74,17 @@ public: { } - virtual size_t get_num_send_frames() const + size_t get_num_send_frames() const override { return _num_send_frames; } - virtual size_t get_send_frame_size() const + size_t get_send_frame_size() const override { return _send_frame_size; } - virtual frame_buff::uptr get_send_buff(int32_t timeout_ms) + frame_buff::uptr get_send_buff(int32_t timeout_ms) override { frame_buff* buff = _free_send_buffs.pop(); @@ -99,7 +99,7 @@ public: return frame_buff::uptr(buff); } - virtual void release_send_buff(frame_buff::uptr buff) + void release_send_buff(frame_buff::uptr buff) override { frame_buff* buff_ptr = buff.release(); assert(buff_ptr); @@ -164,17 +164,17 @@ public: { } - virtual size_t get_num_recv_frames() const + size_t get_num_recv_frames() const override { return _num_recv_frames; } - virtual size_t get_recv_frame_size() const + size_t get_recv_frame_size() const override { return _recv_frame_size; } - virtual frame_buff::uptr get_recv_buff(int32_t timeout_ms) + frame_buff::uptr get_recv_buff(int32_t timeout_ms) override { frame_buff* buff = _free_recv_buffs.pop(); @@ -192,7 +192,7 @@ public: } } - virtual void release_recv_buff(frame_buff::uptr buff) + void release_recv_buff(frame_buff::uptr buff) override { frame_buff* buff_ptr = buff.release(); assert(buff_ptr); diff --git a/host/lib/include/uhdlib/transport/nirio_link.hpp b/host/lib/include/uhdlib/transport/nirio_link.hpp index 84d55113d..33e22cf1a 100644 --- a/host/lib/include/uhdlib/transport/nirio_link.hpp +++ b/host/lib/include/uhdlib/transport/nirio_link.hpp @@ -48,7 +48,7 @@ public: ~nirio_adapter_info() {} - std::string to_string() + std::string to_string() override { return std::string("NIRIO:") + _resource; } @@ -92,7 +92,7 @@ public: /*! * Get the physical adapter ID used for this link */ - adapter_id_t get_send_adapter_id() const + adapter_id_t get_send_adapter_id() const override { return _adapter_id; } @@ -100,7 +100,7 @@ public: /*! * Get the physical adapter ID used for this link */ - adapter_id_t get_recv_adapter_id() const + adapter_id_t get_recv_adapter_id() const override { return _adapter_id; } @@ -109,7 +109,7 @@ public: * Returns whether this link type supports releasing the frame buffers * in an order different from that in which they were acquired. */ - bool supports_send_buff_out_of_order() const + bool supports_send_buff_out_of_order() const override { return false; } @@ -118,7 +118,7 @@ public: * Returns whether this link type supports releasing the frame buffers * in an order different from that in which they were acquired. */ - bool supports_recv_buff_out_of_order() const + bool supports_recv_buff_out_of_order() const override { return false; } diff --git a/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp b/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp index ce66d2ccb..00ce558b8 100644 --- a/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp +++ b/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp @@ -106,13 +106,13 @@ public: } //! Implementation of rx_streamer API method - size_t get_num_channels() const + size_t get_num_channels() const override { return _zero_copy_streamer.get_num_channels(); } //! Implementation of rx_streamer API method - size_t get_max_num_samps() const + size_t get_max_num_samps() const override { return _spp; } @@ -130,7 +130,7 @@ public: const size_t nsamps_per_buff, uhd::rx_metadata_t& metadata, const double timeout, - const bool one_packet) + const bool one_packet) override { if (_error_metadata_cache.check(metadata)) { return 0; diff --git a/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp b/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp index ae6a1b867..4cb5c032b 100644 --- a/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp +++ b/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp @@ -127,12 +127,12 @@ public: } } - size_t get_num_channels() const + size_t get_num_channels() const override { return _zero_copy_streamer.get_num_channels(); } - size_t get_max_num_samps() const + size_t get_max_num_samps() const override { return _spp; } @@ -148,7 +148,7 @@ public: size_t send(const uhd::tx_streamer::buffs_type& buffs, const size_t nsamps_per_buff, const uhd::tx_metadata_t& metadata_, - const double timeout) + const double timeout) override { uhd::tx_metadata_t metadata(metadata_); diff --git a/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp b/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp index a5ba976c7..34fbf3edd 100644 --- a/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp +++ b/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp @@ -38,7 +38,7 @@ public: ~udp_boost_asio_adapter_info() {} - std::string to_string() + std::string to_string() override { return std::string("Ethernet(kernel):") + _src_ip.to_string(); } @@ -90,7 +90,7 @@ public: /*! * Get the physical adapter ID used for this link */ - adapter_id_t get_send_adapter_id() const + adapter_id_t get_send_adapter_id() const override { return _adapter_id; } @@ -98,7 +98,7 @@ public: /*! * Get the physical adapter ID used for this link */ - adapter_id_t get_recv_adapter_id() const + adapter_id_t get_recv_adapter_id() const override { return _adapter_id; } diff --git a/host/lib/include/uhdlib/usrp/common/adf435x.hpp b/host/lib/include/uhdlib/usrp/common/adf435x.hpp index de93bfd69..8c47c94fd 100644 --- a/host/lib/include/uhdlib/usrp/common/adf435x.hpp +++ b/host/lib/include/uhdlib/usrp/common/adf435x.hpp @@ -139,19 +139,19 @@ public: { } - virtual ~adf435x_impl(){}; + ~adf435x_impl() override{}; - void set_reference_freq(double fref) + void set_reference_freq(double fref) override { _reference_freq = fref; } - void set_feedback_select(feedback_sel_t fb_sel) + void set_feedback_select(feedback_sel_t fb_sel) override { _fb_after_divider = (fb_sel == FB_SEL_DIVIDED); } - void set_prescaler(prescaler_t prescaler) + void set_prescaler(prescaler_t prescaler) override { if (prescaler == PRESCALER_8_9) { _regs.prescaler = adf435x_regs_t::PRESCALER_8_9; @@ -162,7 +162,7 @@ public: } } - void set_output_power(output_t output, output_power_t power) + void set_output_power(output_t output, output_power_t power) override { switch (output) { case RF_OUTPUT_A: @@ -206,7 +206,7 @@ public: } } - void set_output_enable(output_t output, bool enable) + void set_output_enable(output_t output, bool enable) override { switch (output) { case RF_OUTPUT_A: @@ -222,7 +222,7 @@ public: } } - void set_muxout_mode(muxout_t mode) + void set_muxout_mode(muxout_t mode) override { switch (mode) { case MUXOUT_3STATE: @@ -251,7 +251,7 @@ public: } } - void set_tuning_mode(tuning_mode_t mode) + void set_tuning_mode(tuning_mode_t mode) override { // New mode applies to subsequent tunes i.e. do not re-tune now _tuning_mode = mode; @@ -262,7 +262,7 @@ public: _regs.phase_12_bit = (_tuning_mode == TUNING_MODE_HIGH_RESOLUTION) ? 0 : 1; } - void set_charge_pump_current(charge_pump_current_t cp_current) + void set_charge_pump_current(charge_pump_current_t cp_current) override { switch (cp_current) { case CHARGE_PUMP_CURRENT_0_31MA: @@ -318,7 +318,7 @@ public: } } - double set_charge_pump_current(const double current, const bool flush) + double set_charge_pump_current(const double current, const bool flush) override { const auto cp_range = get_charge_pump_current_range(); @@ -344,19 +344,19 @@ public: return coerced_current; } - uhd::meta_range_t get_charge_pump_current_range() + uhd::meta_range_t get_charge_pump_current_range() override { return uhd::meta_range_t(.3125e-6, 5e-6, .3125e-6); } - uhd::range_t get_int_range() + uhd::range_t get_int_range() override { if (_N_min < 0) throw uhd::runtime_error("set_prescaler must be called before get_int_range"); return uhd::range_t(_N_min, 4095); } - double set_frequency(double target_freq, bool int_n_mode, bool flush = false) + double set_frequency(double target_freq, bool int_n_mode, bool flush = false) override { static const double REF_DOUBLER_THRESH_FREQ = 12.5e6; static const double PFD_FREQ_MAX = 25.0e6; @@ -531,7 +531,7 @@ public: return actual_freq; } - void commit() + void commit() override { // reset counters _regs.counter_reset = adf435x_regs_t::COUNTER_RESET_ENABLED; diff --git a/host/lib/include/uhdlib/usrp/common/max287x.hpp b/host/lib/include/uhdlib/usrp/common/max287x.hpp index 5e23649ef..8aa7e947e 100644 --- a/host/lib/include/uhdlib/usrp/common/max287x.hpp +++ b/host/lib/include/uhdlib/usrp/common/max287x.hpp @@ -224,24 +224,26 @@ class max287x : public max287x_iface { public: max287x(write_fn func); - virtual ~max287x(); - virtual void power_up(void); - virtual void shutdown(void); - virtual bool is_shutdown(void); - virtual double set_frequency( - double target_freq, double ref_freq, double target_pfd_freq, bool is_int_n); - virtual void set_output_power(output_power_t power); - virtual void set_ld_pin_mode(ld_pin_mode_t mode); - virtual void set_muxout_mode(muxout_mode_t mode); - virtual void set_charge_pump_current(charge_pump_current_t cp_current); - virtual void set_auto_retune(bool enabled); - virtual void set_clock_divider_mode(clock_divider_mode_t mode); - virtual void set_cycle_slip_mode(bool enabled); - virtual void set_low_noise_and_spur(low_noise_and_spur_t mode); - virtual void set_phase(uint16_t phase); - virtual void commit(); - virtual bool can_sync(); - virtual void config_for_sync(bool enable); + ~max287x() override; + void power_up(void) override; + void shutdown(void) override; + bool is_shutdown(void) override; + double set_frequency(double target_freq, + double ref_freq, + double target_pfd_freq, + bool is_int_n) override; + void set_output_power(output_power_t power) override; + void set_ld_pin_mode(ld_pin_mode_t mode) override; + void set_muxout_mode(muxout_mode_t mode) override; + void set_charge_pump_current(charge_pump_current_t cp_current) override; + void set_auto_retune(bool enabled) override; + void set_clock_divider_mode(clock_divider_mode_t mode) override; + void set_cycle_slip_mode(bool enabled) override; + void set_low_noise_and_spur(low_noise_and_spur_t mode) override; + void set_phase(uint16_t phase) override; + void commit() override; + bool can_sync() override; + void config_for_sync(bool enable) override; protected: max287x_regs_t _regs; @@ -261,9 +263,11 @@ class max2870 : public max287x<max2870_regs_t> { public: max2870(write_fn func) : max287x<max2870_regs_t>(func) {} - ~max2870() {} - double set_frequency( - double target_freq, double ref_freq, double target_pfd_freq, bool is_int_n) + ~max2870() override {} + double set_frequency(double target_freq, + double ref_freq, + double target_pfd_freq, + bool is_int_n) override { _regs.cpoc = is_int_n ? max2870_regs_t::CPOC_ENABLED : max2870_regs_t::CPOC_DISABLED; @@ -274,7 +278,7 @@ public: return max287x<max2870_regs_t>::set_frequency( target_freq, ref_freq, target_pfd_freq, is_int_n); } - void commit(void) + void commit(void) override { // For MAX2870, we always need to write all registers. _write_all_regs = true; @@ -354,8 +358,8 @@ class max2871 : public max287x<max2871_regs_t> { public: max2871(write_fn func) : max287x<max2871_regs_t>(func) {} - ~max2871(){}; - void set_muxout_mode(muxout_mode_t mode) + ~max2871() override{}; + void set_muxout_mode(muxout_mode_t mode) override { switch (mode) { case MUXOUT_SYNC: @@ -369,8 +373,10 @@ public: } } - double set_frequency( - double target_freq, double ref_freq, double target_pfd_freq, bool is_int_n) + double set_frequency(double target_freq, + double ref_freq, + double target_pfd_freq, + bool is_int_n) override { _regs.feedback_select = max2871_regs_t::FEEDBACK_SELECT_DIVIDED; double freq = max287x<max2871_regs_t>::set_frequency( @@ -414,7 +420,7 @@ public: return freq; } - void commit() + void commit() override { max287x<max2871_regs_t>::commit(); @@ -883,7 +889,7 @@ void max287x<max287x_regs_t>::commit() try { changed_regs = _regs.template get_changed_addrs<uint32_t>(); // register 0 must be written to apply double buffered fields - if (changed_regs.size() > 0) { + if (!changed_regs.empty()) { changed_regs.insert(0); } diff --git a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp index acdd361e4..98e7f2ac4 100644 --- a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp +++ b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp @@ -55,11 +55,11 @@ public: // nop } - uint64_t get_ticks_now(); - uint64_t get_ticks_last_pps(); - void set_ticks_now(const uint64_t ticks); - void set_ticks_next_pps(const uint64_t ticks); - void set_period(const uint64_t period_ns); + uint64_t get_ticks_now() override; + uint64_t get_ticks_last_pps() override; + void set_ticks_now(const uint64_t ticks) override; + void set_ticks_next_pps(const uint64_t ticks) override; + void set_period(const uint64_t period_ns) override; /*! Update the tick rate * Note: This is separate from set_tick_rate because the latter is @@ -75,26 +75,28 @@ public: /************************************************************************** * Motherboard Control API (see mb_controller.hpp) *************************************************************************/ - std::string get_mboard_name() const; - void set_time_source(const std::string& source); - std::string get_time_source() const; - std::vector<std::string> get_time_sources() const; - void set_clock_source(const std::string& source); - std::string get_clock_source() const; - std::vector<std::string> get_clock_sources() const; - void set_sync_source(const std::string& clock_source, const std::string& time_source); - void set_sync_source(const uhd::device_addr_t& sync_source); - uhd::device_addr_t get_sync_source() const; - std::vector<uhd::device_addr_t> get_sync_sources(); - void set_clock_source_out(const bool enb); - void set_time_source_out(const bool enb); - uhd::sensor_value_t get_sensor(const std::string& name); - std::vector<std::string> get_sensor_names(); - uhd::usrp::mboard_eeprom_t get_eeprom(); - std::vector<std::string> get_gpio_banks() const; - std::vector<std::string> get_gpio_srcs(const std::string& bank) const; - std::vector<std::string> get_gpio_src(const std::string& bank); - void set_gpio_src(const std::string& bank, const std::vector<std::string>& src); + std::string get_mboard_name() const override; + void set_time_source(const std::string& source) override; + std::string get_time_source() const override; + std::vector<std::string> get_time_sources() const override; + void set_clock_source(const std::string& source) override; + std::string get_clock_source() const override; + std::vector<std::string> get_clock_sources() const override; + void set_sync_source( + const std::string& clock_source, const std::string& time_source) override; + void set_sync_source(const uhd::device_addr_t& sync_source) override; + uhd::device_addr_t get_sync_source() const override; + std::vector<uhd::device_addr_t> get_sync_sources() override; + void set_clock_source_out(const bool enb) override; + void set_time_source_out(const bool enb) override; + uhd::sensor_value_t get_sensor(const std::string& name) override; + std::vector<std::string> get_sensor_names() override; + uhd::usrp::mboard_eeprom_t get_eeprom() override; + std::vector<std::string> get_gpio_banks() const override; + std::vector<std::string> get_gpio_srcs(const std::string& bank) const override; + std::vector<std::string> get_gpio_src(const std::string& bank) override; + void set_gpio_src( + const std::string& bank, const std::vector<std::string>& src) override; private: /************************************************************************** diff --git a/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp b/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp index 9cbede8e4..0e1041642 100644 --- a/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp +++ b/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp @@ -117,32 +117,32 @@ struct recv_packet_demuxer_proxy_3000 : transport::zero_copy_if _demux->realloc_sid(_sid); // causes clear } - ~recv_packet_demuxer_proxy_3000(void) + ~recv_packet_demuxer_proxy_3000(void) override { _demux->realloc_sid(_sid); // causes clear } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return _xport->get_num_recv_frames(); } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _xport->get_recv_frame_size(); } - transport::managed_recv_buffer::sptr get_recv_buff(double timeout) + transport::managed_recv_buffer::sptr get_recv_buff(double timeout) override { return _demux->get_recv_buff(_sid, timeout); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _xport->get_num_send_frames(); } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _xport->get_send_frame_size(); } - transport::managed_send_buffer::sptr get_send_buff(double timeout) + transport::managed_send_buffer::sptr get_send_buff(double timeout) override { return _xport->get_send_buff(timeout); } diff --git a/host/lib/include/uhdlib/usrp/constrained_device_args.hpp b/host/lib/include/uhdlib/usrp/constrained_device_args.hpp index 7588462c4..bdd492752 100644 --- a/host/lib/include/uhdlib/usrp/constrained_device_args.hpp +++ b/host/lib/include/uhdlib/usrp/constrained_device_args.hpp @@ -79,7 +79,7 @@ public: // Types { set(str_rep); } - inline virtual std::string to_string() const + inline std::string to_string() const override { return key() + "=" + get(); } @@ -125,7 +125,7 @@ public: // Types % ex.what())); } } - inline virtual std::string to_string() const + inline std::string to_string() const override { return key() + "=" + std::to_string(get()); } @@ -179,7 +179,7 @@ public: // Types set(_str_values.at(str_rep_lowercase)); } - inline virtual std::string to_string() const + inline std::string to_string() const override { std::string repr; for (const auto& value : _str_values) { @@ -232,7 +232,7 @@ public: // Types % key() % ex.what())); } } - inline virtual std::string to_string() const + inline std::string to_string() const override { return key() + "=" + (get() ? "true" : "false"); } diff --git a/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp b/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp index e38f73127..08c77e282 100644 --- a/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp +++ b/host/lib/include/uhdlib/usrp/cores/i2c_core_100_wb32.hpp @@ -18,7 +18,7 @@ class i2c_core_100_wb32 : uhd::noncopyable, public uhd::i2c_iface public: typedef std::shared_ptr<i2c_core_100_wb32> sptr; - virtual ~i2c_core_100_wb32(void) = 0; + ~i2c_core_100_wb32(void) override = 0; //! makes a new i2c core from iface and slave base static sptr make(uhd::wb_iface::sptr iface, const size_t base); diff --git a/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp b/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp index 4b7353812..980b8997f 100644 --- a/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp +++ b/host/lib/include/uhdlib/usrp/cores/i2c_core_200.hpp @@ -19,7 +19,7 @@ class i2c_core_200 : uhd::noncopyable, public uhd::i2c_iface public: typedef std::shared_ptr<i2c_core_200> sptr; - virtual ~i2c_core_200(void) = 0; + ~i2c_core_200(void) override = 0; //! makes a new i2c core from iface and slave base static sptr make(uhd::wb_iface::sptr iface, const size_t base, const size_t readback); diff --git a/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp index 0b5ba6a6f..c24ee4524 100644 --- a/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp +++ b/host/lib/include/uhdlib/usrp/cores/radio_ctrl_core_3000.hpp @@ -23,7 +23,7 @@ class radio_ctrl_core_3000 : public uhd::timed_wb_iface public: typedef std::shared_ptr<radio_ctrl_core_3000> sptr; - virtual ~radio_ctrl_core_3000(void) = 0; + ~radio_ctrl_core_3000(void) override = 0; //! Make a new control object static sptr make(const bool big_endian, @@ -39,10 +39,10 @@ public: virtual void push_response(const uint32_t* buff) = 0; //! Set the command time that will activate - virtual void set_time(const uhd::time_spec_t& time) = 0; + void set_time(const uhd::time_spec_t& time) override = 0; //! Get the command time that will activate - virtual uhd::time_spec_t get_time(void) = 0; + uhd::time_spec_t get_time(void) override = 0; //! Set the tick rate (converting time into ticks) virtual void set_tick_rate(const double rate) = 0; diff --git a/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp index d08147407..a821ae602 100644 --- a/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp +++ b/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp @@ -21,7 +21,7 @@ public: using poke32_fn_t = std::function<void(uint32_t, uint32_t)>; using peek32_fn_t = std::function<uint32_t(uint32_t)>; - virtual ~spi_core_3000(void) = 0; + ~spi_core_3000(void) override = 0; //! makes a new spi core from iface and slave base static sptr make(uhd::wb_iface::sptr iface, const size_t base, const size_t readback); diff --git a/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp index 3f461ddb7..6e17e0b97 100644 --- a/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp +++ b/host/lib/include/uhdlib/usrp/cores/user_settings_core_3000.hpp @@ -15,7 +15,7 @@ class user_settings_core_3000 : public uhd::wb_iface { public: - virtual ~user_settings_core_3000() {} + ~user_settings_core_3000() override {} static sptr make(wb_iface::sptr iface, const wb_addr_type sr_base_addr, diff --git a/host/lib/property_tree.cpp b/host/lib/property_tree.cpp index 405c2ac6b..53268efd3 100644 --- a/host/lib/property_tree.cpp +++ b/host/lib/property_tree.cpp @@ -76,7 +76,7 @@ public: _guts = std::make_shared<tree_guts_type>(); } - sptr subtree(const fs_path& path_) const + sptr subtree(const fs_path& path_) const override { const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); @@ -86,7 +86,7 @@ public: return sptr(subtree); } - void remove(const fs_path& path_) + void remove(const fs_path& path_) override { const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); @@ -104,7 +104,7 @@ public: parent->pop(fs_path(path.leaf())); } - bool exists(const fs_path& path_) const + bool exists(const fs_path& path_) const override { const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); @@ -118,7 +118,7 @@ public: return true; } - std::vector<std::string> list(const fs_path& path_) const + std::vector<std::string> list(const fs_path& path_) const override { const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); @@ -133,7 +133,7 @@ public: return node->keys(); } - std::shared_ptr<void> _pop(const fs_path& path_) + std::shared_ptr<void> _pop(const fs_path& path_) override { const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); @@ -156,8 +156,7 @@ public: return prop; } - void _create(const fs_path& path_, - const std::shared_ptr<void>& prop) + void _create(const fs_path& path_, const std::shared_ptr<void>& prop) override { const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); @@ -174,7 +173,7 @@ public: node->prop = prop; } - std::shared_ptr<void>& _access(const fs_path& path_) const + std::shared_ptr<void>& _access(const fs_path& path_) const override { const fs_path path = _root / path_; boost::mutex::scoped_lock lock(_guts->mutex); diff --git a/host/lib/rfnoc/chdr_ctrl_endpoint.cpp b/host/lib/rfnoc/chdr_ctrl_endpoint.cpp index 8fe6a8856..592d3dde8 100644 --- a/host/lib/rfnoc/chdr_ctrl_endpoint.cpp +++ b/host/lib/rfnoc/chdr_ctrl_endpoint.cpp @@ -44,7 +44,7 @@ public: % thread_name % _my_epid); } - virtual ~chdr_ctrl_endpoint_impl() + ~chdr_ctrl_endpoint_impl() override { UHD_SAFE_CALL( // Interrupt buffer updater loop @@ -67,12 +67,12 @@ public: _endpoint_map.clear();); } - virtual ctrlport_endpoint::sptr get_ctrlport_ep(sep_id_t dst_epid, + ctrlport_endpoint::sptr get_ctrlport_ep(sep_id_t dst_epid, uint16_t dst_port, size_t buff_capacity, size_t max_outstanding_async_msgs, const clock_iface& client_clk, - const clock_iface& timebase_clk) + const clock_iface& timebase_clk) override { std::lock_guard<std::mutex> lock(_mutex); @@ -111,7 +111,7 @@ public: } } - virtual size_t get_num_drops() const + size_t get_num_drops() const override { return _num_drops; } diff --git a/host/lib/rfnoc/chdr_packet_writer.cpp b/host/lib/rfnoc/chdr_packet_writer.cpp index c58ffd932..95bf5c5d2 100644 --- a/host/lib/rfnoc/chdr_packet_writer.cpp +++ b/host/lib/rfnoc/chdr_packet_writer.cpp @@ -25,16 +25,16 @@ class chdr_packet_impl : public chdr_packet_writer public: chdr_packet_impl() = delete; chdr_packet_impl(size_t mtu_bytes) : _mtu_bytes(mtu_bytes) {} - ~chdr_packet_impl() = default; + ~chdr_packet_impl() override = default; - virtual void refresh(const void* pkt_buff) const + void refresh(const void* pkt_buff) const override { assert(pkt_buff); _pkt_buff = const_cast<uint64_t*>(reinterpret_cast<const uint64_t*>(pkt_buff)); _mdata_offset = _compute_mdata_offset(get_chdr_header()); } - virtual void refresh(void* pkt_buff, chdr_header& header, uint64_t timestamp = 0) + void refresh(void* pkt_buff, chdr_header& header, uint64_t timestamp = 0) override { assert(pkt_buff); _pkt_buff = reinterpret_cast<uint64_t*>(pkt_buff); @@ -45,7 +45,7 @@ public: _mdata_offset = _compute_mdata_offset(get_chdr_header()); } - virtual void update_payload_size(size_t payload_size_bytes) + void update_payload_size(size_t payload_size_bytes) override { chdr_header header = get_chdr_header(); header.set_length(((_mdata_offset + header.get_num_mdata()) * chdr_w_bytes) @@ -53,23 +53,23 @@ public: _pkt_buff[0] = u64_from_host(header); } - virtual endianness_t get_byte_order() const + endianness_t get_byte_order() const override { return endianness; } - virtual size_t get_mtu_bytes() const + size_t get_mtu_bytes() const override { return _mtu_bytes; } - virtual chdr_header get_chdr_header() const + chdr_header get_chdr_header() const override { assert(_pkt_buff); return std::move(chdr_header(u64_to_host(_pkt_buff[0]))); } - virtual boost::optional<uint64_t> get_timestamp() const + boost::optional<uint64_t> get_timestamp() const override { if (_has_timestamp(get_chdr_header())) { // In a unit64_t buffer, the timestamp is always immediately after the header @@ -80,43 +80,43 @@ public: } } - virtual size_t get_mdata_size() const + size_t get_mdata_size() const override { return get_chdr_header().get_num_mdata() * chdr_w_bytes; } - virtual const void* get_mdata_const_ptr() const + const void* get_mdata_const_ptr() const override { return const_cast<void*>( const_cast<chdr_packet_impl<chdr_w, endianness>*>(this)->get_mdata_ptr()); } - virtual void* get_mdata_ptr() + void* get_mdata_ptr() override { return reinterpret_cast<void*>(_pkt_buff + (chdr_w_stride * _mdata_offset)); } - virtual size_t get_payload_size() const + size_t get_payload_size() const override { return get_chdr_header().get_length() - get_mdata_size() - (chdr_w_bytes * _mdata_offset); } - virtual const void* get_payload_const_ptr() const + const void* get_payload_const_ptr() const override { return const_cast<void*>( const_cast<chdr_packet_impl<chdr_w, endianness>*>(this)->get_payload_ptr()); } - virtual void* get_payload_ptr() + void* get_payload_ptr() override { return reinterpret_cast<void*>( _pkt_buff + (chdr_w_stride * (_mdata_offset + get_chdr_header().get_num_mdata()))); } - virtual size_t calculate_payload_offset( - const packet_type_t pkt_type, const uint8_t num_mdata = 0) const + size_t calculate_payload_offset( + const packet_type_t pkt_type, const uint8_t num_mdata = 0) const override { chdr_header header; header.set_pkt_type(pkt_type); diff --git a/host/lib/rfnoc/chdr_types.cpp b/host/lib/rfnoc/chdr_types.cpp index 950bf39f2..7975a0228 100644 --- a/host/lib/rfnoc/chdr_types.cpp +++ b/host/lib/rfnoc/chdr_types.cpp @@ -48,7 +48,7 @@ size_t ctrl_payload::serialize(uint64_t* buff, { // Ctrl Packet Payload can't have more than 15 data -> 8 CHDR_W (RFNoC Spec. // Section 2.2.3) - UHD_ASSERT_THROW((data_vtr.size() > 0 && data_vtr.size() < 16)); + UHD_ASSERT_THROW((!data_vtr.empty() && data_vtr.size() < 16)); UHD_ASSERT_THROW(get_length() * sizeof(uint64_t) <= max_size_bytes); size_t ptr = 0; @@ -108,7 +108,7 @@ void ctrl_payload::deserialize(const uint64_t* buff, // Read control header uint64_t ctrl_header = conv_byte_order(buff[ptr++]); data_vtr.resize(get_field_u64<size_t>(ctrl_header, NUM_DATA_OFFSET, NUM_DATA_WIDTH)); - UHD_ASSERT_THROW((data_vtr.size() > 0 && data_vtr.size() < 16)); + UHD_ASSERT_THROW((!data_vtr.empty() && data_vtr.size() < 16)); dst_port = get_field_u64<uint16_t>(ctrl_header, DST_PORT_OFFSET, DST_PORT_WIDTH); src_port = get_field_u64<uint16_t>(ctrl_header, SRC_PORT_OFFSET, SRC_PORT_WIDTH); seq_num = get_field_u64<uint8_t>(ctrl_header, SEQ_NUM_OFFSET, SEQ_NUM_WIDTH); @@ -124,7 +124,7 @@ void ctrl_payload::deserialize(const uint64_t* buff, // Read control operation word uint64_t op_word = conv_byte_order(buff[ptr++]); - if (data_vtr.size() > 0) { + if (!data_vtr.empty()) { data_vtr[0] = get_field_u64<uint32_t>(op_word, HI_DATA_OFFSET, 32); } address = get_field_u64<uint32_t>(op_word, ADDRESS_OFFSET, ADDRESS_WIDTH); diff --git a/host/lib/rfnoc/ctrlport_endpoint.cpp b/host/lib/rfnoc/ctrlport_endpoint.cpp index 607cc6f72..c544a3d4e 100644 --- a/host/lib/rfnoc/ctrlport_endpoint.cpp +++ b/host/lib/rfnoc/ctrlport_endpoint.cpp @@ -57,12 +57,12 @@ public: { } - virtual ~ctrlport_endpoint_impl() = default; + ~ctrlport_endpoint_impl() override = default; - virtual void poke32(uint32_t addr, + void poke32(uint32_t addr, uint32_t data, uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP, - bool ack = false) + bool ack = false) override { // Send request auto request = send_request_packet(OP_WRITE, addr, {data}, timestamp); @@ -72,10 +72,10 @@ public: } } - virtual void multi_poke32(const std::vector<uint32_t> addrs, + void multi_poke32(const std::vector<uint32_t> addrs, const std::vector<uint32_t> data, uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP, - bool ack = false) + bool ack = false) override { if (addrs.size() != data.size()) { throw uhd::value_error("addrs and data vectors must be of the same length"); @@ -88,10 +88,10 @@ public: } } - virtual void block_poke32(uint32_t first_addr, + void block_poke32(uint32_t first_addr, const std::vector<uint32_t> data, uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP, - bool ack = false) + bool ack = false) override { for (size_t i = 0; i < data.size(); i++) { poke32(first_addr + (i * sizeof(uint32_t)), @@ -110,8 +110,8 @@ public: */ } - virtual uint32_t peek32( - uint32_t addr, uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP) + uint32_t peek32( + uint32_t addr, uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP) override { // Send request auto request = send_request_packet(OP_READ, addr, {uint32_t(0)}, timestamp); @@ -121,9 +121,9 @@ public: return response.data_vtr[0]; } - virtual std::vector<uint32_t> block_peek32(uint32_t first_addr, + std::vector<uint32_t> block_peek32(uint32_t first_addr, size_t length, - uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP) + uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP) override { std::vector<uint32_t> values; for (size_t i = 0; i < length; i++) { @@ -145,12 +145,12 @@ public: */ } - virtual void poll32(uint32_t addr, + void poll32(uint32_t addr, uint32_t data, uint32_t mask, uhd::time_spec_t timeout, uhd::time_spec_t timestamp = uhd::time_spec_t::ASAP, - bool ack = false) + bool ack = false) override { // TODO: Uncomment when this is implemented in the FPGA throw uhd::not_implemented_error("Control poll not implemented in the FPGA"); @@ -169,7 +169,7 @@ public: } } - virtual void sleep(uhd::time_spec_t duration, bool ack = false) + void sleep(uhd::time_spec_t duration, bool ack = false) override { // Send request auto request = send_request_packet(OP_SLEEP, @@ -183,19 +183,19 @@ public: } } - virtual void register_async_msg_validator(async_msg_validator_t callback_f) + void register_async_msg_validator(async_msg_validator_t callback_f) override { std::unique_lock<std::mutex> lock(_mutex); _validate_async_msg = callback_f; } - virtual void register_async_msg_handler(async_msg_callback_t callback_f) + void register_async_msg_handler(async_msg_callback_t callback_f) override { std::unique_lock<std::mutex> lock(_mutex); _handle_async_msg = callback_f; } - virtual void set_policy(const std::string& name, const uhd::device_addr_t& args) + void set_policy(const std::string& name, const uhd::device_addr_t& args) override { std::unique_lock<std::mutex> lock(_mutex); if (name == "default") { @@ -207,7 +207,7 @@ public: } } - virtual void handle_recv(const ctrl_payload& rx_ctrl) + void handle_recv(const ctrl_payload& rx_ctrl) override { if (rx_ctrl.is_ack) { // Function to process a response with no sequence errors @@ -312,13 +312,13 @@ public: } } - virtual uint16_t get_src_epid() const + uint16_t get_src_epid() const override { // Is const, does not require a mutex return _my_epid; } - virtual uint16_t get_port_num() const + uint16_t get_port_num() const override { // Is const, does not require a mutex return _local_port; @@ -447,7 +447,7 @@ private: throw uhd::op_timerr("Control operation returned a timestamp error"); } // Check data vector size - if (rx_ctrl.data_vtr.size() == 0) { + if (rx_ctrl.data_vtr.empty()) { throw uhd::op_failed( "Control operation returned a malformed response"); } diff --git a/host/lib/rfnoc/ddc_block_control.cpp b/host/lib/rfnoc/ddc_block_control.cpp index 99a00dd1d..91c53a5e9 100644 --- a/host/lib/rfnoc/ddc_block_control.cpp +++ b/host/lib/rfnoc/ddc_block_control.cpp @@ -106,7 +106,7 @@ public: double set_freq(const double freq, const size_t chan, - const boost::optional<uhd::time_spec_t> time) + const boost::optional<uhd::time_spec_t> time) override { // Store the current command time so we can restore it later auto prev_cmd_time = get_command_time(chan); @@ -119,12 +119,12 @@ public: return get_freq(chan); } - double get_freq(const size_t chan) const + double get_freq(const size_t chan) const override { return _freq.at(chan).get(); } - uhd::freq_range_t get_frequency_range(const size_t chan) const + uhd::freq_range_t get_frequency_range(const size_t chan) const override { const double input_rate = _samp_rate_in.at(chan).is_valid() ? _samp_rate_in.at(chan).get() : 1.0; @@ -132,22 +132,22 @@ public: return uhd::freq_range_t(-input_rate / 2, input_rate / 2); } - double get_input_rate(const size_t chan) const + double get_input_rate(const size_t chan) const override { return _samp_rate_in.at(chan).is_valid() ? _samp_rate_in.at(chan).get() : 1.0; } - void set_input_rate(const double rate, const size_t chan) + void set_input_rate(const double rate, const size_t chan) override { set_property<double>("samp_rate", rate, {res_source_info::INPUT_EDGE, chan}); } - double get_output_rate(const size_t chan) const + double get_output_rate(const size_t chan) const override { return _samp_rate_out.at(chan).is_valid() ? _samp_rate_out.at(chan).get() : 1.0; } - uhd::meta_range_t get_output_rates(const size_t chan) const + uhd::meta_range_t get_output_rates(const size_t chan) const override { uhd::meta_range_t result; if (!_samp_rate_in.at(chan).is_valid()) { @@ -163,7 +163,7 @@ public: return result; } - double set_output_rate(const double rate, const size_t chan) + double set_output_rate(const double rate, const size_t chan) override { if (_samp_rate_in.at(chan).is_valid()) { const int coerced_decim = coerce_decim(get_input_rate(chan) / rate); @@ -184,7 +184,7 @@ public: // handler goes both ways. // This way, calling issue_stream_cmd() is the same as posting a message to // our output port. - void issue_stream_cmd(const uhd::stream_cmd_t& stream_cmd, const size_t port) + void issue_stream_cmd(const uhd::stream_cmd_t& stream_cmd, const size_t port) override { RFNOC_LOG_TRACE("issue_stream_cmd(stream_mode=" << char(stream_cmd.stream_mode) << ", port=" << port); diff --git a/host/lib/rfnoc/duc_block_control.cpp b/host/lib/rfnoc/duc_block_control.cpp index 0e75390bc..f78274067 100644 --- a/host/lib/rfnoc/duc_block_control.cpp +++ b/host/lib/rfnoc/duc_block_control.cpp @@ -103,7 +103,7 @@ public: double set_freq(const double freq, const size_t chan, - const boost::optional<uhd::time_spec_t> time) + const boost::optional<uhd::time_spec_t> time) override { // Store the current command time so we can restore it later auto prev_cmd_time = get_command_time(chan); @@ -116,12 +116,12 @@ public: return get_freq(chan); } - double get_freq(const size_t chan) const + double get_freq(const size_t chan) const override { return _freq.at(chan).get(); } - uhd::freq_range_t get_frequency_range(const size_t chan) const + uhd::freq_range_t get_frequency_range(const size_t chan) const override { const double input_rate = _samp_rate_in.at(chan).is_valid() ? _samp_rate_in.at(chan).get() : 1.0; @@ -129,22 +129,22 @@ public: return uhd::freq_range_t(-input_rate / 2, input_rate / 2); } - double get_input_rate(const size_t chan) const + double get_input_rate(const size_t chan) const override { return _samp_rate_in.at(chan).is_valid() ? _samp_rate_in.at(chan).get() : 1.0; } - double get_output_rate(const size_t chan) const + double get_output_rate(const size_t chan) const override { return _samp_rate_out.at(chan).is_valid() ? _samp_rate_out.at(chan).get() : 1.0; } - void set_output_rate(const double rate, const size_t chan) + void set_output_rate(const double rate, const size_t chan) override { set_property<double>("samp_rate", rate, {res_source_info::OUTPUT_EDGE, chan}); } - uhd::meta_range_t get_input_rates(const size_t chan) const + uhd::meta_range_t get_input_rates(const size_t chan) const override { uhd::meta_range_t result; if (!_samp_rate_out.at(chan).is_valid()) { @@ -160,7 +160,7 @@ public: return result; } - double set_input_rate(const double rate, const size_t chan) + double set_input_rate(const double rate, const size_t chan) override { if (_samp_rate_out.at(chan).is_valid()) { const int coerced_interp = coerce_interp(get_output_rate(chan) / rate); diff --git a/host/lib/rfnoc/fft_block_control.cpp b/host/lib/rfnoc/fft_block_control.cpp index 23ee380ac..d2ab368ff 100644 --- a/host/lib/rfnoc/fft_block_control.cpp +++ b/host/lib/rfnoc/fft_block_control.cpp @@ -47,52 +47,52 @@ public: _register_props(); } - void set_direction(const fft_direction direction) + void set_direction(const fft_direction direction) override { set_property<int>(PROP_KEY_DIRECTION, static_cast<int>(direction)); } - fft_direction get_direction() const + fft_direction get_direction() const override { return static_cast<fft_direction>(_direction.get()); } - void set_magnitude(const fft_magnitude magnitude) + void set_magnitude(const fft_magnitude magnitude) override { set_property<int>(PROP_KEY_MAGNITUDE, static_cast<int>(magnitude)); } - fft_magnitude get_magnitude() const + fft_magnitude get_magnitude() const override { return static_cast<fft_magnitude>(_magnitude.get()); } - void set_shift_config(const fft_shift shift) + void set_shift_config(const fft_shift shift) override { set_property<int>(PROP_KEY_SHIFT_CONFIG, static_cast<int>(shift)); } - fft_shift get_shift_config() const + fft_shift get_shift_config() const override { return static_cast<fft_shift>(_shift.get()); } - void set_scaling(const uint16_t scaling) + void set_scaling(const uint16_t scaling) override { set_property<int>(PROP_KEY_FFT_SCALING, scaling); } - uint16_t get_scaling() const + uint16_t get_scaling() const override { return static_cast<uint16_t>(_scaling.get()); } - void set_length(const size_t size) + void set_length(const size_t size) override { set_property<int>(PROP_KEY_LENGTH, size); } - size_t get_length() const + size_t get_length() const override { return static_cast<size_t>(_length.get()); } diff --git a/host/lib/rfnoc/fir_filter_block_control.cpp b/host/lib/rfnoc/fir_filter_block_control.cpp index 38a0e4b9c..a89e9691d 100644 --- a/host/lib/rfnoc/fir_filter_block_control.cpp +++ b/host/lib/rfnoc/fir_filter_block_control.cpp @@ -40,12 +40,12 @@ public: _program_coefficients(); } - size_t get_max_num_coefficients() const + size_t get_max_num_coefficients() const override { return _max_num_coeffs; } - void set_coefficients(const std::vector<int16_t>& coeffs) + void set_coefficients(const std::vector<int16_t>& coeffs) override { if (coeffs.size() > _max_num_coeffs) { std::string error_msg = @@ -62,7 +62,7 @@ public: _program_coefficients(); } - std::vector<int16_t> get_coefficients() const + std::vector<int16_t> get_coefficients() const override { return _coeffs; } diff --git a/host/lib/rfnoc/fosphor_block_control.cpp b/host/lib/rfnoc/fosphor_block_control.cpp index 6bf621982..9734c17d4 100644 --- a/host/lib/rfnoc/fosphor_block_control.cpp +++ b/host/lib/rfnoc/fosphor_block_control.cpp @@ -80,150 +80,150 @@ public: _register_props(); } - void set_enable_histogram(const bool enable_histogram) + void set_enable_histogram(const bool enable_histogram) override { set_property<bool>(PROP_KEY_ENABLE_HISTOGRAM, enable_histogram); } - bool get_enable_histogram() const + bool get_enable_histogram() const override { return _prop_enable_histogram.get(); } - void set_enable_waterfall(const bool enable_waterfall) + void set_enable_waterfall(const bool enable_waterfall) override { set_property<bool>(PROP_KEY_ENABLE_WATERFALL, enable_waterfall); } - bool get_enable_waterfall() const + bool get_enable_waterfall() const override { return _prop_enable_waterfall.get(); } - void clear_history() + void clear_history() override { set_property<bool>(PROP_KEY_CLEAR_HISTORY, true); } - void set_enable_dither(const bool enable_dither) + void set_enable_dither(const bool enable_dither) override { set_property<bool>(PROP_KEY_ENABLE_DITHER, enable_dither); } - bool get_enable_dither() const + bool get_enable_dither() const override { return _prop_enable_dither.get(); } - void set_enable_noise(const bool enable_noise) + void set_enable_noise(const bool enable_noise) override { set_property<bool>(PROP_KEY_ENABLE_NOISE, enable_noise); } - bool get_enable_noise() const + bool get_enable_noise() const override { return _prop_enable_noise.get(); } - void set_histogram_decimation(const uint16_t decimation) + void set_histogram_decimation(const uint16_t decimation) override { set_property<int>(PROP_KEY_HIST_DECIMATION, decimation); } - uint16_t get_histogram_decimation() const + uint16_t get_histogram_decimation() const override { return _prop_hist_decimation.get(); } - void set_histogram_offset(const uint16_t offset) + void set_histogram_offset(const uint16_t offset) override { set_property<int>(PROP_KEY_OFFSET, offset); } - uint16_t get_histogram_offset() const + uint16_t get_histogram_offset() const override { return _prop_offset.get(); } - void set_histogram_scale(const uint16_t scale) + void set_histogram_scale(const uint16_t scale) override { set_property<int>(PROP_KEY_SCALE, scale); } - uint16_t get_histogram_scale() const + uint16_t get_histogram_scale() const override { return _prop_scale.get(); } - void set_histogram_rise_rate(const uint16_t rise_rate) + void set_histogram_rise_rate(const uint16_t rise_rate) override { set_property<int>(PROP_KEY_RISE_TIME, rise_rate); } - uint16_t get_histogram_rise_rate() const + uint16_t get_histogram_rise_rate() const override { return _prop_trise.get(); } - void set_histogram_decay_rate(const uint16_t decay_rate) + void set_histogram_decay_rate(const uint16_t decay_rate) override { set_property<int>(PROP_KEY_DECAY_TIME, decay_rate); } - uint16_t get_histogram_decay_rate() const + uint16_t get_histogram_decay_rate() const override { return _prop_tdecay.get(); } - void set_spectrum_alpha(const uint16_t alpha) + void set_spectrum_alpha(const uint16_t alpha) override { set_property<int>(PROP_KEY_ALPHA, alpha); } - uint16_t get_spectrum_alpha() const + uint16_t get_spectrum_alpha() const override { return _prop_alpha.get(); } - void set_spectrum_max_hold_decay(const uint16_t epsilon) + void set_spectrum_max_hold_decay(const uint16_t epsilon) override { set_property<int>(PROP_KEY_EPSILON, epsilon); } - uint16_t get_spectrum_max_hold_decay() const + uint16_t get_spectrum_max_hold_decay() const override { return _prop_epsilon.get(); } void set_waterfall_predivision( - const fosphor_waterfall_predivision_ratio waterfall_predivision) + const fosphor_waterfall_predivision_ratio waterfall_predivision) override { set_property<int>( PROP_KEY_WF_PREDIVISION_RATIO, static_cast<int>(waterfall_predivision)); } - fosphor_waterfall_predivision_ratio get_waterfall_predivision() const + fosphor_waterfall_predivision_ratio get_waterfall_predivision() const override { return static_cast<fosphor_waterfall_predivision_ratio>( _prop_wf_prediv_ratio.get()); } - void set_waterfall_mode(const fosphor_waterfall_mode waterfall_mode) + void set_waterfall_mode(const fosphor_waterfall_mode waterfall_mode) override { set_property<int>(PROP_KEY_WF_MODE, static_cast<int>(waterfall_mode)); } - fosphor_waterfall_mode get_waterfall_mode() const + fosphor_waterfall_mode get_waterfall_mode() const override { return static_cast<fosphor_waterfall_mode>(_prop_wf_mode.get()); } - void set_waterfall_decimation(const uint16_t waterfall_decimation) + void set_waterfall_decimation(const uint16_t waterfall_decimation) override { set_property<int>(PROP_KEY_WF_DECIMATION, waterfall_decimation); } - uint16_t get_waterfall_decimation() const + uint16_t get_waterfall_decimation() const override { return _prop_wf_decim.get(); } diff --git a/host/lib/rfnoc/graph_stream_manager.cpp b/host/lib/rfnoc/graph_stream_manager.cpp index be2dff3ce..de86d299b 100644 --- a/host/lib/rfnoc/graph_stream_manager.cpp +++ b/host/lib/rfnoc/graph_stream_manager.cpp @@ -51,14 +51,14 @@ public: } } - virtual ~graph_stream_manager_impl() = default; + ~graph_stream_manager_impl() override = default; - virtual const std::set<sep_addr_t>& get_reachable_endpoints() const + const std::set<sep_addr_t>& get_reachable_endpoints() const override { return _reachable_endpoints; } - virtual std::vector<device_id_t> get_local_devices() const + std::vector<device_id_t> get_local_devices() const override { std::vector<device_id_t> retval; for (const auto& mgr_pair : _link_mgrs) { @@ -67,8 +67,8 @@ public: return retval; } - virtual sep_id_pair_t connect_host_to_device(sep_addr_t dst_addr, - uhd::transport::adapter_id_t adapter = uhd::transport::NULL_ADAPTER_ID) + sep_id_pair_t connect_host_to_device(sep_addr_t dst_addr, + uhd::transport::adapter_id_t adapter = uhd::transport::NULL_ADAPTER_ID) override { UHD_LOGGER_DEBUG("RFNOC::GRAPH") << boost::format("Connecting the Host to Endpoint %d:%d through Adapter " @@ -90,8 +90,8 @@ public: return epid_pair; } - virtual sep_id_pair_t connect_device_to_device( - sep_addr_t dst_addr, sep_addr_t src_addr) + sep_id_pair_t connect_device_to_device( + sep_addr_t dst_addr, sep_addr_t src_addr) override { UHD_LOGGER_DEBUG("RFNOC::GRAPH") << boost::format("Connecting the Endpoint %d:%d to Endpoint %d:%d...") @@ -119,11 +119,11 @@ public: "specified source endpoint"); } - virtual ctrlport_endpoint::sptr get_block_register_iface(sep_addr_t dst_addr, + ctrlport_endpoint::sptr get_block_register_iface(sep_addr_t dst_addr, uint16_t block_index, const clock_iface& client_clk, const clock_iface& timebase_clk, - uhd::transport::adapter_id_t adapter = uhd::transport::NULL_ADAPTER_ID) + uhd::transport::adapter_id_t adapter = uhd::transport::NULL_ADAPTER_ID) override { // We must be connected to dst_addr before getting a register iface sep_id_t dst_epid = _epid_alloc->get_epid(dst_addr); @@ -133,8 +133,9 @@ public: dst_epid, block_index, client_clk, timebase_clk); } - virtual detail::client_zero::sptr get_client_zero(sep_addr_t dst_addr, - uhd::transport::adapter_id_t adapter = uhd::transport::NULL_ADAPTER_ID) const + detail::client_zero::sptr get_client_zero(sep_addr_t dst_addr, + uhd::transport::adapter_id_t adapter = + uhd::transport::NULL_ADAPTER_ID) const override { // We must be connected to dst_addr before getting a client zero sep_id_t dst_epid = _epid_alloc->get_epid(dst_addr); @@ -143,13 +144,13 @@ public: return _link_mgrs.at(dev)->get_client_zero(dst_epid); } - virtual std::tuple<sep_id_pair_t, stream_buff_params_t> - create_device_to_device_data_stream(const sep_addr_t dst_addr, + std::tuple<sep_id_pair_t, stream_buff_params_t> create_device_to_device_data_stream( + const sep_addr_t dst_addr, const sep_addr_t src_addr, const bool lossy_xport, const double fc_freq_ratio, const double fc_headroom_ratio, - const bool reset = false) + const bool reset = false) override { UHD_LOGGER_DEBUG("RFNOC::GRAPH") << boost::format( @@ -190,7 +191,7 @@ public: const sw_buff_t mdata_buff_fmt, const uhd::transport::adapter_id_t adapter, const device_addr_t& xport_args, - const std::string& streamer_id) + const std::string& streamer_id) override { device_id_t dev = _check_dst_and_find_src( src_addr, adapter, uhd::transport::link_type_t::RX_DATA); @@ -202,13 +203,12 @@ public: src_addr, pyld_buff_fmt, mdata_buff_fmt, xport_args, streamer_id); } - virtual chdr_tx_data_xport::uptr create_host_to_device_data_stream( - sep_addr_t dst_addr, + chdr_tx_data_xport::uptr create_host_to_device_data_stream(sep_addr_t dst_addr, const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, const uhd::transport::adapter_id_t adapter, const device_addr_t& xport_args, - const std::string& streamer_id) + const std::string& streamer_id) override { device_id_t dev = _check_dst_and_find_src( dst_addr, adapter, uhd::transport::link_type_t::TX_DATA); @@ -220,7 +220,7 @@ public: dst_addr, pyld_buff_fmt, mdata_buff_fmt, xport_args, streamer_id); } - std::vector<uhd::transport::adapter_id_t> get_adapters(sep_addr_t addr) const + std::vector<uhd::transport::adapter_id_t> get_adapters(sep_addr_t addr) const override { auto adapters = std::vector<uhd::transport::adapter_id_t>(); if (_src_map.count(addr) > 0) { diff --git a/host/lib/rfnoc/keep_one_in_n_block_control.cpp b/host/lib/rfnoc/keep_one_in_n_block_control.cpp index baec58fbf..da0dcda90 100644 --- a/host/lib/rfnoc/keep_one_in_n_block_control.cpp +++ b/host/lib/rfnoc/keep_one_in_n_block_control.cpp @@ -35,27 +35,27 @@ public: _register_props(); } - size_t get_max_n() const + size_t get_max_n() const override { return _max_n; } - void set_n(const size_t n, const size_t chan = 0) + void set_n(const size_t n, const size_t chan = 0) override { set_property<int>(PROP_KEY_N, static_cast<int>(n), chan); } - size_t get_n(const size_t chan = 0) const + size_t get_n(const size_t chan = 0) const override { return _n.at(chan).get(); } - void set_mode(const mode mode, const size_t chan = 0) + void set_mode(const mode mode, const size_t chan = 0) override { set_property<int>(PROP_KEY_MODE, static_cast<int>(mode), chan); } - mode get_mode(const size_t chan = 0) const + mode get_mode(const size_t chan = 0) const override { return static_cast<mode>(_mode.at(chan).get()); } diff --git a/host/lib/rfnoc/link_stream_manager.cpp b/host/lib/rfnoc/link_stream_manager.cpp index 59b80b59e..d73eff319 100644 --- a/host/lib/rfnoc/link_stream_manager.cpp +++ b/host/lib/rfnoc/link_stream_manager.cpp @@ -72,35 +72,35 @@ public: *_ctrl_xport, _pkt_factory, sep_addr_t(_my_device_id, SEP_INST_MGMT_CTRL)); } - virtual ~link_stream_manager_impl() + ~link_stream_manager_impl() override { for (const auto& epid : _allocated_epids) { _epid_alloc->deallocate_epid(epid); } } - virtual device_id_t get_self_device_id() const + device_id_t get_self_device_id() const override { return _my_device_id; } - virtual uhd::transport::adapter_id_t get_adapter_id() const + uhd::transport::adapter_id_t get_adapter_id() const override { return _my_adapter_id; } - virtual const std::set<sep_addr_t>& get_reachable_endpoints() const + const std::set<sep_addr_t>& get_reachable_endpoints() const override { return _mgmt_portal->get_reachable_endpoints(); } - virtual bool can_connect_device_to_device( - sep_addr_t dst_addr, sep_addr_t src_addr) const + bool can_connect_device_to_device( + sep_addr_t dst_addr, sep_addr_t src_addr) const override { return _mgmt_portal->can_remote_route(dst_addr, src_addr); } - virtual sep_id_pair_t connect_host_to_device(sep_addr_t dst_addr) + sep_id_pair_t connect_host_to_device(sep_addr_t dst_addr) override { _ensure_ep_is_reachable(dst_addr); @@ -130,8 +130,8 @@ public: return sep_id_pair_t(_my_mgmt_ctrl_epid, dst_epid); } - virtual sep_id_pair_t connect_device_to_device( - sep_addr_t dst_addr, sep_addr_t src_addr) + sep_id_pair_t connect_device_to_device( + sep_addr_t dst_addr, sep_addr_t src_addr) override { _ensure_ep_is_reachable(dst_addr); _ensure_ep_is_reachable(src_addr); @@ -148,10 +148,10 @@ public: return sep_id_pair_t(src_epid, dst_epid); } - virtual ctrlport_endpoint::sptr get_block_register_iface(sep_id_t dst_epid, + ctrlport_endpoint::sptr get_block_register_iface(sep_id_t dst_epid, uint16_t block_index, const clock_iface& client_clk, - const clock_iface& timebase_clk) + const clock_iface& timebase_clk) override { // Ensure that the endpoint is initialized for control at the specified EPID if (_ctrl_ep == nullptr) { @@ -176,7 +176,7 @@ public: timebase_clk); } - virtual client_zero::sptr get_client_zero(sep_id_t dst_epid) const + client_zero::sptr get_client_zero(sep_id_t dst_epid) const override { if (_client_zero_map.count(dst_epid) == 0) { throw uhd::runtime_error( @@ -185,13 +185,12 @@ public: return _client_zero_map.at(dst_epid); } - virtual stream_buff_params_t create_device_to_device_data_stream( - const sep_id_t& dst_epid, + stream_buff_params_t create_device_to_device_data_stream(const sep_id_t& dst_epid, const sep_id_t& src_epid, const bool lossy_xport, const double fc_freq_ratio, const double fc_headroom_ratio, - const bool reset = false) + const bool reset = false) override { // We assume that the devices are already connected (because this API requires // EPIDs) @@ -218,12 +217,11 @@ public: STREAM_SETUP_TIMEOUT); } - virtual chdr_tx_data_xport::uptr create_host_to_device_data_stream( - const sep_addr_t dst_addr, + chdr_tx_data_xport::uptr create_host_to_device_data_stream(const sep_addr_t dst_addr, const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, const device_addr_t& xport_args, - const std::string& streamer_id) + const std::string& streamer_id) override { _ensure_ep_is_reachable(dst_addr); @@ -249,12 +247,11 @@ public: streamer_id); } - virtual chdr_rx_data_xport::uptr create_device_to_host_data_stream( - sep_addr_t src_addr, + chdr_rx_data_xport::uptr create_device_to_host_data_stream(sep_addr_t src_addr, const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, const device_addr_t& xport_args, - const std::string& streamer_id) + const std::string& streamer_id) override { _ensure_ep_is_reachable(src_addr); diff --git a/host/lib/rfnoc/mgmt_portal.cpp b/host/lib/rfnoc/mgmt_portal.cpp index 7b09c540b..ea78aee48 100644 --- a/host/lib/rfnoc/mgmt_portal.cpp +++ b/host/lib/rfnoc/mgmt_portal.cpp @@ -196,15 +196,15 @@ public: } } - virtual ~mgmt_portal_impl() {} + ~mgmt_portal_impl() override {} - virtual const std::set<sep_addr_t>& get_reachable_endpoints() const + const std::set<sep_addr_t>& get_reachable_endpoints() const override { return _discovered_ep_set; } - virtual void initialize_endpoint( - chdr_ctrl_xport& xport, const sep_addr_t& addr, const sep_id_t& epid) + void initialize_endpoint( + chdr_ctrl_xport& xport, const sep_addr_t& addr, const sep_id_t& epid) override { std::lock_guard<std::recursive_mutex> lock(_mutex); @@ -237,7 +237,7 @@ public: register_endpoint(addr, epid); } - virtual void register_endpoint(const sep_addr_t& addr, const sep_id_t& epid) + void register_endpoint(const sep_addr_t& addr, const sep_id_t& epid) override { std::lock_guard<std::recursive_mutex> lock(_mutex); if (is_endpoint_registered(epid)) { @@ -260,13 +260,13 @@ public: % epid % to_string(_node_addr_map.at(lookup_node)))); } - virtual bool is_endpoint_registered(const sep_id_t& epid) const + bool is_endpoint_registered(const sep_id_t& epid) const override { std::lock_guard<std::recursive_mutex> lock(_mutex); return (_epid_addr_map.count(epid) > 0); } - virtual sep_info_t get_endpoint_info(const sep_id_t& epid) const + sep_info_t get_endpoint_info(const sep_id_t& epid) const override { std::lock_guard<std::recursive_mutex> lock(_mutex); @@ -295,7 +295,7 @@ public: return retval; } - virtual void setup_local_route(chdr_ctrl_xport& xport, const sep_id_t& dst_epid) + void setup_local_route(chdr_ctrl_xport& xport, const sep_id_t& dst_epid) override { std::lock_guard<std::recursive_mutex> lock(_mutex); auto my_epid = xport.get_epid(); @@ -383,8 +383,8 @@ public: % dst_epid % to_string(node_addr))); } - virtual bool can_remote_route( - const sep_addr_t& dst_addr, const sep_addr_t& src_addr) const + bool can_remote_route( + const sep_addr_t& dst_addr, const sep_addr_t& src_addr) const override { std::lock_guard<std::recursive_mutex> lock(_mutex); @@ -412,8 +412,9 @@ public: return false; } - virtual void setup_remote_route( - chdr_ctrl_xport& xport, const sep_id_t& dst_epid, const sep_id_t& src_epid) + void setup_remote_route(chdr_ctrl_xport& xport, + const sep_id_t& dst_epid, + const sep_id_t& src_epid) override { std::lock_guard<std::recursive_mutex> lock(_mutex); @@ -450,14 +451,14 @@ public: % src_epid % dst_epid)); } - virtual void config_local_rx_stream_start(chdr_ctrl_xport& xport, + void config_local_rx_stream_start(chdr_ctrl_xport& xport, const sep_id_t& epid, const bool lossy_xport, const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, const stream_buff_params_t& fc_freq, const stream_buff_params_t& fc_headroom, - const bool reset = false) + const bool reset = false) override { std::lock_guard<std::recursive_mutex> lock(_mutex); auto my_epid = xport.get_epid(); @@ -501,8 +502,8 @@ public: (boost::format("Initiated RX stream setup for EPID=%d") % epid)); } - virtual stream_buff_params_t config_local_rx_stream_commit( - chdr_ctrl_xport& xport, const sep_id_t& epid, const double timeout = 0.2) + stream_buff_params_t config_local_rx_stream_commit( + chdr_ctrl_xport& xport, const sep_id_t& epid, const double timeout = 0.2) override { std::lock_guard<std::recursive_mutex> lock(_mutex); @@ -517,11 +518,11 @@ public: return std::get<1>(_get_ostrm_status(xport, node_addr)); } - virtual void config_local_tx_stream(chdr_ctrl_xport& xport, + void config_local_tx_stream(chdr_ctrl_xport& xport, const sep_id_t& epid, const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, - const bool reset = false) + const bool reset = false) override { std::lock_guard<std::recursive_mutex> lock(_mutex); auto my_epid = xport.get_epid(); @@ -561,14 +562,14 @@ public: (boost::format("Finished TX stream setup for EPID=%d") % epid)); } - virtual stream_buff_params_t config_remote_stream(chdr_ctrl_xport& xport, + stream_buff_params_t config_remote_stream(chdr_ctrl_xport& xport, const sep_id_t& dst_epid, const sep_id_t& src_epid, const bool lossy_xport, const stream_buff_params_t& fc_freq, const stream_buff_params_t& fc_headroom, const bool reset = false, - const double timeout = 0.2) + const double timeout = 0.2) override { std::lock_guard<std::recursive_mutex> lock(_mutex); auto my_epid = xport.get_epid(); @@ -647,9 +648,9 @@ public: } - virtual void register_xport_hop_cfg_fns(uint8_t xport_subtype, + void register_xport_hop_cfg_fns(uint8_t xport_subtype, xport_cfg_fn_t init_hop_cfg_fn, - xport_cfg_fn_t rtcfg_hop_cfg_fn) + xport_cfg_fn_t rtcfg_hop_cfg_fn) override { _init_cfg_fns[xport_subtype] = init_hop_cfg_fn; _rtcfg_cfg_fns[xport_subtype] = rtcfg_hop_cfg_fn; diff --git a/host/lib/rfnoc/moving_average_block_control.cpp b/host/lib/rfnoc/moving_average_block_control.cpp index f812d535d..9ed3ef470 100644 --- a/host/lib/rfnoc/moving_average_block_control.cpp +++ b/host/lib/rfnoc/moving_average_block_control.cpp @@ -30,22 +30,22 @@ public: this->regs().poke32(REG_DIVISOR_ADDR, uint32_t(_divisor)); } - void set_sum_len(const uint8_t sum_len) + void set_sum_len(const uint8_t sum_len) override { set_property(PROP_KEY_SUM_LEN, static_cast<int>(sum_len), res_source_info::USER); } - uint8_t get_sum_len() const + uint8_t get_sum_len() const override { return _sum_len; } - void set_divisor(const uint32_t divisor) + void set_divisor(const uint32_t divisor) override { set_property(PROP_KEY_DIVISOR, static_cast<int>(divisor), res_source_info::USER); } - uint32_t get_divisor() const + uint32_t get_divisor() const override { return _divisor; } diff --git a/host/lib/rfnoc/null_block_control.cpp b/host/lib/rfnoc/null_block_control.cpp index ba8ec8da4..bb5fe2ea9 100644 --- a/host/lib/rfnoc/null_block_control.cpp +++ b/host/lib/rfnoc/null_block_control.cpp @@ -51,7 +51,7 @@ public: register_issue_stream_cmd(); } - void issue_stream_cmd(const stream_cmd_t& stream_cmd) + void issue_stream_cmd(const stream_cmd_t& stream_cmd) override { if (stream_cmd.stream_mode == stream_cmd_t::STREAM_MODE_START_CONTINUOUS) { RFNOC_LOG_TRACE("Received start stream request!"); @@ -66,7 +66,7 @@ public: } } - void reset_counters() + void reset_counters() override { const uint32_t streaming_flag = _streaming ? 0x2 : 0x0; regs().poke32(REG_CTRL_STATUS, streaming_flag | 0x1); @@ -88,7 +88,7 @@ public: regs().poke32(REG_SRC_LINES_PER_PKT, lpp - 2); } - void set_bytes_per_packet(const uint32_t bpp) + void set_bytes_per_packet(const uint32_t bpp) override { if (bpp > 0xFFFF) { throw uhd::value_error("Null source lines per packet cannot exceed 16 bits!"); @@ -101,7 +101,7 @@ public: set_lines_per_packet(lpp); } - void set_throttle_cycles(const uint32_t cycs) + void set_throttle_cycles(const uint32_t cycs) override { if (cycs > 0x3FF) { throw uhd::value_error("Null source throttle cycles cannot exceed 10 bits!"); @@ -119,22 +119,23 @@ public: return _nipc; } - uint32_t get_lines_per_packet() + uint32_t get_lines_per_packet() override { return regs().peek32(REG_SRC_LINES_PER_PKT) + 2; } - uint32_t get_bytes_per_packet() + uint32_t get_bytes_per_packet() override { return regs().peek32(REG_SRC_BYTES_PER_PKT); } - uint32_t get_throttle_cycles() + uint32_t get_throttle_cycles() override { return regs().peek32(REG_SRC_THROTTLE_CYC); } - uint64_t get_count(const port_type_t port_type, const count_type_t count_type) + uint64_t get_count( + const port_type_t port_type, const count_type_t count_type) override { const uint32_t count_addr_lo = [&]() { switch (port_type) { @@ -174,7 +175,7 @@ private: }); } - void deinit() + void deinit() override { issue_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); } diff --git a/host/lib/rfnoc/register_iface_holder.cpp b/host/lib/rfnoc/register_iface_holder.cpp index d3a0e82e5..ba50cc784 100644 --- a/host/lib/rfnoc/register_iface_holder.cpp +++ b/host/lib/rfnoc/register_iface_holder.cpp @@ -19,68 +19,72 @@ using namespace uhd::rfnoc; class invalid_register_iface : public register_iface { public: - ~invalid_register_iface() = default; + ~invalid_register_iface() override = default; - void poke32(uint32_t, uint32_t, uhd::time_spec_t, bool) + void poke32(uint32_t, uint32_t, uhd::time_spec_t, bool) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - void multi_poke32( - const std::vector<uint32_t>, const std::vector<uint32_t>, uhd::time_spec_t, bool) + void multi_poke32(const std::vector<uint32_t>, + const std::vector<uint32_t>, + uhd::time_spec_t, + bool) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - void block_poke32(uint32_t, const std::vector<uint32_t>, uhd::time_spec_t, bool) + void block_poke32( + uint32_t, const std::vector<uint32_t>, uhd::time_spec_t, bool) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - uint32_t peek32(uint32_t, uhd::time_spec_t) + uint32_t peek32(uint32_t, uhd::time_spec_t) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); return {}; } - std::vector<uint32_t> block_peek32(uint32_t, size_t, uhd::time_spec_t) + std::vector<uint32_t> block_peek32(uint32_t, size_t, uhd::time_spec_t) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); return {}; } - void poll32(uint32_t, uint32_t, uint32_t, uhd::time_spec_t, uhd::time_spec_t, bool) + void poll32( + uint32_t, uint32_t, uint32_t, uhd::time_spec_t, uhd::time_spec_t, bool) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - void sleep(uhd::time_spec_t, bool) + void sleep(uhd::time_spec_t, bool) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - void register_async_msg_handler(async_msg_callback_t) + void register_async_msg_handler(async_msg_callback_t) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - void register_async_msg_validator(async_msg_validator_t) + void register_async_msg_validator(async_msg_validator_t) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - void set_policy(const std::string&, const uhd::device_addr_t&) + void set_policy(const std::string&, const uhd::device_addr_t&) override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); } - uint16_t get_src_epid() const + uint16_t get_src_epid() const override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); return 0; } - uint16_t get_port_num() const + uint16_t get_port_num() const override { UHD_LOG_ERROR("REGS", "Attempting to use invalidated register interface!"); return 0; diff --git a/host/lib/rfnoc/replay_block_control.cpp b/host/lib/rfnoc/replay_block_control.cpp index 289e24e97..201390cd1 100644 --- a/host/lib/rfnoc/replay_block_control.cpp +++ b/host/lib/rfnoc/replay_block_control.cpp @@ -123,7 +123,7 @@ public: /************************************************************************** * Replay Control API **************************************************************************/ - void record(const uint64_t offset, const uint64_t size, const size_t port) + void record(const uint64_t offset, const uint64_t size, const size_t port) override { set_property<uint64_t>( PROP_KEY_RECORD_OFFSET, offset, {res_source_info::USER, port}); @@ -133,7 +133,7 @@ public: record_restart(port); } - void record_restart(const size_t port) + void record_restart(const size_t port) override { // Ensure that the buffer is properly configured before recording _validate_record_buffer(port); @@ -145,7 +145,7 @@ public: const uint64_t size, const size_t port, const uhd::time_spec_t time_spec, - const bool repeat) + const bool repeat) override { config_play(offset, size, port); uhd::stream_cmd_t play_cmd = @@ -157,19 +157,19 @@ public: issue_stream_cmd(play_cmd, port); } - void stop(const size_t port) + void stop(const size_t port) override { uhd::stream_cmd_t stop_cmd = uhd::stream_cmd_t(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); issue_stream_cmd(stop_cmd, port); } - uint64_t get_mem_size() const + uint64_t get_mem_size() const override { return _mem_size; } - uint64_t get_word_size() const + uint64_t get_word_size() const override { return _word_size; } @@ -177,27 +177,27 @@ public: /************************************************************************** * Record Buffer State API **************************************************************************/ - uint64_t get_record_offset(const size_t port) const + uint64_t get_record_offset(const size_t port) const override { return _record_offset.at(port).get(); } - uint64_t get_record_size(const size_t port) const + uint64_t get_record_size(const size_t port) const override { return _record_size.at(port).get(); } - uint64_t get_record_fullness(const size_t port) + uint64_t get_record_fullness(const size_t port) override { return _replay_reg_iface.peek64(REG_REC_FULLNESS_LO_ADDR, port); } - io_type_t get_record_type(const size_t port) const + io_type_t get_record_type(const size_t port) const override { return _record_type.at(port).get(); } - virtual size_t get_record_item_size(const size_t port) const + size_t get_record_item_size(const size_t port) const override { return uhd::convert::get_bytes_per_item(get_record_type(port)); } @@ -205,33 +205,33 @@ public: /************************************************************************** * Playback State API **************************************************************************/ - uint64_t get_play_offset(const size_t port) const + uint64_t get_play_offset(const size_t port) const override { return _play_offset.at(port).get(); } - uint64_t get_play_size(const size_t port) const + uint64_t get_play_size(const size_t port) const override { return _play_size.at(port).get(); } - uint32_t get_max_items_per_packet(const size_t port) const + uint32_t get_max_items_per_packet(const size_t port) const override { return (_packet_size.at(port).get() - CHDR_MAX_LEN_HDR) / get_play_item_size(port); } - uint32_t get_max_packet_size(const size_t port) const + uint32_t get_max_packet_size(const size_t port) const override { return _packet_size.at(port).get(); } - io_type_t get_play_type(const size_t port) const + io_type_t get_play_type(const size_t port) const override { return _play_type.at(port).get(); } - size_t get_play_item_size(const size_t port) const + size_t get_play_item_size(const size_t port) const override { return uhd::convert::get_bytes_per_item(get_play_type(port)); } @@ -239,7 +239,7 @@ public: /************************************************************************** * Advanced Record Control API calls *************************************************************************/ - void set_record_type(const io_type_t type, const size_t port) + void set_record_type(const io_type_t type, const size_t port) override { set_property<std::string>( PROP_KEY_TYPE, type, {res_source_info::INPUT_EDGE, port}); @@ -248,7 +248,8 @@ public: /************************************************************************** * Advanced Playback Control API **************************************************************************/ - void config_play(const uint64_t offset, const uint64_t size, const size_t port) + void config_play( + const uint64_t offset, const uint64_t size, const size_t port) override { set_property<uint64_t>( PROP_KEY_PLAY_OFFSET, offset, {res_source_info::USER, port}); @@ -256,23 +257,23 @@ public: _validate_play_buffer(port); } - void set_play_type(const io_type_t type, const size_t port) + void set_play_type(const io_type_t type, const size_t port) override { set_property<std::string>( PROP_KEY_TYPE, type, {res_source_info::OUTPUT_EDGE, port}); } - void set_max_items_per_packet(const uint32_t ipp, const size_t port) + void set_max_items_per_packet(const uint32_t ipp, const size_t port) override { set_max_packet_size(CHDR_MAX_LEN_HDR + ipp * get_play_item_size(port), port); } - void set_max_packet_size(const uint32_t size, const size_t port) + void set_max_packet_size(const uint32_t size, const size_t port) override { set_property<uint32_t>(PROP_KEY_PKT_SIZE, size, {res_source_info::USER, port}); } - void issue_stream_cmd(const uhd::stream_cmd_t& stream_cmd, const size_t port) + void issue_stream_cmd(const uhd::stream_cmd_t& stream_cmd, const size_t port) override { // Ensure that the buffer is properly configured before issuing a stream command _validate_play_buffer(port); diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp index 56629d057..f6b07a36f 100644 --- a/host/lib/rfnoc/rfnoc_graph.cpp +++ b/host/lib/rfnoc/rfnoc_graph.cpp @@ -104,7 +104,7 @@ public: throw uhd::runtime_error("Failure to create rfnoc_graph."); } - ~rfnoc_graph_impl() + ~rfnoc_graph_impl() override { UHD_LOG_TRACE(LOG_ID, "Shutting down detail::graph..."); _graph->shutdown(); @@ -116,17 +116,17 @@ public: /************************************************************************** * Block Discovery/Retrieval *************************************************************************/ - std::vector<block_id_t> find_blocks(const std::string& block_id_hint) const + std::vector<block_id_t> find_blocks(const std::string& block_id_hint) const override { return _block_registry->find_blocks(block_id_hint); } - bool has_block(const block_id_t& block_id) const + bool has_block(const block_id_t& block_id) const override { return _block_registry->has_block(block_id); } - noc_block_base::sptr get_block(const block_id_t& block_id) const + noc_block_base::sptr get_block(const block_id_t& block_id) const override { return _block_registry->get_block(block_id); } @@ -137,7 +137,7 @@ public: bool is_connectable(const block_id_t& src_blk, size_t src_port, const block_id_t& dst_blk, - size_t dst_port) + size_t dst_port) override { try { const std::string src_blk_info = @@ -211,7 +211,7 @@ public: size_t src_port, const block_id_t& dst_blk, size_t dst_port, - bool skip_property_propagation) + bool skip_property_propagation) override { if (!has_block(src_blk)) { throw uhd::lookup_error( @@ -235,7 +235,7 @@ public: void disconnect(const block_id_t& src_blk, size_t src_port, const block_id_t& dst_blk, - size_t dst_port) + size_t dst_port) override { if (not has_block(src_blk)) { throw uhd::lookup_error( @@ -260,7 +260,7 @@ public: size_t strm_port, const block_id_t& dst_blk, size_t dst_port, - uhd::transport::adapter_id_t adapter_id) + uhd::transport::adapter_id_t adapter_id) override { // Verify the streamer was created by us auto rfnoc_streamer = std::dynamic_pointer_cast<rfnoc_tx_streamer>(streamer); @@ -321,7 +321,7 @@ public: size_t src_port, uhd::rx_streamer::sptr streamer, size_t strm_port, - uhd::transport::adapter_id_t adapter_id) + uhd::transport::adapter_id_t adapter_id) override { // Verify the streamer was created by us auto rfnoc_streamer = std::dynamic_pointer_cast<rfnoc_rx_streamer>(streamer); @@ -378,7 +378,7 @@ public: src.get(), rfnoc_streamer.get(), edge_info}; } - void disconnect(const std::string& streamer_id) + void disconnect(const std::string& streamer_id) override { UHD_LOG_TRACE(LOG_ID, std::string("Disconnecting ") + streamer_id); if (_tx_streamers.count(streamer_id)) { @@ -404,7 +404,7 @@ public: UHD_LOG_TRACE(LOG_ID, std::string("Disconnected ") + streamer_id); } - void disconnect(const std::string& streamer_id, size_t port) + void disconnect(const std::string& streamer_id, size_t port) override { std::string id_str = streamer_id + ":" + std::to_string(port); UHD_LOG_TRACE(LOG_ID, std::string("Disconnecting ") + id_str); @@ -432,7 +432,7 @@ public: } uhd::rx_streamer::sptr create_rx_streamer( - const size_t num_ports, const uhd::stream_args_t& args) + const size_t num_ports, const uhd::stream_args_t& args) override { auto this_graph = shared_from_this(); return std::make_shared<rfnoc_rx_streamer>( @@ -440,19 +440,19 @@ public: } uhd::tx_streamer::sptr create_tx_streamer( - const size_t num_ports, const uhd::stream_args_t& args) + const size_t num_ports, const uhd::stream_args_t& args) override { auto this_graph = shared_from_this(); return std::make_shared<rfnoc_tx_streamer>( num_ports, args, [this_graph](const std::string& id) { this_graph->disconnect(id); }); } - size_t get_num_mboards() const + size_t get_num_mboards() const override { return _num_mboards; } - std::shared_ptr<mb_controller> get_mb_controller(const size_t mb_index = 0) + std::shared_ptr<mb_controller> get_mb_controller(const size_t mb_index = 0) override { if (_mb_controllers.size() <= mb_index) { throw uhd::index_error( @@ -462,7 +462,7 @@ public: return _mb_controllers.at(mb_index); } - bool synchronize_devices(const uhd::time_spec_t& time_spec, const bool quiet) + bool synchronize_devices(const uhd::time_spec_t& time_spec, const bool quiet) override { auto mb_controllers_copy = _mb_controllers; bool result = @@ -476,13 +476,13 @@ public: return result; } - uhd::property_tree::sptr get_tree(void) const + uhd::property_tree::sptr get_tree(void) const override { return _tree; } std::vector<uhd::transport::adapter_id_t> enumerate_adapters_to_dst( - const block_id_t& dst_blk, size_t dst_port) + const block_id_t& dst_blk, size_t dst_port) override { // Verify dst_blk even exists in this graph if (!has_block(dst_blk)) { @@ -515,7 +515,7 @@ public: } std::vector<uhd::transport::adapter_id_t> enumerate_adapters_from_src( - const block_id_t& src_blk, size_t src_port) + const block_id_t& src_blk, size_t src_port) override { // Verify src_blk even exists in this graph if (!has_block(src_blk)) { @@ -547,23 +547,23 @@ public: return _gsm->get_adapters(sep_addr); } - std::vector<graph_edge_t> enumerate_active_connections() + std::vector<graph_edge_t> enumerate_active_connections() override { return _graph->enumerate_edges(); } - std::vector<graph_edge_t> enumerate_static_connections() const + std::vector<graph_edge_t> enumerate_static_connections() const override { return _static_edges; } - void commit() + void commit() override { _graph->commit(); } - void release() + void release() override { _graph->release(); } diff --git a/host/lib/rfnoc/siggen_block_control.cpp b/host/lib/rfnoc/siggen_block_control.cpp index fa527f3f6..7fbe79337 100644 --- a/host/lib/rfnoc/siggen_block_control.cpp +++ b/host/lib/rfnoc/siggen_block_control.cpp @@ -56,64 +56,64 @@ public: _register_props(); } - void set_enable(const bool enable, const size_t port) + void set_enable(const bool enable, const size_t port) override { set_property<bool>(PROP_KEY_ENABLE, enable, port); } - bool get_enable(const size_t port) const + bool get_enable(const size_t port) const override { return _prop_enable.at(port).get(); } - void set_waveform(const siggen_waveform waveform, const size_t port) + void set_waveform(const siggen_waveform waveform, const size_t port) override { set_property<int>(PROP_KEY_WAVEFORM, static_cast<int>(waveform), port); } - siggen_waveform get_waveform(const size_t port) const + siggen_waveform get_waveform(const size_t port) const override { return static_cast<siggen_waveform>(_prop_waveform.at(port).get()); } - void set_amplitude(const double amplitude, const size_t port) + void set_amplitude(const double amplitude, const size_t port) override { set_property<double>(PROP_KEY_AMPLITUDE, amplitude, port); } - double get_amplitude(const size_t port) const + double get_amplitude(const size_t port) const override { return _prop_amplitude.at(port).get(); } - void set_constant(const std::complex<double> constant, const size_t port) + void set_constant(const std::complex<double> constant, const size_t port) override { set_property<double>(PROP_KEY_CONSTANT_I, constant.real(), port); set_property<double>(PROP_KEY_CONSTANT_Q, constant.imag(), port); } - std::complex<double> get_constant(const size_t port) const + std::complex<double> get_constant(const size_t port) const override { return std::complex<double>( _prop_constant_i.at(port).get(), _prop_constant_q.at(port).get()); } - void set_sine_phase_increment(const double phase_inc, const size_t port) + void set_sine_phase_increment(const double phase_inc, const size_t port) override { set_property<double>(PROP_KEY_SINE_PHASE_INC, phase_inc, port); } - double get_sine_phase_increment(const size_t port) const + double get_sine_phase_increment(const size_t port) const override { return _prop_phase_inc.at(port).get(); } - void set_samples_per_packet(const size_t spp, const size_t port) + void set_samples_per_packet(const size_t spp, const size_t port) override { set_property<int>(PROP_KEY_SPP, uhd::narrow_cast<int>(spp), port); } - size_t get_samples_per_packet(const size_t port) const + size_t get_samples_per_packet(const size_t port) const override { return _prop_spp.at(port).get(); } diff --git a/host/lib/rfnoc/switchboard_block_control.cpp b/host/lib/rfnoc/switchboard_block_control.cpp index 229c224e9..eec7f666f 100644 --- a/host/lib/rfnoc/switchboard_block_control.cpp +++ b/host/lib/rfnoc/switchboard_block_control.cpp @@ -40,7 +40,7 @@ public: _update_forwarding_map(); } - void connect(const size_t input, const size_t output) + void connect(const size_t input, const size_t output) override { set_property<int>(PROP_KEY_INPUT_SELECT, static_cast<int>(input), output); set_property<int>(PROP_KEY_OUTPUT_SELECT, static_cast<int>(output), input); diff --git a/host/lib/rfnoc/vector_iir_block_control.cpp b/host/lib/rfnoc/vector_iir_block_control.cpp index 404e85aa8..eaeb75ef0 100644 --- a/host/lib/rfnoc/vector_iir_block_control.cpp +++ b/host/lib/rfnoc/vector_iir_block_control.cpp @@ -39,37 +39,37 @@ public: _register_props(); } - void set_alpha(const double alpha, const size_t chan) + void set_alpha(const double alpha, const size_t chan) override { set_property<double>(PROP_KEY_ALPHA, alpha, chan); } - double get_alpha(const size_t chan) const + double get_alpha(const size_t chan) const override { return _prop_alpha.at(chan).get(); } - void set_beta(const double beta, const size_t chan) + void set_beta(const double beta, const size_t chan) override { set_property<double>(PROP_KEY_BETA, beta, chan); } - double get_beta(const size_t chan) const + double get_beta(const size_t chan) const override { return _prop_beta.at(chan).get(); } - void set_delay(const uint16_t delay, const size_t chan) + void set_delay(const uint16_t delay, const size_t chan) override { set_property<int>(PROP_KEY_DELAY, delay, chan); } - uint16_t get_delay(const size_t chan) const + uint16_t get_delay(const size_t chan) const override { return _prop_delay.at(chan).get(); } - uint16_t get_max_delay(const size_t chan) const + uint16_t get_max_delay(const size_t chan) const override { return _prop_max_delay.at(chan).get(); } diff --git a/host/lib/rfnoc/window_block_control.cpp b/host/lib/rfnoc/window_block_control.cpp index 1bd6a1295..5d3201838 100644 --- a/host/lib/rfnoc/window_block_control.cpp +++ b/host/lib/rfnoc/window_block_control.cpp @@ -32,12 +32,12 @@ public: _register_props(); } - size_t get_max_num_coefficients(const size_t chan) const + size_t get_max_num_coefficients(const size_t chan) const override { return _max_len.at(chan); } - void set_coefficients(const std::vector<int16_t>& coeffs, const size_t chan) + void set_coefficients(const std::vector<int16_t>& coeffs, const size_t chan) override { if (coeffs.size() > _max_len.at(chan)) { std::string error_msg = "Too many window coefficients specified (max " @@ -49,7 +49,7 @@ public: _program_coefficients(chan); } - std::vector<int16_t> get_coefficients(const size_t chan) const + std::vector<int16_t> get_coefficients(const size_t chan) const override { return _coeffs.at(chan); } diff --git a/host/lib/transport/buffer_pool.cpp b/host/lib/transport/buffer_pool.cpp index 0dd4a8d7f..ab674a4e8 100644 --- a/host/lib/transport/buffer_pool.cpp +++ b/host/lib/transport/buffer_pool.cpp @@ -35,12 +35,12 @@ public: /* NOP */ } - ptr_type at(const size_t index) const + ptr_type at(const size_t index) const override { return _ptrs.at(index); } - size_t size(void) const + size_t size(void) const override { return _ptrs.size(); } diff --git a/host/lib/transport/inline_io_service.cpp b/host/lib/transport/inline_io_service.cpp index 8206c145f..11835b285 100644 --- a/host/lib/transport/inline_io_service.cpp +++ b/host/lib/transport/inline_io_service.cpp @@ -215,7 +215,7 @@ public: } } - frame_buff::uptr get_recv_buff(int32_t timeout_ms) + frame_buff::uptr get_recv_buff(int32_t timeout_ms) override { auto buff = _io_srv->recv(this, _data_link.get(), timeout_ms); if (buff) { @@ -225,7 +225,7 @@ public: return buff; } - void release_recv_buff(frame_buff::uptr buff) + void release_recv_buff(frame_buff::uptr buff) override { _fc_cb(frame_buff::uptr(std::move(buff)), _data_link.get(), _fc_link.get()); _num_frames_in_use--; @@ -271,7 +271,7 @@ public: } } - bool wait_for_dest_ready(size_t num_bytes, int32_t timeout_ms) + bool wait_for_dest_ready(size_t num_bytes, int32_t timeout_ms) override { if (!_recv_link) { // If there is no flow control link, then the destination must @@ -290,7 +290,7 @@ public: return true; } - frame_buff::uptr get_send_buff(int32_t timeout_ms) + frame_buff::uptr get_send_buff(int32_t timeout_ms) override { frame_buff::uptr buff = _send_link->get_send_buff(timeout_ms); if (buff) { @@ -301,7 +301,7 @@ public: return frame_buff::uptr(); } - void release_send_buff(frame_buff::uptr buff) + void release_send_buff(frame_buff::uptr buff) override { // Send the packet using callback _send_cb(std::move(buff), _send_link.get()); diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp index 9230a7e1f..df6ed45eb 100644 --- a/host/lib/transport/libusb1_base.cpp +++ b/host/lib/transport/libusb1_base.cpp @@ -46,9 +46,9 @@ public: std::bind(&libusb_session_impl::libusb_event_handler_task, this, _context)); } - virtual ~libusb_session_impl(void); + ~libusb_session_impl(void) override; - libusb_context* get_context(void) const + libusb_context* get_context(void) const override { return _context; } @@ -141,9 +141,9 @@ public: _dev = dev; } - virtual ~libusb_device_impl(void); + ~libusb_device_impl(void) override; - libusb_device* get(void) const + libusb_device* get(void) const override { return _dev; } @@ -187,14 +187,14 @@ public: libusb_free_device_list(dev_list, false /*dont unref*/); } - virtual ~libusb_device_list_impl(void); + ~libusb_device_list_impl(void) override; - size_t size(void) const + size_t size(void) const override { return _devs.size(); } - libusb::device::sptr at(size_t i) const + libusb::device::sptr at(size_t i) const override { return _devs.at(i); } @@ -230,14 +230,14 @@ public: UHD_ASSERT_THROW(libusb_get_device_descriptor(_dev->get(), &_desc) == 0); } - virtual ~libusb_device_descriptor_impl(void); + ~libusb_device_descriptor_impl(void) override; - const libusb_device_descriptor& get(void) const + const libusb_device_descriptor& get(void) const override { return _desc; } - std::string get_ascii_property(const std::string& what) const + std::string get_ascii_property(const std::string& what) const override { uint8_t off = 0; if (what == "serial") @@ -301,20 +301,21 @@ public: UHD_ASSERT_THROW(libusb_open(_dev->get(), &_handle) == 0); } - virtual ~libusb_device_handle_impl(void); + ~libusb_device_handle_impl(void) override; - libusb_device_handle* get(void) const + libusb_device_handle* get(void) const override { return _handle; } - void claim_interface(int interface) + void claim_interface(int interface) override { UHD_ASSERT_THROW(libusb_claim_interface(this->get(), interface) == 0); _claimed.push_back(interface); } - void clear_endpoints(unsigned char recv_endpoint, unsigned char send_endpoint) + void clear_endpoints( + unsigned char recv_endpoint, unsigned char send_endpoint) override { int ret; ret = libusb_clear_halt(this->get(), recv_endpoint | 0x80); @@ -325,7 +326,7 @@ public: << "usb device handle: send endpoint clear: " << libusb_error_name(ret); } - void reset_device(void) + void reset_device(void) override { int ret = libusb_reset_device(this->get()); UHD_LOGGER_TRACE("USB") @@ -392,42 +393,42 @@ public: _dev = dev; } - virtual ~libusb_special_handle_impl(void); + ~libusb_special_handle_impl(void) override; - libusb::device::sptr get_device(void) const + libusb::device::sptr get_device(void) const override { return _dev; } - std::string get_serial(void) const + std::string get_serial(void) const override { return libusb::device_descriptor::make(this->get_device()) ->get_ascii_property("serial"); } - std::string get_manufacturer() const + std::string get_manufacturer() const override { return libusb::device_descriptor::make(this->get_device()) ->get_ascii_property("manufacturer"); } - std::string get_product() const + std::string get_product() const override { return libusb::device_descriptor::make(this->get_device()) ->get_ascii_property("product"); } - uint16_t get_vendor_id(void) const + uint16_t get_vendor_id(void) const override { return libusb::device_descriptor::make(this->get_device())->get().idVendor; } - uint16_t get_product_id(void) const + uint16_t get_product_id(void) const override { return libusb::device_descriptor::make(this->get_device())->get().idProduct; } - bool firmware_loaded() + bool firmware_loaded() override { return (get_manufacturer() == "Ettus Research LLC") or (get_manufacturer() == "National Instruments Corp.") diff --git a/host/lib/transport/libusb1_base.hpp b/host/lib/transport/libusb1_base.hpp index 7c70ab5d0..4334e6369 100644 --- a/host/lib/transport/libusb1_base.hpp +++ b/host/lib/transport/libusb1_base.hpp @@ -165,7 +165,7 @@ class special_handle : public usb_device_handle public: typedef std::shared_ptr<special_handle> sptr; - virtual ~special_handle(void); + ~special_handle(void) override; //! make a new special handle from device static sptr make(device::sptr); diff --git a/host/lib/transport/libusb1_control.cpp b/host/lib/transport/libusb1_control.cpp index b7aefe1c6..e6339e17f 100644 --- a/host/lib/transport/libusb1_control.cpp +++ b/host/lib/transport/libusb1_control.cpp @@ -28,7 +28,7 @@ public: _handle->claim_interface(interface); } - virtual ~libusb_control_impl(void); + ~libusb_control_impl(void) override; int submit(uint8_t request_type, uint8_t request, @@ -36,7 +36,7 @@ public: uint16_t index, unsigned char* buff, uint16_t length, - uint32_t libusb_timeout = 0) + uint32_t libusb_timeout = 0) override { boost::mutex::scoped_lock lock(_mutex); return libusb_control_transfer(_handle->get(), diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index f918912d0..8cf76989b 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -126,9 +126,9 @@ public: { /* NOP */ } - virtual ~libusb_zero_copy_mb(void); + ~libusb_zero_copy_mb(void) override; - void release(void) + void release(void) override { _release_cb(this); } @@ -409,34 +409,34 @@ struct libusb_zero_copy_impl : usb_zero_copy size_t(hints.cast<double>("send_frame_size", DEFAULT_XFER_SIZE)))); } - virtual ~libusb_zero_copy_impl(void); + ~libusb_zero_copy_impl(void) override; - managed_recv_buffer::sptr get_recv_buff(double timeout) + managed_recv_buffer::sptr get_recv_buff(double timeout) override { boost::mutex::scoped_lock l(_recv_mutex); return _recv_impl->get_buff<managed_recv_buffer>(timeout); } - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { boost::mutex::scoped_lock l(_send_mutex); return _send_impl->get_buff<managed_send_buffer>(timeout); } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return _recv_impl->get_num_frames(); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _send_impl->get_num_frames(); } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _recv_impl->get_frame_size(); } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _send_impl->get_frame_size(); } diff --git a/host/lib/transport/muxed_zero_copy_if.cpp b/host/lib/transport/muxed_zero_copy_if.cpp index 2602d8596..f7cc88c9c 100644 --- a/host/lib/transport/muxed_zero_copy_if.cpp +++ b/host/lib/transport/muxed_zero_copy_if.cpp @@ -39,7 +39,7 @@ public: boost::thread(std::bind(&muxed_zero_copy_if_impl::_update_queues, this)); } - virtual ~muxed_zero_copy_if_impl() + ~muxed_zero_copy_if_impl() override { UHD_SAFE_CALL( // Interrupt buffer updater loop @@ -58,7 +58,7 @@ public: _streams.clear();); } - virtual zero_copy_if::sptr make_stream(const uint32_t stream_num) + zero_copy_if::sptr make_stream(const uint32_t stream_num) override { boost::lock_guard<boost::mutex> lock(_mutex); if (_streams.size() >= _max_num_streams) { @@ -75,12 +75,12 @@ public: return stream; } - virtual size_t get_num_dropped_frames() const + size_t get_num_dropped_frames() const override { return _num_dropped_frames; } - void remove_stream(const uint32_t stream_num) + void remove_stream(const uint32_t stream_num) override { boost::lock_guard<boost::mutex> lock(_mutex); _streams.erase(stream_num); @@ -96,12 +96,12 @@ private: public: stream_mrb(size_t size) : _buff(new char[size]) {} - ~stream_mrb() + ~stream_mrb() override { delete[] _buff; } - void release() {} + void release() override {} UHD_INLINE sptr get_new(char* buff, size_t len) { @@ -138,7 +138,7 @@ private: } } - ~stream_impl(void) + ~stream_impl(void) override { // First remove the stream from muxed transport // so no more frames are pushed in @@ -150,17 +150,17 @@ private: } } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return _num_recv_frames; } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _recv_frame_size; } - managed_recv_buffer::sptr get_recv_buff(double timeout) + managed_recv_buffer::sptr get_recv_buff(double timeout) override { managed_recv_buffer::sptr buff; if (_buff_queue.pop_with_timed_wait(buff, timeout)) { @@ -177,17 +177,17 @@ private: _buffer_index %= _buffers.size(); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _num_send_frames; } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _send_frame_size; } - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { return _muxed_xport->base_xport()->get_send_buff(timeout); } diff --git a/host/lib/transport/nirio_zero_copy.cpp b/host/lib/transport/nirio_zero_copy.cpp index 8600b10d1..cd49b67bf 100644 --- a/host/lib/transport/nirio_zero_copy.cpp +++ b/host/lib/transport/nirio_zero_copy.cpp @@ -53,7 +53,7 @@ public: { } - void release(void) + void release(void) override { _fifo.release(_frame_size / sizeof(fifo_data_t)); } @@ -97,7 +97,7 @@ public: { } - void release(void) + void release(void) override { _fifo.release(_frame_size / sizeof(fifo_data_t)); } @@ -241,7 +241,7 @@ public: nirio_status_to_exception(status, "Could not create nirio_zero_copy transport."); } - virtual ~nirio_zero_copy_impl() + ~nirio_zero_copy_impl() override { _proxy()->get_rio_quirks().remove_tx_fifo(_fifo_instance); @@ -263,18 +263,18 @@ public: * Receive implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_recv_buffer::sptr get_recv_buff(double timeout) + managed_recv_buffer::sptr get_recv_buff(double timeout) override { if (_next_recv_buff_index == _xport_params.num_recv_frames) _next_recv_buff_index = 0; return _mrb_pool[_next_recv_buff_index]->get_new(timeout, _next_recv_buff_index); } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return _xport_params.num_recv_frames; } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _xport_params.recv_frame_size; } @@ -283,18 +283,18 @@ public: * Send implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { if (_next_send_buff_index == _xport_params.num_send_frames) _next_send_buff_index = 0; return _msb_pool[_next_send_buff_index]->get_new(timeout, _next_send_buff_index); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _xport_params.num_send_frames; } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _xport_params.send_frame_size; } diff --git a/host/lib/transport/offload_io_service.cpp b/host/lib/transport/offload_io_service.cpp index b92543587..32811cbc0 100644 --- a/host/lib/transport/offload_io_service.cpp +++ b/host/lib/transport/offload_io_service.cpp @@ -259,18 +259,18 @@ public: io_service::sptr io_srv, const offload_io_service::params_t& params); ~offload_io_service_impl(); - void attach_recv_link(recv_link_if::sptr link); - void attach_send_link(send_link_if::sptr link); + void attach_recv_link(recv_link_if::sptr link) override; + void attach_send_link(send_link_if::sptr link) override; - void detach_recv_link(recv_link_if::sptr link); - void detach_send_link(send_link_if::sptr link); + void detach_recv_link(recv_link_if::sptr link) override; + void detach_send_link(send_link_if::sptr link) override; recv_io_if::sptr make_recv_client(recv_link_if::sptr recv_link, size_t num_recv_frames, recv_callback_t cb, send_link_if::sptr fc_link, size_t num_send_frames, - recv_io_if::fc_callback_t fc_cb); + recv_io_if::fc_callback_t fc_cb) override; send_io_if::sptr make_send_client(send_link_if::sptr send_link, size_t num_send_frames, @@ -278,7 +278,7 @@ public: recv_link_if::sptr recv_link, size_t num_recv_frames, recv_callback_t recv_cb, - send_io_if::fc_callback_t fc_cb); + send_io_if::fc_callback_t fc_cb) override; private: offload_io_service_impl(const offload_io_service_impl&) = delete; diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp index f428f01f1..42753ea92 100644 --- a/host/lib/transport/super_recv_packet_handler.hpp +++ b/host/lib/transport/super_recv_packet_handler.hpp @@ -807,12 +807,12 @@ public: _max_num_samps = max_num_samps; } - size_t get_num_channels(void) const + size_t get_num_channels(void) const override { return this->size(); } - size_t get_max_num_samps(void) const + size_t get_max_num_samps(void) const override { return _max_num_samps; } @@ -821,13 +821,13 @@ public: const size_t nsamps_per_buff, uhd::rx_metadata_t& metadata, const double timeout, - const bool one_packet) + const bool one_packet) override { return recv_packet_handler::recv( buffs, nsamps_per_buff, metadata, timeout, one_packet); } - void issue_stream_cmd(const stream_cmd_t& stream_cmd) + void issue_stream_cmd(const stream_cmd_t& stream_cmd) override { return recv_packet_handler::issue_stream_cmd(stream_cmd); } diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 556530f81..0fb3a07fd 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -396,12 +396,12 @@ public: this->set_max_samples_per_packet(_max_num_samps); } - size_t get_num_channels(void) const + size_t get_num_channels(void) const override { return this->size(); } - size_t get_max_num_samps(void) const + size_t get_max_num_samps(void) const override { return _max_num_samps; } @@ -409,12 +409,13 @@ public: size_t send(const tx_streamer::buffs_type& buffs, const size_t nsamps_per_buff, const uhd::tx_metadata_t& metadata, - const double timeout) + const double timeout) override { return send_packet_handler::send(buffs, nsamps_per_buff, metadata, timeout); } - bool recv_async_msg(uhd::async_metadata_t& async_metadata, double timeout = 0.1) + bool recv_async_msg( + uhd::async_metadata_t& async_metadata, double timeout = 0.1) override { return send_packet_handler::recv_async_msg(async_metadata, timeout); } diff --git a/host/lib/transport/tcp_zero_copy.cpp b/host/lib/transport/tcp_zero_copy.cpp index 0927a08ee..89e8eb4ff 100644 --- a/host/lib/transport/tcp_zero_copy.cpp +++ b/host/lib/transport/tcp_zero_copy.cpp @@ -35,7 +35,7 @@ public: { /*NOP*/ } - void release(void) + void release(void) override { _claimer.release(); } @@ -84,7 +84,7 @@ public: { /*NOP*/ } - void release(void) + void release(void) override { // Retry logic because send may fail with ENOBUFS. // This is known to occur at least on some OSX systems. @@ -184,18 +184,18 @@ public: * Receive implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_recv_buffer::sptr get_recv_buff(double timeout) + managed_recv_buffer::sptr get_recv_buff(double timeout) override { if (_next_recv_buff_index == _num_recv_frames) _next_recv_buff_index = 0; return _mrb_pool[_next_recv_buff_index]->get_new(timeout, _next_recv_buff_index); } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return _num_recv_frames; } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _recv_frame_size; } @@ -204,18 +204,18 @@ public: * Send implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { if (_next_send_buff_index == _num_send_frames) _next_send_buff_index = 0; return _msb_pool[_next_send_buff_index]->get_new(timeout, _next_send_buff_index); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _num_send_frames; } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _send_frame_size; } diff --git a/host/lib/transport/udp_simple.cpp b/host/lib/transport/udp_simple.cpp index e10dff7f8..c83e72d03 100644 --- a/host/lib/transport/udp_simple.cpp +++ b/host/lib/transport/udp_simple.cpp @@ -44,14 +44,14 @@ public: _socket->connect(_send_endpoint); } - size_t send(const asio::const_buffer& buff) + size_t send(const asio::const_buffer& buff) override { if (_connected) return _socket->send(asio::buffer(buff)); return _socket->send_to(asio::buffer(buff), _send_endpoint); } - size_t recv(const asio::mutable_buffer& buff, double timeout) + size_t recv(const asio::mutable_buffer& buff, double timeout) override { const int32_t timeout_ms = static_cast<int32_t>(timeout * 1000); @@ -60,12 +60,12 @@ public: return _socket->receive_from(asio::buffer(buff), _recv_endpoint); } - std::string get_recv_addr(void) + std::string get_recv_addr(void) override { return _recv_endpoint.address().to_string(); } - std::string get_send_addr(void) + std::string get_send_addr(void) override { return _send_endpoint.address().to_string(); } @@ -113,12 +113,12 @@ public: this->write_uart(""); // send an empty packet to init } - void write_uart(const std::string& buf) + void write_uart(const std::string& buf) override { _udp->send(asio::buffer(buf)); } - std::string read_uart(double timeout) + std::string read_uart(double timeout) override { std::string line; const boost::system_time exit_time = diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index 1a6f55259..be527be5c 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -65,7 +65,7 @@ public: { /*NOP*/ } - void release(void) + void release(void) override { _claimer.release(); } @@ -107,7 +107,7 @@ public: { /*NOP*/ } - void release(void) + void release(void) override { send_udp_packet(_sock_fd, _mem, size()); _claimer.release(); @@ -196,18 +196,18 @@ public: * Receive implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_recv_buffer::sptr get_recv_buff(double timeout) + managed_recv_buffer::sptr get_recv_buff(double timeout) override { if (_next_recv_buff_index == _num_recv_frames) _next_recv_buff_index = 0; return _mrb_pool[_next_recv_buff_index]->get_new(timeout, _next_recv_buff_index); } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return _num_recv_frames; } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _recv_frame_size; } @@ -216,28 +216,28 @@ public: * Send implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { if (_next_send_buff_index == _num_send_frames) _next_send_buff_index = 0; return _msb_pool[_next_send_buff_index]->get_new(timeout, _next_send_buff_index); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _num_send_frames; } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _send_frame_size; } - uint16_t get_local_port(void) const + uint16_t get_local_port(void) const override { return _socket->local_endpoint().port(); } - std::string get_local_addr(void) const + std::string get_local_addr(void) const override { return _socket->local_endpoint().address().to_string(); } diff --git a/host/lib/transport/zero_copy_flow_ctrl.cpp b/host/lib/transport/zero_copy_flow_ctrl.cpp index 05907c209..1c4d23a99 100644 --- a/host/lib/transport/zero_copy_flow_ctrl.cpp +++ b/host/lib/transport/zero_copy_flow_ctrl.cpp @@ -30,12 +30,12 @@ public: /* NOP */ } - ~zero_copy_flow_ctrl_msb() + ~zero_copy_flow_ctrl_msb() override { /* NOP */ } - void release() + void release() override { if (_mb) { _mb->commit(size()); @@ -64,12 +64,12 @@ public: /* NOP */ } - ~zero_copy_flow_ctrl_mrb() + ~zero_copy_flow_ctrl_mrb() override { /* NOP */ } - void release() + void release() override { if (_mb) { _mb.reset(); @@ -120,13 +120,13 @@ public: } } - ~zero_copy_flow_ctrl_impl() {} + ~zero_copy_flow_ctrl_impl() override {} /******************************************************************* * Receive implementation: * Pop the receive buffer pointer from the underlying transport ******************************************************************/ - UHD_INLINE managed_recv_buffer::sptr get_recv_buff(double timeout) + UHD_INLINE managed_recv_buffer::sptr get_recv_buff(double timeout) override { managed_recv_buffer::sptr ptr; managed_recv_buffer::sptr buff = _transport->get_recv_buff(timeout); @@ -139,12 +139,12 @@ public: return ptr; } - UHD_INLINE size_t get_num_recv_frames() const + UHD_INLINE size_t get_num_recv_frames() const override { return _transport->get_num_recv_frames(); } - UHD_INLINE size_t get_recv_frame_size() const + UHD_INLINE size_t get_recv_frame_size() const override { return _transport->get_recv_frame_size(); } @@ -153,7 +153,7 @@ public: * Send implementation: * Pass the send buffer pointer from the underlying transport ******************************************************************/ - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { managed_send_buffer::sptr ptr; managed_send_buffer::sptr buff = _transport->get_send_buff(timeout); @@ -166,12 +166,12 @@ public: return ptr; } - UHD_INLINE size_t get_num_send_frames() const + UHD_INLINE size_t get_num_send_frames() const override { return _transport->get_num_send_frames(); } - UHD_INLINE size_t get_send_frame_size() const + UHD_INLINE size_t get_send_frame_size() const override { return _transport->get_send_frame_size(); } diff --git a/host/lib/types/device_addr.cpp b/host/lib/types/device_addr.cpp index d5e9ce0d4..01dd46f5c 100644 --- a/host/lib/types/device_addr.cpp +++ b/host/lib/types/device_addr.cpp @@ -29,7 +29,7 @@ static std::string trim(const std::string& in) device_addr_t::device_addr_t(const std::string& args) { for (const std::string& pair : tokenizer(args, arg_delim)) { - if (trim(pair) == "") + if (trim(pair).empty()) continue; std::vector<std::string> toks; for (const std::string& tok : tokenizer(pair, pair_delim)) { diff --git a/host/lib/types/mac_addr.cpp b/host/lib/types/mac_addr.cpp index a2f3dec3a..4a9972f1c 100644 --- a/host/lib/types/mac_addr.cpp +++ b/host/lib/types/mac_addr.cpp @@ -60,7 +60,7 @@ std::string mac_addr_t::to_string(void) const { std::string addr = ""; for (uint8_t byte : this->to_bytes()) { - addr += str(boost::format("%s%02x") % ((addr == "") ? "" : ":") % int(byte)); + addr += str(boost::format("%s%02x") % ((addr.empty()) ? "" : ":") % int(byte)); } return addr; } diff --git a/host/lib/types/serial.cpp b/host/lib/types/serial.cpp index e146b4c6c..67272e62e 100644 --- a/host/lib/types/serial.cpp +++ b/host/lib/types/serial.cpp @@ -63,17 +63,17 @@ struct eeprom16_impl : i2c_iface } i2c_iface* _internal; - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { return _internal->read_i2c(addr, num_bytes); } - void write_i2c(uint16_t addr, const byte_vector_t& bytes) + void write_i2c(uint16_t addr, const byte_vector_t& bytes) override { return _internal->write_i2c(addr, bytes); } - byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) + byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) override { byte_vector_t cmd = { narrow_cast<uint8_t>(offset >> 8), narrow_cast<uint8_t>(offset & 0xff)}; @@ -81,7 +81,7 @@ struct eeprom16_impl : i2c_iface return this->read_i2c(addr, num_bytes); } - void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) + void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) override { for (uint16_t i = 0; i < bytes.size(); i++) { // write a byte at a time, its easy that way diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp index 0b46c4815..326b74103 100644 --- a/host/lib/usrp/b100/b100_impl.hpp +++ b/host/lib/usrp/b100/b100_impl.hpp @@ -84,12 +84,12 @@ class b100_impl : public uhd::device public: // structors b100_impl(const uhd::device_addr_t&); - ~b100_impl(void); + ~b100_impl(void) override; // the io interface - uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args); - uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args); - bool recv_async_msg(uhd::async_metadata_t&, double); + uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args) override; + uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args) override; + bool recv_async_msg(uhd::async_metadata_t&, double) override; static uhd::usrp::mboard_eeprom_t get_mb_eeprom(uhd::i2c_iface::sptr); diff --git a/host/lib/usrp/b100/dboard_iface.cpp b/host/lib/usrp/b100/dboard_iface.cpp index 627e7a876..f457b2095 100644 --- a/host/lib/usrp/b100/dboard_iface.cpp +++ b/host/lib/usrp/b100/dboard_iface.cpp @@ -40,12 +40,12 @@ public: this->set_clock_rate(UNIT_TX, _clock->get_fpga_clock_rate()); } - ~b100_dboard_iface(void) + ~b100_dboard_iface(void) override { /* NOP */ } - special_props_t get_special_props(void) + special_props_t get_special_props(void) override { special_props_t props; props.soft_clock_divider = false; @@ -53,39 +53,39 @@ public: return props; } - void write_aux_dac(unit_t, aux_dac_t, double); - double read_aux_adc(unit_t, aux_adc_t); + void write_aux_dac(unit_t, aux_dac_t, double) override; + double read_aux_adc(unit_t, aux_adc_t) override; - void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_pin_ctrl(unit_t unit); + void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_pin_ctrl(unit_t unit) override; void set_atr_reg( - unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_atr_reg(unit_t unit, atr_reg_t reg); - void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_ddr(unit_t unit); - void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_out(unit_t unit); - uint32_t read_gpio(unit_t unit); + unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_atr_reg(unit_t unit, atr_reg_t reg) override; + void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_ddr(unit_t unit) override; + void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_out(unit_t unit) override; + uint32_t read_gpio(unit_t unit) override; - void set_command_time(const uhd::time_spec_t& t); - uhd::time_spec_t get_command_time(void); + void set_command_time(const uhd::time_spec_t& t) override; + uhd::time_spec_t get_command_time(void) override; - void write_i2c(uint16_t, const byte_vector_t&); - byte_vector_t read_i2c(uint16_t, size_t); + void write_i2c(uint16_t, const byte_vector_t&) override; + byte_vector_t read_i2c(uint16_t, size_t) override; void write_spi( - unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits); + unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) override; uint32_t read_write_spi( - unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits); + unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) override; - void set_clock_rate(unit_t, double); - std::vector<double> get_clock_rates(unit_t); - double get_clock_rate(unit_t); - void set_clock_enabled(unit_t, bool); - double get_codec_rate(unit_t); + void set_clock_rate(unit_t, double) override; + std::vector<double> get_clock_rates(unit_t) override; + double get_clock_rate(unit_t) override; + void set_clock_enabled(unit_t, bool) override; + double get_codec_rate(unit_t) override; void set_fe_connection( - unit_t unit, const std::string&, const fe_connection_t& fe_conn); + unit_t unit, const std::string&, const fe_connection_t& fe_conn) override; private: timed_wb_iface::sptr _wb_iface; diff --git a/host/lib/usrp/b100/fifo_ctrl_excelsior.cpp b/host/lib/usrp/b100/fifo_ctrl_excelsior.cpp index 4a21770b8..2d899a6b8 100644 --- a/host/lib/usrp/b100/fifo_ctrl_excelsior.cpp +++ b/host/lib/usrp/b100/fifo_ctrl_excelsior.cpp @@ -58,7 +58,7 @@ public: this->init_spi(); } - ~fifo_ctrl_excelsior_impl(void) + ~fifo_ctrl_excelsior_impl(void) override { _timeout = ACK_TIMEOUT; // reset timeout to something small UHD_SAFE_CALL( @@ -66,7 +66,7 @@ public: ) } - bool pop_async_msg(async_metadata_t& async_metadata, double timeout) + bool pop_async_msg(async_metadata_t& async_metadata, double timeout) override { return _async_fifo.pop_with_timed_wait(async_metadata, timeout); } @@ -109,7 +109,7 @@ public: /******************************************************************* * Peek and poke 32 bit implementation ******************************************************************/ - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { std::lock_guard<std::mutex> lock(_mutex); @@ -118,7 +118,7 @@ public: this->wait_for_ack(_seq_out - MAX_SEQS_OUT); } - uint32_t peek32(const wb_addr_type addr) + uint32_t peek32(const wb_addr_type addr) override { std::lock_guard<std::mutex> lock(_mutex); @@ -130,12 +130,12 @@ public: /******************************************************************* * Peek and poke 16 bit not implemented ******************************************************************/ - void poke16(const wb_addr_type, const uint16_t) + void poke16(const wb_addr_type, const uint16_t) override { throw uhd::not_implemented_error("poke16 not implemented in fifo ctrl module"); } - uint16_t peek16(const wb_addr_type) + uint16_t peek16(const wb_addr_type) override { throw uhd::not_implemented_error("peek16 not implemented in fifo ctrl module"); } @@ -157,7 +157,7 @@ public: const spi_config_t& config, uint32_t data, size_t num_bits, - bool readback) + bool readback) override { std::lock_guard<std::mutex> lock(_mutex); @@ -196,7 +196,7 @@ public: /******************************************************************* * Update methods for time ******************************************************************/ - void set_time(const uhd::time_spec_t& time) + void set_time(const uhd::time_spec_t& time) override { std::lock_guard<std::mutex> lock(_mutex); _time = time; @@ -205,13 +205,13 @@ public: _timeout = MASSIVE_TIMEOUT; // permanently sets larger timeout } - uhd::time_spec_t get_time(void) + uhd::time_spec_t get_time(void) override { std::lock_guard<std::mutex> lock(_mutex); return _time; } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { std::lock_guard<std::mutex> lock(_mutex); _tick_rate = rate; diff --git a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp index 908841462..b2348c3a9 100644 --- a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp +++ b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp @@ -34,7 +34,7 @@ public: { /*NOP*/ } - void release(void) + void release(void) override { _mrb.reset(); // decrement ref count, other MRB's may hold a ref _claimer.release(); @@ -90,13 +90,13 @@ public: _task = uhd::task::make(std::bind(&usb_zero_copy_wrapper_msb::auto_flush, this)); } - ~usb_zero_copy_wrapper_msb(void) + ~usb_zero_copy_wrapper_msb(void) override { // ensure the task has exited before anything auto deconstructs _task.reset(); } - void release(void) + void release(void) override { boost::mutex::scoped_lock lock(_mutex); _ok_to_auto_flush = true; @@ -185,7 +185,7 @@ public: std::make_shared<usb_zero_copy_wrapper_msb>(usb_zc, frame_boundary); } - managed_recv_buffer::sptr get_recv_buff(double timeout) + managed_recv_buffer::sptr get_recv_buff(double timeout) override { // lazy flush mechanism - negative timeout if (timeout < 0.0) { @@ -208,28 +208,28 @@ public: _last_recv_buff, _last_recv_offset, timeout, _next_recv_buff_index); } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return (_internal_zc->get_num_recv_frames() * _internal_zc->get_recv_frame_size()) / this->get_recv_frame_size(); } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return std::min(_frame_boundary, _internal_zc->get_recv_frame_size()); } - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { return _the_only_msb->get_new(timeout); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _internal_zc->get_num_send_frames(); } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return std::min(_frame_boundary, _internal_zc->get_send_frame_size()); } diff --git a/host/lib/usrp/b200/b200_cores.hpp b/host/lib/usrp/b200/b200_cores.hpp index 7054fd068..1042cf422 100644 --- a/host/lib/usrp/b200/b200_cores.hpp +++ b/host/lib/usrp/b200/b200_cores.hpp @@ -24,11 +24,11 @@ public: b200_local_spi_core(uhd::wb_iface::sptr iface, perif_t default_perif); - virtual uint32_t transact_spi(int which_slave, + uint32_t transact_spi(int which_slave, const uhd::spi_config_t& config, uint32_t data, size_t num_bits, - bool readback); + bool readback) override; void change_perif(perif_t perif); void restore_perif(); @@ -48,7 +48,7 @@ public: typedef std::shared_ptr<b200_ref_pll_ctrl> sptr; b200_ref_pll_ctrl(b200_local_spi_core::sptr spi); - virtual void set_lock_to_ext_ref(bool external); + void set_lock_to_ext_ref(bool external) override; private: b200_local_spi_core::sptr _spi; diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 2efc9efb5..aa8b14cc6 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -161,18 +161,20 @@ public: timeout); // timeout } - void write_i2c(UHD_UNUSED(uint16_t addr), UHD_UNUSED(const byte_vector_t& bytes)) + void write_i2c( + UHD_UNUSED(uint16_t addr), UHD_UNUSED(const byte_vector_t& bytes)) override { throw uhd::not_implemented_error("b200 write i2c"); } - byte_vector_t read_i2c(UHD_UNUSED(uint16_t addr), UHD_UNUSED(size_t num_bytes)) + byte_vector_t read_i2c( + UHD_UNUSED(uint16_t addr), UHD_UNUSED(size_t num_bytes)) override { throw uhd::not_implemented_error("b200 read i2c"); } - void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) + void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) override { int ret = fx3_control_write(B200_VREQ_EEPROM_WRITE, 0, @@ -191,7 +193,7 @@ public: .str()); } - byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) + byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) override { byte_vector_t recv_bytes(num_bytes); int bytes_read = fx3_control_read(B200_VREQ_EEPROM_READ, @@ -213,7 +215,8 @@ public: return recv_bytes; } - void load_firmware(const std::string filestring, UHD_UNUSED(bool force) = false) + void load_firmware( + const std::string filestring, UHD_UNUSED(bool force) = false) override { if (load_img_msg) { UHD_LOGGER_INFO("B200") << "Loading firmware image: " << filestring << "..."; @@ -244,7 +247,7 @@ public: std::this_thread::sleep_for(std::chrono::milliseconds(1000)); } - void reset_fx3(void) + void reset_fx3(void) override { unsigned char data[4]; memset(data, 0x00, sizeof(data)); @@ -262,7 +265,7 @@ public: .str()); } - void reset_gpif(void) + void reset_gpif(void) override { unsigned char data[4]; memset(data, 0x00, sizeof(data)); @@ -281,7 +284,7 @@ public: .str()); } - void set_fpga_reset_pin(const bool reset) + void set_fpga_reset_pin(const bool reset) override { unsigned char data[4]; memset(data, (reset) ? 0xFF : 0x00, sizeof(data)); @@ -301,7 +304,7 @@ public: */ } - uint8_t get_usb_speed(void) + uint8_t get_usb_speed(void) override { unsigned char rx_data[1]; memset(rx_data, 0x00, sizeof(rx_data)); @@ -321,7 +324,7 @@ public: return boost::lexical_cast<uint8_t>(rx_data[0]); } - uint8_t get_fx3_status(void) + uint8_t get_fx3_status(void) override { unsigned char rx_data[1]; memset(rx_data, 0x00, sizeof(rx_data)); @@ -343,7 +346,7 @@ public: return boost::lexical_cast<uint8_t>(rx_data[0]); } - uint16_t get_compat_num(void) + uint16_t get_compat_num(void) override { unsigned char rx_data[2]; memset(rx_data, 0x00, sizeof(rx_data)); @@ -482,7 +485,7 @@ public: return static_cast<size_t>(filesize); } - uint32_t load_fpga(const std::string filestring, bool force) + uint32_t load_fpga(const std::string filestring, bool force) override { uint8_t fx3_state = 0; uint32_t wait_count; @@ -660,7 +663,7 @@ public: return 0; } - uint32_t load_bootloader(const std::string filestring) + uint32_t load_bootloader(const std::string filestring) override { // open bootloader file const char* filename = filestring.c_str(); diff --git a/host/lib/usrp/b200/b200_iface.hpp b/host/lib/usrp/b200/b200_iface.hpp index 7d7e169d4..5450fb7b6 100644 --- a/host/lib/usrp/b200/b200_iface.hpp +++ b/host/lib/usrp/b200/b200_iface.hpp @@ -94,11 +94,11 @@ public: //! load a bootloader image onto device EEPROM virtual uint32_t load_bootloader(const std::string filestring) = 0; - virtual void write_eeprom( - uint16_t addr, uint16_t offset, const uhd::byte_vector_t& bytes) = 0; + void write_eeprom( + uint16_t addr, uint16_t offset, const uhd::byte_vector_t& bytes) override = 0; - virtual uhd::byte_vector_t read_eeprom( - uint16_t addr, uint16_t offset, size_t num_bytes) = 0; + uhd::byte_vector_t read_eeprom( + uint16_t addr, uint16_t offset, size_t num_bytes) override = 0; static std::string fx3_state_string(uint8_t state); }; diff --git a/host/lib/usrp/b200/b200_image_loader.cpp b/host/lib/usrp/b200/b200_image_loader.cpp index 25bf7ce2f..675819018 100644 --- a/host/lib/usrp/b200/b200_image_loader.cpp +++ b/host/lib/usrp/b200/b200_image_loader.cpp @@ -34,7 +34,7 @@ static b200_iface::sptr get_b200_iface( b200_iface::sptr iface; mboard_eeprom_t eeprom; // Internal use - if (dev_handles.size() > 0) { + if (!dev_handles.empty()) { for (usb_device_handle::sptr dev_handle : dev_handles) { if (dev_handle->firmware_loaded()) { iface = b200_iface::make(usb_control::make(dev_handle, 0)); @@ -104,7 +104,7 @@ static bool b200_image_loader(const image_loader::image_loader_args_t& image_loa return false; // No initialized B2x0 found std::string fpga_path; - if (image_loader_args.fpga_path == "") { + if (image_loader_args.fpga_path.empty()) { /* * Normally, we can auto-generate the FPGA filename from what's in the EEPROM, * but if the applicable value is not in the EEPROM, the user must give a specific diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 7f250fd42..e43eff045 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -42,8 +42,8 @@ constexpr int64_t REENUMERATION_TIMEOUT_MS = 3000; class b200_ad9361_client_t : public ad9361_params { public: - ~b200_ad9361_client_t() {} - double get_band_edge(frequency_band_t band) + ~b200_ad9361_client_t() override {} + double get_band_edge(frequency_band_t band) override { switch (band) { case AD9361_RX_BAND0: @@ -56,15 +56,15 @@ public: return 0; } } - clocking_mode_t get_clocking_mode() + clocking_mode_t get_clocking_mode() override { return clocking_mode_t::AD9361_XTAL_N_CLK_PATH; } - digital_interface_mode_t get_digital_interface_mode() + digital_interface_mode_t get_digital_interface_mode() override { return AD9361_DDR_FDD_LVCMOS; } - digital_interface_delays_t get_digital_interface_timing() + digital_interface_delays_t get_digital_interface_timing() override { digital_interface_delays_t delays; delays.rx_clk_delay = 0; @@ -79,8 +79,8 @@ public: class b2xxmini_ad9361_client_t : public ad9361_params { public: - ~b2xxmini_ad9361_client_t() {} - double get_band_edge(frequency_band_t band) + ~b2xxmini_ad9361_client_t() override {} + double get_band_edge(frequency_band_t band) override { switch (band) { case AD9361_RX_BAND0: @@ -93,15 +93,15 @@ public: return 0; // On both Rx and Tx } } - clocking_mode_t get_clocking_mode() + clocking_mode_t get_clocking_mode() override { return clocking_mode_t::AD9361_XTAL_N_CLK_PATH; } - digital_interface_mode_t get_digital_interface_mode() + digital_interface_mode_t get_digital_interface_mode() override { return AD9361_DDR_FDD_LVCMOS; } - digital_interface_delays_t get_digital_interface_timing() + digital_interface_delays_t get_digital_interface_timing() override { digital_interface_delays_t delays; delays.rx_clk_delay = 0; diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index cb2edea80..44205f03a 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -115,12 +115,12 @@ class b200_impl : public uhd::device public: // structors b200_impl(const uhd::device_addr_t&, uhd::transport::usb_device_handle::sptr& handle); - ~b200_impl(void); + ~b200_impl(void) override; // the io interface - uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args); - uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args); - bool recv_async_msg(uhd::async_metadata_t&, double); + uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args) override; + uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args) override; + bool recv_async_msg(uhd::async_metadata_t&, double) override; //! Check that the combination of stream args and tick rate are valid. // diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index 57a1b18c7..ac87a0e34 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -255,7 +255,8 @@ uhd::usrp::subdev_spec_t b200_impl::coerce_subdev_spec( // // Any other spec is probably illegal and will be caught by // validate_subdev_spec(). - if (spec.size() and (_product == B200 or _product == B200MINI or _product == B205MINI) + if (!spec.empty() + and (_product == B200 or _product == B200MINI or _product == B205MINI) and spec[0].sd_name == "B") { spec[0].sd_name = "A"; } @@ -266,7 +267,7 @@ void b200_impl::update_subdev_spec( const std::string& tx_rx, const uhd::usrp::subdev_spec_t& spec) { // sanity checking - if (spec.size()) { + if (!spec.empty()) { validate_subdev_spec(_tree, spec, tx_rx); } diff --git a/host/lib/usrp/b200/b200_uart.cpp b/host/lib/usrp/b200/b200_uart.cpp index b78690705..089c6c9b3 100644 --- a/host/lib/usrp/b200/b200_uart.cpp +++ b/host/lib/usrp/b200/b200_uart.cpp @@ -57,21 +57,21 @@ struct b200_uart_impl : b200_uart buff->commit(packet_info.num_packet_words32 * sizeof(uint32_t)); } - void write_uart(const std::string& buff) + void write_uart(const std::string& buff) override { for (const char ch : buff) { this->send_char(ch); } } - std::string read_uart(double timeout) + std::string read_uart(double timeout) override { std::string line; _line_queue.pop_with_timed_wait(line, timeout); return line; } - void handle_uart_packet(managed_recv_buffer::sptr buff) + void handle_uart_packet(managed_recv_buffer::sptr buff) override { const uint32_t* packet_buff = buff->cast<const uint32_t*>(); vrt::if_packet_info_t packet_info; diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp index a584ef0f7..55abd025c 100644 --- a/host/lib/usrp/common/ad9361_ctrl.cpp +++ b/host/lib/usrp/common/ad9361_ctrl.cpp @@ -28,9 +28,9 @@ public: { } - virtual ~ad9361_io_spi() {} + ~ad9361_io_spi() override {} - virtual uint8_t peek8(uint32_t reg) + uint8_t peek8(uint32_t reg) override { std::lock_guard<std::mutex> lock(_mutex); @@ -51,7 +51,7 @@ public: return static_cast<uint8_t>(val); } - virtual void poke8(uint32_t reg, uint8_t val) + void poke8(uint32_t reg, uint8_t val) override { std::lock_guard<std::mutex> lock(_mutex); @@ -93,7 +93,7 @@ public: { _device.initialize(); } - double set_gain(const std::string& which, const double value) + double set_gain(const std::string& which, const double value) override { std::lock_guard<std::mutex> lock(_mutex); @@ -103,7 +103,7 @@ public: return return_val; } - void set_agc(const std::string& which, bool enable) + void set_agc(const std::string& which, bool enable) override { std::lock_guard<std::mutex> lock(_mutex); @@ -111,7 +111,7 @@ public: _device.set_agc(chain, enable); } - void set_agc_mode(const std::string& which, const std::string& mode) + void set_agc_mode(const std::string& which, const std::string& mode) override { std::lock_guard<std::mutex> lock(_mutex); ad9361_device_t::chain_t chain = _get_chain_from_antenna(which); @@ -125,7 +125,7 @@ public: } //! set a new clock rate, return the exact value - double set_clock_rate(const double rate) + double set_clock_rate(const double rate) override { std::lock_guard<std::mutex> lock(_mutex); // clip to known bounds @@ -144,14 +144,14 @@ public: } //! set which RX and TX chains/antennas are active - void set_active_chains(bool tx1, bool tx2, bool rx1, bool rx2) + void set_active_chains(bool tx1, bool tx2, bool rx1, bool rx2) override { std::lock_guard<std::mutex> lock(_mutex); _device.set_active_chains(tx1, tx2, rx1, rx2); } //! set which timing mode to use - 1R1T, 2R2T - void set_timing_mode(const std::string& timing_mode) + void set_timing_mode(const std::string& timing_mode) override { std::lock_guard<std::mutex> lock(_mutex); @@ -164,7 +164,7 @@ public: } //! tune the given frontend, return the exact value - double tune(const std::string& which, const double freq) + double tune(const std::string& which, const double freq) override { std::lock_guard<std::mutex> lock(_mutex); @@ -179,7 +179,7 @@ public: } //! get the current frequency for the given frontend - double get_freq(const std::string& which) + double get_freq(const std::string& which) override { std::lock_guard<std::mutex> lock(_mutex); @@ -188,7 +188,7 @@ public: } //! turn on/off data port loopback - void data_port_loopback(const bool on) + void data_port_loopback(const bool on) override { std::lock_guard<std::mutex> lock(_mutex); @@ -196,7 +196,7 @@ public: } //! read internal RSSI sensor - sensor_value_t get_rssi(const std::string& which) + sensor_value_t get_rssi(const std::string& which) override { std::lock_guard<std::mutex> lock(_mutex); @@ -205,12 +205,12 @@ public: } //! read the internal temp sensor. Average over 3 results - sensor_value_t get_temperature() + sensor_value_t get_temperature() override { return sensor_value_t("temp", _device.get_average_temperature(), "C"); } - void set_dc_offset_auto(const std::string& which, const bool on) + void set_dc_offset_auto(const std::string& which, const bool on) override { std::lock_guard<std::mutex> lock(_mutex); @@ -218,7 +218,7 @@ public: _device.set_dc_offset_auto(direction, on); } - void set_iq_balance_auto(const std::string& which, const bool on) + void set_iq_balance_auto(const std::string& which, const bool on) override { std::lock_guard<std::mutex> lock(_mutex); @@ -226,7 +226,7 @@ public: _device.set_iq_balance_auto(direction, on); } - double set_bw_filter(const std::string& which, const double bw) + double set_bw_filter(const std::string& which, const double bw) override { ad9361_device_t::direction_t direction = _get_direction_from_antenna(which); double actual_bw = bw; @@ -248,7 +248,7 @@ public: return actual_bw; } - std::vector<std::string> get_filter_names(const std::string& which) + std::vector<std::string> get_filter_names(const std::string& which) override { std::lock_guard<std::mutex> lock(_mutex); @@ -257,7 +257,7 @@ public: } filter_info_base::sptr get_filter( - const std::string& which, const std::string& filter_name) + const std::string& which, const std::string& filter_name) override { std::lock_guard<std::mutex> lock(_mutex); @@ -268,7 +268,7 @@ public: void set_filter(const std::string& which, const std::string& filter_name, - const filter_info_base::sptr filter) + const filter_info_base::sptr filter) override { std::lock_guard<std::mutex> lock(_mutex); @@ -277,7 +277,7 @@ public: _device.set_filter(direction, chain, filter_name, filter); } - void output_digital_test_tone(bool enb) + void output_digital_test_tone(bool enb) override { _device.digital_test_tone(enb); } diff --git a/host/lib/usrp/common/ad936x_manager.cpp b/host/lib/usrp/common/ad936x_manager.cpp index 9646f0427..31e823d32 100644 --- a/host/lib/usrp/common/ad936x_manager.cpp +++ b/host/lib/usrp/common/ad936x_manager.cpp @@ -57,7 +57,7 @@ public: /************************************************************************ * API Calls ***********************************************************************/ - void init_codec() + void init_codec() override { for (const std::string& rx_fe : _rx_frontends) { _codec_ctrl->set_gain(rx_fe, DEFAULT_GAIN); @@ -86,7 +86,7 @@ public: // worst case conditions to stress the interface. // void loopback_self_test(std::function<void(uint32_t)> poker_functor, - std::function<uint64_t()> peeker_functor) + std::function<uint64_t()> peeker_functor) override { // Put AD936x in loopback mode _codec_ctrl->data_port_loopback(true); @@ -135,7 +135,7 @@ public: } - double get_auto_tick_rate(const double lcm_rate, size_t num_chans) + double get_auto_tick_rate(const double lcm_rate, size_t num_chans) override { UHD_ASSERT_THROW(num_chans >= 1 and num_chans <= _n_frontends); const uhd::meta_range_t rate_range = _codec_ctrl->get_clock_rate_range(); @@ -186,7 +186,7 @@ public: return new_rate; } - bool check_bandwidth(double rate, const std::string dir) + bool check_bandwidth(double rate, const std::string dir) override { double bw = _bw[dir == "Rx" ? "RX1" : "TX1"]; if (bw == 0.) // 0 indicates bandwidth is default value. @@ -208,8 +208,9 @@ public: return (rate <= bw); } - void populate_frontend_subtree( - uhd::property_tree::sptr subtree, const std::string& key, uhd::direction_t dir) + void populate_frontend_subtree(uhd::property_tree::sptr subtree, + const std::string& key, + uhd::direction_t dir) override { subtree->create<std::string>("name").set("FE-" + key); diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp index cbb108dae..82e84c6d9 100644 --- a/host/lib/usrp/common/fx2_ctrl.cpp +++ b/host/lib/usrp/common/fx2_ctrl.cpp @@ -134,7 +134,7 @@ public: _ctrl_transport = ctrl_transport; } - void usrp_fx2_reset(void) + void usrp_fx2_reset(void) override { unsigned char reset_y = 1; unsigned char reset_n = 0; @@ -144,7 +144,7 @@ public: std::this_thread::sleep_for(std::chrono::milliseconds(2000)); } - void usrp_load_firmware(std::string filestring, bool force) + void usrp_load_firmware(std::string filestring, bool force) override { const char* filename = filestring.c_str(); @@ -218,7 +218,7 @@ public: throw uhd::io_error("usrp_load_firmware: bad record"); } - void usrp_init(void) + void usrp_init(void) override { // disable usrp_rx_enable(false); @@ -231,7 +231,7 @@ public: usrp_tx_reset(false); } - void usrp_load_fpga(std::string filestring) + void usrp_load_fpga(std::string filestring) override { const char* filename = filestring.c_str(); @@ -283,7 +283,7 @@ public: UHD_LOGGER_INFO("FX2") << "FPGA image loaded"; } - void usrp_load_eeprom(std::string filestring) + void usrp_load_eeprom(std::string filestring) override { if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Loading EEPROM image: " << filestring << "..."; @@ -369,13 +369,13 @@ public: >= 0); } - void usrp_tx_enable(bool on) + void usrp_tx_enable(bool on) override { UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_TX_ENABLE, on, 0) >= 0); } - void usrp_rx_enable(bool on) + void usrp_rx_enable(bool on) override { UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_RX_ENABLE, on, 0) >= 0); } @@ -392,7 +392,7 @@ public: UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_RX_RESET, on, 0) >= 0); } - void usrp_fpga_reset(bool on) + void usrp_fpga_reset(bool on) override { UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_RESET, on, 0) >= 0); } @@ -401,7 +401,7 @@ public: uint16_t value, uint16_t index, unsigned char* buff, - uint16_t length) + uint16_t length) override { return _ctrl_transport->submit(VRT_VENDOR_OUT, // bmReqeustType request, // bRequest @@ -416,7 +416,7 @@ public: uint16_t value, uint16_t index, unsigned char* buff, - uint16_t length) + uint16_t length) override { return _ctrl_transport->submit(VRT_VENDOR_IN, // bmReqeustType request, // bRequest @@ -432,18 +432,18 @@ public: return usrp_control_write(request, value, index, 0, 0); } - byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) + byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) override { this->write_i2c(addr, byte_vector_t(1, uint8_t(offset))); return this->read_i2c(addr, num_bytes); } - int usrp_i2c_write(uint16_t i2c_addr, unsigned char* buf, uint16_t len) + int usrp_i2c_write(uint16_t i2c_addr, unsigned char* buf, uint16_t len) override { return usrp_control_write(VRQ_I2C_WRITE, i2c_addr, 0, buf, len); } - int usrp_i2c_read(uint16_t i2c_addr, unsigned char* buf, uint16_t len) + int usrp_i2c_read(uint16_t i2c_addr, unsigned char* buf, uint16_t len) override { return usrp_control_read(VRQ_I2C_READ, i2c_addr, 0, buf, len); } @@ -451,7 +451,7 @@ public: static const bool iface_debug = false; static const size_t max_i2c_data_bytes = 64; - void write_i2c(uint16_t addr, const byte_vector_t& bytes) + void write_i2c(uint16_t addr, const byte_vector_t& bytes) override { UHD_ASSERT_THROW(bytes.size() < max_i2c_data_bytes); @@ -462,7 +462,7 @@ public: uhd::runtime_error("USRP: failed i2c write"); } - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { UHD_ASSERT_THROW(num_bytes < max_i2c_data_bytes); diff --git a/host/lib/usrp/common/io_service_mgr.cpp b/host/lib/usrp/common/io_service_mgr.cpp index e30fa422d..0c2af5f68 100644 --- a/host/lib/usrp/common/io_service_mgr.cpp +++ b/host/lib/usrp/common/io_service_mgr.cpp @@ -416,9 +416,10 @@ public: const link_type_t link_type, const io_service_args_t& default_args, const uhd::device_addr_t& stream_args, - const std::string& streamer_id); + const std::string& streamer_id) override; - void disconnect_links(recv_link_if::sptr recv_link, send_link_if::sptr send_link); + void disconnect_links( + recv_link_if::sptr recv_link, send_link_if::sptr send_link) override; private: enum io_service_type_t { INLINE_IO_SRV, BLOCKING_IO_SRV, POLLING_IO_SRV }; diff --git a/host/lib/usrp/common/pwr_cal_mgr.cpp b/host/lib/usrp/common/pwr_cal_mgr.cpp index 0c30be7ad..d2838cbe9 100644 --- a/host/lib/usrp/common/pwr_cal_mgr.cpp +++ b/host/lib/usrp/common/pwr_cal_mgr.cpp @@ -55,19 +55,19 @@ public: set_serial(serial); } - void set_gain_group(uhd::gain_group::sptr gain_group) + void set_gain_group(uhd::gain_group::sptr gain_group) override { _gain_group = gain_group; } - bool has_power_data() + bool has_power_data() override { const std::string key = _get_key(); _load_cal_data(key); return _cal_data.count(key) && bool(_cal_data.at(key)); } - void populate_subtree(uhd::property_tree::sptr subtree) + void populate_subtree(uhd::property_tree::sptr subtree) override { subtree->create<std::string>(uhd::fs_path("ref_power/key")) .set_coercer([](const std::string&) -> std::string { @@ -93,7 +93,7 @@ public: .set_publisher([this]() { return this->get_power_range(); }); } - double set_power(const double power_dbm) + double set_power(const double power_dbm) override { const std::string key = _get_key(); _load_cal_data(key); @@ -128,7 +128,7 @@ public: return coerced_total_power; } - double get_power() + double get_power() override { const std::string key = _get_key(); _load_cal_data(key); @@ -148,14 +148,14 @@ public: return hw_power + (_gain_group->get_value() - hw_gain); } - void update_power() + void update_power() override { if (_mode == tracking_mode::TRACK_POWER) { set_power(_desired_power); } } - uhd::meta_range_t get_power_range() + uhd::meta_range_t get_power_range() override { const std::string key = _get_key(); _load_cal_data(key); @@ -171,7 +171,7 @@ public: return cal_data->get_power_limits(freq); } - void set_temperature(const int temp_C) + void set_temperature(const int temp_C) override { for (auto& cal_data : _cal_data) { if (cal_data.second) { @@ -180,12 +180,12 @@ public: } } - void set_tracking_mode(const tracking_mode mode) + void set_tracking_mode(const tracking_mode mode) override { _mode = mode; } - void set_serial(const std::string& serial) + void set_serial(const std::string& serial) override { if (serial == _serial || serial.empty()) { return; @@ -233,12 +233,12 @@ public: } } - std::string get_serial() const + std::string get_serial() const override { return _serial; } - std::string get_key() + std::string get_key() override { return _get_key(); } diff --git a/host/lib/usrp/common/recv_packet_demuxer.cpp b/host/lib/usrp/common/recv_packet_demuxer.cpp index c5ed1563e..9d3067286 100644 --- a/host/lib/usrp/common/recv_packet_demuxer.cpp +++ b/host/lib/usrp/common/recv_packet_demuxer.cpp @@ -26,7 +26,7 @@ public: { /*NOP*/ } - void release(void) + void release(void) override { delete this; } @@ -56,7 +56,8 @@ public: /* NOP */ } - managed_recv_buffer::sptr get_recv_buff(const size_t index, const double timeout) + managed_recv_buffer::sptr get_recv_buff( + const size_t index, const double timeout) override { boost::mutex::scoped_lock lock(_mutex); managed_recv_buffer::sptr buff; diff --git a/host/lib/usrp/common/validate_subdev_spec.cpp b/host/lib/usrp/common/validate_subdev_spec.cpp index 61895a7f8..dc9c7700a 100644 --- a/host/lib/usrp/common/validate_subdev_spec.cpp +++ b/host/lib/usrp/common/validate_subdev_spec.cpp @@ -32,7 +32,7 @@ void uhd::usrp::validate_subdev_spec(property_tree::sptr tree, tree->list(str(boost::format("/mboards/%s/%s_dsps") % mb % type)).size(); // sanity checking on the length - if (spec.size() == 0) + if (spec.empty()) throw uhd::value_error( str(boost::format("Empty %s subdevice specification is not supported.\n") % type)); diff --git a/host/lib/usrp/cores/dma_fifo_core_3000.cpp b/host/lib/usrp/cores/dma_fifo_core_3000.cpp index 382006b67..405ff24d8 100644 --- a/host/lib/usrp/cores/dma_fifo_core_3000.cpp +++ b/host/lib/usrp/cores/dma_fifo_core_3000.cpp @@ -83,12 +83,12 @@ public: << dma_fifo_core_3000_impl::get_fifo_timeout() << " cycles"); } - virtual ~dma_fifo_core_3000_impl() {} + ~dma_fifo_core_3000_impl() override {} /************************************************************************** * API *************************************************************************/ - bool has_bist() const + bool has_bist() const override { return _has_bist; } @@ -101,17 +101,17 @@ public: // TODO: read suppress API // fullness in bytes - uint64_t get_fifo_fullness() + uint64_t get_fifo_fullness() override { return peek64(REG_FIFO_FULLNESS); } - uint16_t get_fifo_timeout() + uint16_t get_fifo_timeout() override { return peek32(REG_FIFO_TIMEOUT) & 0xFFF; } - void set_fifo_timeout(const uint16_t timeout_cycles) + void set_fifo_timeout(const uint16_t timeout_cycles) override { UHD_ASSERT_THROW(timeout_cycles <= 0xFFF); poke32(timeout_cycles, REG_FIFO_TIMEOUT); @@ -138,7 +138,7 @@ public: poke64(REG_FIFO_ADDR_BASE, base_addr); } - uint32_t get_packet_count() + uint32_t get_packet_count() override { return peek32(REG_FIFO_PACKET_CNT); } @@ -197,7 +197,7 @@ public: poke32(REG_BIST_CTRL, 1 << 2); } - double run_bist(const uint64_t num_bytes, const double timeout_s) + double run_bist(const uint64_t num_bytes, const double timeout_s) override { // The number of cycles it will take to transfer all the BIST data if // there is a transfer on every clock cycle (this is the minimum time it diff --git a/host/lib/usrp/cores/gpio_atr_3000.cpp b/host/lib/usrp/cores/gpio_atr_3000.cpp index 14996f659..875752ee2 100644 --- a/host/lib/usrp/cores/gpio_atr_3000.cpp +++ b/host/lib/usrp/cores/gpio_atr_3000.cpp @@ -64,7 +64,7 @@ public: } } - virtual void set_atr_mode(const gpio_atr_mode_t mode, const uint32_t mask) + void set_atr_mode(const gpio_atr_mode_t mode, const uint32_t mask) override { // Each bit in the "ATR Disable" register determines whether the respective bit in // the GPIO output bus is driven by the ATR engine or a static register. For each @@ -79,7 +79,7 @@ public: _update_attr_state(GPIO_CTRL, ~value, mask); } - virtual void set_gpio_ddr(const gpio_ddr_t dir, const uint32_t mask) + void set_gpio_ddr(const gpio_ddr_t dir, const uint32_t mask) override { // Each bit in the "DDR" register determines whether the respective bit in the // GPIO bus is an input or an output. For each bit position, a 1 means that the @@ -92,9 +92,9 @@ public: _update_attr_state(GPIO_DDR, value, mask); } - virtual void set_atr_reg(const gpio_atr_reg_t atr, + void set_atr_reg(const gpio_atr_reg_t atr, const uint32_t value, - const uint32_t mask = MASK_SET_ALL) + const uint32_t mask = MASK_SET_ALL) override { // Set the value of the specified ATR register. For bits with ATR Disable set to // 1, the IDLE register will hold the output state This setting will only get @@ -135,7 +135,7 @@ public: _update_attr_state(attr, value, mask); } - virtual void set_gpio_out(const uint32_t value, const uint32_t mask = MASK_SET_ALL) + void set_gpio_out(const uint32_t value, const uint32_t mask = MASK_SET_ALL) override { // Set the value of the specified GPIO output register. // This setting will only get applied to all bits in the "mask" that are 1. All @@ -148,7 +148,7 @@ public: _update_attr_state(GPIO_OUT, value, mask); } - virtual uint32_t read_gpio() + uint32_t read_gpio() override { // Read the state of the GPIO pins // If a pin is configured as an input, reads the actual value of the pin @@ -160,7 +160,7 @@ public: } } - virtual uint32_t get_attr_reg(const gpio_attr_t attr) + uint32_t get_attr_reg(const gpio_attr_t attr) override { if (attr == GPIO_SRC) { throw uhd::runtime_error("Can't get GPIO source by GPIO ATR interface."); @@ -175,7 +175,7 @@ public: return _attr_reg_state.at(attr); } - inline virtual void set_gpio_attr(const gpio_attr_t attr, const uint32_t value) + inline void set_gpio_attr(const gpio_attr_t attr, const uint32_t value) override { // An attribute based API to configure all settings for the GPIO bus in one // function call. This API does not have a mask so it configures all bits at the @@ -243,7 +243,7 @@ protected: return uhd::soft_reg32_wo_t::get(uhd::soft_reg32_wo_t::REGISTER); } - virtual void flush() + void flush() override { uhd::soft_reg32_wo_t::flush(); } @@ -260,12 +260,12 @@ protected: { } - virtual void set_with_mask(const uint32_t value, const uint32_t mask) + void set_with_mask(const uint32_t value, const uint32_t mask) override { _atr_idle_cache = (value & mask) | (_atr_idle_cache & (~mask)); } - virtual uint32_t get() + uint32_t get() override { return _atr_idle_cache; } @@ -280,7 +280,7 @@ protected: return _gpio_out_cache; } - virtual void flush() + void flush() override { set(REGISTER, (_atr_idle_cache & (~_atr_disable_reg.get())) @@ -344,26 +344,26 @@ public: } inline void set_pin_ctrl( - const db_unit_t unit, const uint32_t value, const uint32_t mask) + const db_unit_t unit, const uint32_t value, const uint32_t mask) override { gpio_atr_3000_impl::set_atr_mode(MODE_ATR, compute_mask(unit, value & mask)); gpio_atr_3000_impl::set_atr_mode(MODE_GPIO, compute_mask(unit, (~value) & mask)); } - inline uint32_t get_pin_ctrl(const db_unit_t unit) + inline uint32_t get_pin_ctrl(const db_unit_t unit) override { return (~_atr_disable_reg.get()) >> compute_shift(unit); } using gpio_atr_3000_impl::set_gpio_ddr; inline void set_gpio_ddr( - const db_unit_t unit, const uint32_t value, const uint32_t mask) + const db_unit_t unit, const uint32_t value, const uint32_t mask) override { gpio_atr_3000_impl::set_gpio_ddr(DDR_OUTPUT, compute_mask(unit, value & mask)); gpio_atr_3000_impl::set_gpio_ddr(DDR_INPUT, compute_mask(unit, (~value) & mask)); } - inline uint32_t get_gpio_ddr(const db_unit_t unit) + inline uint32_t get_gpio_ddr(const db_unit_t unit) override { return _ddr_reg.get() >> compute_shift(unit); } @@ -372,13 +372,13 @@ public: inline void set_atr_reg(const db_unit_t unit, const gpio_atr_reg_t atr, const uint32_t value, - const uint32_t mask) + const uint32_t mask) override { gpio_atr_3000_impl::set_atr_reg( atr, value << compute_shift(unit), compute_mask(unit, mask)); } - inline uint32_t get_atr_reg(const db_unit_t unit, const gpio_atr_reg_t atr) + inline uint32_t get_atr_reg(const db_unit_t unit, const gpio_atr_reg_t atr) override { masked_reg_t* reg = NULL; switch (atr) { @@ -403,21 +403,21 @@ public: using gpio_atr_3000_impl::set_gpio_out; inline void set_gpio_out( - const db_unit_t unit, const uint32_t value, const uint32_t mask) + const db_unit_t unit, const uint32_t value, const uint32_t mask) override { gpio_atr_3000_impl::set_gpio_out( static_cast<uint32_t>(value) << compute_shift(unit), compute_mask(unit, mask)); } - inline uint32_t get_gpio_out(const db_unit_t unit) + inline uint32_t get_gpio_out(const db_unit_t unit) override { return (_atr_idle_reg.get_gpio_out() & compute_mask(unit, MASK_SET_ALL)) >> compute_shift(unit); } using gpio_atr_3000_impl::read_gpio; - inline uint32_t read_gpio(const db_unit_t unit) + inline uint32_t read_gpio(const db_unit_t unit) override { return (gpio_atr_3000_impl::read_gpio() & compute_mask(unit, MASK_SET_ALL)) >> compute_shift(unit); diff --git a/host/lib/usrp/cores/gpio_core_200.cpp b/host/lib/usrp/cores/gpio_core_200.cpp index 7ee0daf70..b39cd0b75 100644 --- a/host/lib/usrp/cores/gpio_core_200.cpp +++ b/host/lib/usrp/cores/gpio_core_200.cpp @@ -36,7 +36,8 @@ public: { /* NOP */ } - void set_pin_ctrl(const unit_t unit, const uint16_t value, const uint16_t mask) + void set_pin_ctrl( + const unit_t unit, const uint16_t value, const uint16_t mask) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); @@ -44,15 +45,17 @@ public: update(); // full update } - uint16_t get_pin_ctrl(unit_t unit) + uint16_t get_pin_ctrl(unit_t unit) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); return _pin_ctrl[unit]; } - void set_atr_reg( - const unit_t unit, const atr_reg_t atr, const uint16_t value, const uint16_t mask) + void set_atr_reg(const unit_t unit, + const atr_reg_t atr, + const uint16_t value, + const uint16_t mask) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); @@ -65,14 +68,15 @@ public: update(atr); } - uint16_t get_atr_reg(unit_t unit, atr_reg_t reg) + uint16_t get_atr_reg(unit_t unit, atr_reg_t reg) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); return _atr_regs[unit][reg]; } - void set_gpio_ddr(const unit_t unit, const uint16_t value, const uint16_t mask) + void set_gpio_ddr( + const unit_t unit, const uint16_t value, const uint16_t mask) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); @@ -84,14 +88,15 @@ public: << shift_by_unit(dboard_iface::UNIT_TX))); } - uint16_t get_gpio_ddr(unit_t unit) + uint16_t get_gpio_ddr(unit_t unit) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); return _gpio_ddr[unit]; } - void set_gpio_out(const unit_t unit, const uint16_t value, const uint16_t mask) + void set_gpio_out( + const unit_t unit, const uint16_t value, const uint16_t mask) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); @@ -99,14 +104,14 @@ public: this->update(); // full update } - uint16_t get_gpio_out(unit_t unit) + uint16_t get_gpio_out(unit_t unit) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); return _gpio_out[unit]; } - uint16_t read_gpio(const unit_t unit) + uint16_t read_gpio(const unit_t unit) override { if (unit == dboard_iface::UNIT_BOTH) throw uhd::runtime_error("UNIT_BOTH not supported in gpio_core_200"); @@ -197,13 +202,13 @@ public: set_ddr_reg(); } - void set_ddr_reg() + void set_ddr_reg() override { _iface->poke32(REG_GPIO_DDR, 0xffffffff); } - void set_atr_reg(const atr_reg_t atr, const uint32_t value) + void set_atr_reg(const atr_reg_t atr, const uint32_t value) override { if (atr == gpio_atr::ATR_REG_IDLE) _iface->poke32(REG_GPIO_IDLE, value); @@ -217,7 +222,7 @@ public: UHD_THROW_INVALID_CODE_PATH(); } - void set_all_regs(const uint32_t value) + void set_all_regs(const uint32_t value) override { set_atr_reg(gpio_atr::ATR_REG_IDLE, value); set_atr_reg(gpio_atr::ATR_REG_TX_ONLY, value); diff --git a/host/lib/usrp/cores/i2c_core_100_wb32.cpp b/host/lib/usrp/cores/i2c_core_100_wb32.cpp index d3d0a135a..d1f1f9fe0 100644 --- a/host/lib/usrp/cores/i2c_core_100_wb32.cpp +++ b/host/lib/usrp/cores/i2c_core_100_wb32.cpp @@ -61,7 +61,7 @@ public: _iface->poke32(REG_I2C_CTRL, I2C_CTRL_EN); // enable I2C core } - void set_clock_rate(const double rate) + void set_clock_rate(const double rate) override { static const uint32_t i2c_datarate = 400000; uint16_t prescaler = uint16_t(rate / (i2c_datarate * 5) - 1); @@ -69,11 +69,11 @@ public: _iface->poke32(REG_I2C_PRESCALER_HI, (prescaler >> 8) & 0xFF); } - void write_i2c(uint16_t addr, const byte_vector_t& bytes) + void write_i2c(uint16_t addr, const byte_vector_t& bytes) override { _iface->poke32(REG_I2C_DATA, (addr << 1) | 0); // addr and read bit (0) _iface->poke32(REG_I2C_CMD_STATUS, - I2C_CMD_WR | I2C_CMD_START | (bytes.size() == 0 ? I2C_CMD_STOP : 0)); + I2C_CMD_WR | I2C_CMD_START | (bytes.empty() ? I2C_CMD_STOP : 0)); // wait for previous transfer to complete if (not wait_chk_ack()) { @@ -92,7 +92,7 @@ public: } } - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { byte_vector_t bytes; if (num_bytes == 0) @@ -119,7 +119,7 @@ public: // override read_eeprom so we can write once, read all N bytes // the default implementation calls read i2c once per byte - byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) + byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) override { this->write_i2c(addr, byte_vector_t(1, uint8_t(offset))); return this->read_i2c(addr, num_bytes); diff --git a/host/lib/usrp/cores/i2c_core_200.cpp b/host/lib/usrp/cores/i2c_core_200.cpp index 431ba194c..93e3fedf8 100644 --- a/host/lib/usrp/cores/i2c_core_200.cpp +++ b/host/lib/usrp/cores/i2c_core_200.cpp @@ -70,11 +70,11 @@ public: this->poke(REG_I2C_WR_CTRL, I2C_CTRL_EN); // enable I2C core } - void write_i2c(uint16_t addr, const byte_vector_t& bytes) + void write_i2c(uint16_t addr, const byte_vector_t& bytes) override { this->poke(REG_I2C_WR_DATA, (addr << 1) | 0); // addr and read bit (0) this->poke(REG_I2C_WR_CMD, - I2C_CMD_WR | I2C_CMD_START | (bytes.size() == 0 ? I2C_CMD_STOP : 0)); + I2C_CMD_WR | I2C_CMD_START | (bytes.empty() ? I2C_CMD_STOP : 0)); // wait for previous transfer to complete if (not wait_chk_ack()) { @@ -93,7 +93,7 @@ public: } } - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { byte_vector_t bytes; if (num_bytes == 0) diff --git a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp index 7518bfe6f..6947da3f1 100644 --- a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp +++ b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp @@ -60,7 +60,7 @@ public: this->set_tick_rate(1.0); // something possible but bogus } - ~radio_ctrl_core_3000_impl(void) + ~radio_ctrl_core_3000_impl(void) override { _timeout = ACK_TIMEOUT; // reset timeout to something small UHD_SAFE_CALL( @@ -72,14 +72,14 @@ public: /******************************************************************* * Peek and poke 32 bit implementation ******************************************************************/ - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { boost::mutex::scoped_lock lock(_mutex); this->send_pkt(addr / 4, data); this->wait_for_ack(false); } - uint32_t peek32(const wb_addr_type addr) + uint32_t peek32(const wb_addr_type addr) override { boost::mutex::scoped_lock lock(_mutex); this->send_pkt(SR_READBACK, addr / 8); @@ -89,7 +89,7 @@ public: return ((addr / 4) & 0x1) ? hi : lo; } - uint64_t peek64(const wb_addr_type addr) + uint64_t peek64(const wb_addr_type addr) override { boost::mutex::scoped_lock lock(_mutex); this->send_pkt(SR_READBACK, addr / 8); @@ -99,7 +99,7 @@ public: /******************************************************************* * Update methods for time ******************************************************************/ - void set_time(const uhd::time_spec_t& time) + void set_time(const uhd::time_spec_t& time) override { boost::mutex::scoped_lock lock(_mutex); _time = time; @@ -108,13 +108,13 @@ public: _timeout = MASSIVE_TIMEOUT; // permanently sets larger timeout } - uhd::time_spec_t get_time(void) + uhd::time_spec_t get_time(void) override { boost::mutex::scoped_lock lock(_mutex); return _time; } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { boost::mutex::scoped_lock lock(_mutex); _tick_rate = rate; @@ -298,7 +298,7 @@ private: uhd::msg_task::msg_payload_t msg; do { msg = _async_task->get_msg_from_dump_queue(recv_sid); - } while (msg.size() < min_buff_size && msg.size() != 0); + } while (msg.size() < min_buff_size && !msg.empty()); if (msg.size() >= min_buff_size) { memcpy(b.data, &msg.front(), std::min(msg.size(), sizeof(b.data))); @@ -307,14 +307,14 @@ private: return false; } - void push_response(const uint32_t* buff) + void push_response(const uint32_t* buff) override { resp_buff_type resp_buff; std::memcpy(resp_buff.data, buff, sizeof(resp_buff)); _resp_queue.push_with_haste(resp_buff); } - void hold_task(uhd::msg_task::sptr task) + void hold_task(uhd::msg_task::sptr task) override { _async_task = task; } diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 89b44290f..5e2c3804f 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -82,14 +82,14 @@ public: this->clear(); } - ~rx_dsp_core_200_impl(void) + ~rx_dsp_core_200_impl(void) override { UHD_SAFE_CALL( // shutdown any possible streaming this->clear();) } - void clear(void) + void clear(void) override { _iface->poke32(REG_RX_CTRL_NCHANNELS, 0); // also reset _iface->poke32(REG_RX_CTRL_VRT_HDR, @@ -101,12 +101,12 @@ public: _iface->poke32(REG_RX_CTRL_VRT_TLR, 0); } - void set_nsamps_per_packet(const size_t nsamps) + void set_nsamps_per_packet(const size_t nsamps) override { _iface->poke32(REG_RX_CTRL_NSAMPS_PP, nsamps); } - void issue_stream_command(const stream_cmd_t& stream_cmd) + void issue_stream_command(const stream_cmd_t& stream_cmd) override { UHD_ASSERT_THROW(stream_cmd.num_samps <= 0x0fffffff); _continuous_streaming = stream_cmd.stream_mode @@ -147,7 +147,7 @@ public: _iface->poke32(REG_RX_CTRL_TIME_LO, uint32_t(ticks >> 0)); // latches the command } - void set_mux(const std::string& mode, const bool fe_swapped) + void set_mux(const std::string& mode, const bool fe_swapped) override { static const uhd::dict<std::string, uint32_t> mode_to_mux = boost::assign::map_list_of("IQ", 0)("QI", FLAG_DSP_RX_MUX_SWAP_IQ)( @@ -157,18 +157,18 @@ public: mode_to_mux[mode] ^ (fe_swapped ? FLAG_DSP_RX_MUX_SWAP_IQ : 0)); } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { _tick_rate = rate; } - void set_link_rate(const double rate) + void set_link_rate(const double rate) override { //_link_rate = rate/sizeof(uint32_t); //in samps/s _link_rate = rate / sizeof(uint16_t); // in samps/s (allows for 8sc) } - uhd::meta_range_t get_host_rates(void) + uhd::meta_range_t get_host_rates(void) override { meta_range_t range; for (int rate = 512; rate > 256; rate -= 4) { @@ -183,7 +183,7 @@ public: return range; } - double set_host_rate(const double rate) + double set_host_rate(const double rate) override { const size_t decim_rate = boost::math::iround(_tick_rate / this->get_host_rates().clip(rate, true)); @@ -235,12 +235,12 @@ public: _iface->poke32(REG_DSP_RX_SCALE_IQ, actual_scalar); } - double get_scaling_adjustment(void) + double get_scaling_adjustment(void) override { return _fxpt_scalar_correction * _host_extra_scaling / 32767.; } - double set_freq(const double requested_freq) + double set_freq(const double requested_freq) override { double actual_freq; int32_t freq_word; @@ -249,19 +249,19 @@ public: return actual_freq; } - uhd::meta_range_t get_freq_range(void) + uhd::meta_range_t get_freq_range(void) override { return uhd::meta_range_t( -_tick_rate / 2, +_tick_rate / 2, _tick_rate / std::pow(2.0, 32)); } - void handle_overflow(void) + void handle_overflow(void) override { if (_continuous_streaming) issue_stream_command(stream_cmd_t::STREAM_MODE_START_CONTINUOUS); } - void setup(const uhd::stream_args_t& stream_args) + void setup(const uhd::stream_args_t& stream_args) override { if (not stream_args.args.has_key("noclear")) this->clear(); diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 3724ca827..ff431fd41 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -54,13 +54,13 @@ public: { } - ~rx_dsp_core_3000_impl(void) + ~rx_dsp_core_3000_impl(void) override { UHD_SAFE_CALL(; // NOP ) } - void set_mux(const uhd::usrp::fe_connection_t& fe_conn) + void set_mux(const uhd::usrp::fe_connection_t& fe_conn) override { uint32_t reg_val = 0; switch (fe_conn.get_sampling_mode()) { @@ -101,19 +101,19 @@ public: } } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { _tick_rate = rate; set_freq(_current_freq); } - void set_link_rate(const double rate) + void set_link_rate(const double rate) override { //_link_rate = rate/sizeof(uint32_t); //in samps/s _link_rate = rate / sizeof(uint16_t); // in samps/s (allows for 8sc) } - uhd::meta_range_t get_host_rates(void) + uhd::meta_range_t get_host_rates(void) override { meta_range_t range; if (!_is_b200) { @@ -133,7 +133,7 @@ public: return range; } - double set_host_rate(const double rate) + double set_host_rate(const double rate) override { const size_t decim_rate = boost::math::iround(_tick_rate / this->get_host_rates().clip(rate, true)); @@ -237,12 +237,12 @@ public: _iface->poke32(REG_DSP_RX_SCALE_IQ, actual_scalar); } - double get_scaling_adjustment(void) + double get_scaling_adjustment(void) override { return _fxpt_scalar_correction * _host_extra_scaling / 32767.; } - double set_freq(const double requested_freq) + double set_freq(const double requested_freq) override { double actual_freq; int32_t freq_word; @@ -253,12 +253,12 @@ public: return actual_freq; } - double get_freq(void) + double get_freq(void) override { return _current_freq; } - uhd::meta_range_t get_freq_range(void) + uhd::meta_range_t get_freq_range(void) override { // Too keep the DSP range symmetric about 0, we use abs(_dsp_freq_offset) const double offset = std::abs<double>(_dsp_freq_offset); @@ -267,7 +267,7 @@ public: _tick_rate / std::pow(2.0, 32)); } - void setup(const uhd::stream_args_t& stream_args) + void setup(const uhd::stream_args_t& stream_args) override { if (stream_args.otw_format == "sc16") { _dsp_extra_scaling = 1.0; @@ -294,7 +294,7 @@ public: this->update_scalar(); } - void populate_subtree(property_tree::sptr subtree) + void populate_subtree(property_tree::sptr subtree) override { subtree->create<meta_range_t>("rate/range") .set_publisher(std::bind(&rx_dsp_core_3000::get_host_rates, this)); diff --git a/host/lib/usrp/cores/rx_frontend_core_200.cpp b/host/lib/usrp/cores/rx_frontend_core_200.cpp index b16de0d9e..d96672da4 100644 --- a/host/lib/usrp/cores/rx_frontend_core_200.cpp +++ b/host/lib/usrp/cores/rx_frontend_core_200.cpp @@ -52,17 +52,17 @@ public: // NOP } - void set_mux(const bool swap) + void set_mux(const bool swap) override { _iface->poke32(REG_RX_FE_SWAP_IQ, swap ? 1 : 0); } - void set_dc_offset_auto(const bool enb) + void set_dc_offset_auto(const bool enb) override { this->set_dc_offset(enb ? 0 : OFFSET_FIXED); } - std::complex<double> set_dc_offset(const std::complex<double>& off) + std::complex<double> set_dc_offset(const std::complex<double>& off) override { static const double scaler = double(1ul << 29); _i_dc_off = boost::math::iround(off.real() * scaler); @@ -79,13 +79,13 @@ public: _iface->poke32(REG_RX_FE_OFFSET_Q, flags | (_q_dc_off & ~FLAG_MASK)); } - void set_iq_balance(const std::complex<double>& cor) + void set_iq_balance(const std::complex<double>& cor) override { _iface->poke32(REG_RX_FE_MAG_CORRECTION, fs_to_bits(cor.real(), 18)); _iface->poke32(REG_RX_FE_PHASE_CORRECTION, fs_to_bits(cor.imag(), 18)); } - void populate_subtree(uhd::property_tree::sptr subtree) + void populate_subtree(uhd::property_tree::sptr subtree) override { subtree->create<uhd::meta_range_t>("dc_offset/range") .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX)); diff --git a/host/lib/usrp/cores/rx_frontend_core_3000.cpp b/host/lib/usrp/cores/rx_frontend_core_3000.cpp index 756f0995d..abbe64b13 100644 --- a/host/lib/usrp/cores/rx_frontend_core_3000.cpp +++ b/host/lib/usrp/cores/rx_frontend_core_3000.cpp @@ -79,12 +79,12 @@ public: // NOP } - void set_adc_rate(const double rate) + void set_adc_rate(const double rate) override { _adc_rate = rate; } - void bypass_all(bool bypass_en) + void bypass_all(bool bypass_en) override { if (bypass_en) { _iface->poke32(_rx_fe_mapping_reg, FLAG_DSP_RX_MAPPING_BYPASS_ALL); @@ -93,7 +93,7 @@ public: } } - void set_fe_connection(const fe_connection_t& fe_conn) + void set_fe_connection(const fe_connection_t& fe_conn) override { uint32_t mapping_reg_val = 0; switch (fe_conn.get_sampling_mode()) { @@ -143,12 +143,12 @@ public: _fe_conn = fe_conn; } - void set_dc_offset_auto(const bool enb) + void set_dc_offset_auto(const bool enb) override { _set_dc_offset(enb ? 0 : OFFSET_FIXED); } - std::complex<double> set_dc_offset(const std::complex<double>& off) + std::complex<double> set_dc_offset(const std::complex<double>& off) override { static const double scaler = double(1ul << 29); _i_dc_off = boost::math::iround(off.real() * scaler); @@ -165,13 +165,13 @@ public: _iface->poke32(_rx_fe_offset_q_reg, flags | (_q_dc_off & ~FLAG_MASK)); } - void set_iq_balance(const std::complex<double>& cor) + void set_iq_balance(const std::complex<double>& cor) override { _iface->poke32(_rx_fe_mag_corr_reg, fs_to_bits(cor.real(), 18)); _iface->poke32(_rx_fe_phase_corr_reg, fs_to_bits(cor.imag(), 18)); } - void populate_subtree(uhd::property_tree::sptr subtree) + void populate_subtree(uhd::property_tree::sptr subtree) override { subtree->create<uhd::meta_range_t>("dc_offset/range") .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX)); diff --git a/host/lib/usrp/cores/rx_vita_core_3000.cpp b/host/lib/usrp/cores/rx_vita_core_3000.cpp index fb3305ce8..622120d90 100644 --- a/host/lib/usrp/cores/rx_vita_core_3000.cpp +++ b/host/lib/usrp/cores/rx_vita_core_3000.cpp @@ -41,12 +41,12 @@ struct rx_vita_core_3000_impl : rx_vita_core_3000 this->clear(); } - ~rx_vita_core_3000_impl(void) + ~rx_vita_core_3000_impl(void) override { UHD_SAFE_CALL(this->clear();) } - void configure_flow_control(const size_t window_size) + void configure_flow_control(const size_t window_size) override { // The window needs to be disabled in the case where this object is // uncleanly destroyed and the FC window is left enabled @@ -63,19 +63,19 @@ struct rx_vita_core_3000_impl : rx_vita_core_3000 _iface->poke32(REG_FC_ENABLE, window_size ? 1 : 0); } - void clear(void) + void clear(void) override { // FC should never be disabled, this will actually become // impossible in the future // this->configure_flow_control(0); //disable fc } - void set_nsamps_per_packet(const size_t nsamps) + void set_nsamps_per_packet(const size_t nsamps) override { _iface->poke32(REG_FRAMER_MAXLEN, nsamps); } - void issue_stream_command(const uhd::stream_cmd_t& stream_cmd) + void issue_stream_command(const uhd::stream_cmd_t& stream_cmd) override { if (not _is_setup) { // UHD_LOGGER_WARNING("CORES") << "rx vita core 3000 issue stream command - @@ -134,28 +134,28 @@ struct rx_vita_core_3000_impl : rx_vita_core_3000 _iface->poke32(REG_CTRL_TIME_LO, uint32_t(ticks >> 0)); // latches the command } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { _tick_rate = rate; } - void set_sid(const uint32_t sid) + void set_sid(const uint32_t sid) override { _iface->poke32(REG_FRAMER_SID, sid); } - void handle_overflow(void) + void handle_overflow(void) override { if (_continuous_streaming) this->issue_stream_command(stream_cmd_t::STREAM_MODE_START_CONTINUOUS); } - void setup(const uhd::stream_args_t&) + void setup(const uhd::stream_args_t&) override { _is_setup = true; } - bool in_continuous_streaming_mode(void) + bool in_continuous_streaming_mode(void) override { return _continuous_streaming; } diff --git a/host/lib/usrp/cores/spi_core_3000.cpp b/host/lib/usrp/cores/spi_core_3000.cpp index e279ffa66..28a8782d5 100644 --- a/host/lib/usrp/cores/spi_core_3000.cpp +++ b/host/lib/usrp/cores/spi_core_3000.cpp @@ -46,7 +46,7 @@ public: const spi_config_t& config, uint32_t data, size_t num_bits, - bool readback) + bool readback) override { std::lock_guard<std::mutex> lock(_mutex); @@ -93,7 +93,7 @@ public: return 0; } - void set_divider(const double div) + void set_divider(const double div) override { _div = size_t((div / 2) - 0.5); } diff --git a/host/lib/usrp/cores/time64_core_200.cpp b/host/lib/usrp/cores/time64_core_200.cpp index a7d5427c1..f5cd7158f 100644 --- a/host/lib/usrp/cores/time64_core_200.cpp +++ b/host/lib/usrp/cores/time64_core_200.cpp @@ -54,17 +54,17 @@ public: _sources.push_back("mimo"); } - void enable_gpsdo(void) + void enable_gpsdo(void) override { _sources.push_back("gpsdo"); } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { _tick_rate = rate; } - uhd::time_spec_t get_time_now(void) + uhd::time_spec_t get_time_now(void) override { for (size_t i = 0; i < 3; i++) { // special algorithm because we cant read 64 bits synchronously @@ -78,7 +78,7 @@ public: throw uhd::runtime_error("time64_core_200: get time now timeout"); } - uhd::time_spec_t get_time_last_pps(void) + uhd::time_spec_t get_time_last_pps(void) override { for (size_t i = 0; i < 3; i++) { // special algorithm because we cant read 64 bits synchronously @@ -92,7 +92,7 @@ public: throw uhd::runtime_error("time64_core_200: get time last pps timeout"); } - void set_time_now(const uhd::time_spec_t& time) + void set_time_now(const uhd::time_spec_t& time) override { const uint64_t ticks = time.to_ticks(_tick_rate); _iface->poke32(REG_TIME64_TICKS_LO, uint32_t(ticks >> 0)); @@ -100,7 +100,7 @@ public: _iface->poke32(REG_TIME64_TICKS_HI, uint32_t(ticks >> 32)); // latches all 3 } - void set_time_next_pps(const uhd::time_spec_t& time) + void set_time_next_pps(const uhd::time_spec_t& time) override { const uint64_t ticks = time.to_ticks(_tick_rate); _iface->poke32(REG_TIME64_TICKS_LO, uint32_t(ticks >> 0)); @@ -108,7 +108,7 @@ public: _iface->poke32(REG_TIME64_TICKS_HI, uint32_t(ticks >> 32)); // latches all 3 } - void set_time_source(const std::string& source) + void set_time_source(const std::string& source) override { assert_has(_sources, source, "time source"); @@ -130,7 +130,7 @@ public: } } - std::vector<std::string> get_time_sources(void) + std::vector<std::string> get_time_sources(void) override { return _sources; } diff --git a/host/lib/usrp/cores/time_core_3000.cpp b/host/lib/usrp/cores/time_core_3000.cpp index 852c3882e..8e32cf4b8 100644 --- a/host/lib/usrp/cores/time_core_3000.cpp +++ b/host/lib/usrp/cores/time_core_3000.cpp @@ -36,18 +36,18 @@ struct time_core_3000_impl : time_core_3000 this->set_tick_rate(1); // init to non zero } - ~time_core_3000_impl(void) + ~time_core_3000_impl(void) override { UHD_SAFE_CALL(; // NOP ) } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { _tick_rate = rate; } - void self_test(void) + void self_test(void) override { const size_t sleep_millis = 100; UHD_LOGGER_DEBUG("CORES") << "Performing timer loopback test... "; @@ -71,19 +71,19 @@ struct time_core_3000_impl : time_core_3000 << "Approximate clock rate: " << (approx_rate / 1e6) << " MHz\n"; } - uhd::time_spec_t get_time_now(void) + uhd::time_spec_t get_time_now(void) override { const uint64_t ticks = _iface->peek64(_readback_bases.rb_now); return time_spec_t::from_ticks(ticks, _tick_rate); } - uhd::time_spec_t get_time_last_pps(void) + uhd::time_spec_t get_time_last_pps(void) override { const uint64_t ticks = _iface->peek64(_readback_bases.rb_pps); return time_spec_t::from_ticks(ticks, _tick_rate); } - void set_time_now(const uhd::time_spec_t& time) + void set_time_now(const uhd::time_spec_t& time) override { const uint64_t ticks = time.to_ticks(_tick_rate); _iface->poke32(REG_TIME_HI, uint32_t(ticks >> 32)); @@ -91,7 +91,7 @@ struct time_core_3000_impl : time_core_3000 _iface->poke32(REG_TIME_CTRL, CTRL_LATCH_TIME_NOW); } - void set_time_sync(const uhd::time_spec_t& time) + void set_time_sync(const uhd::time_spec_t& time) override { const uint64_t ticks = time.to_ticks(_tick_rate); _iface->poke32(REG_TIME_HI, uint32_t(ticks >> 32)); @@ -99,7 +99,7 @@ struct time_core_3000_impl : time_core_3000 _iface->poke32(REG_TIME_CTRL, CTRL_LATCH_TIME_SYNC); } - void set_time_next_pps(const uhd::time_spec_t& time) + void set_time_next_pps(const uhd::time_spec_t& time) override { const uint64_t ticks = time.to_ticks(_tick_rate); _iface->poke32(REG_TIME_HI, uint32_t(ticks >> 32)); diff --git a/host/lib/usrp/cores/tx_dsp_core_200.cpp b/host/lib/usrp/cores/tx_dsp_core_200.cpp index 8dd48181c..1c743b0b0 100644 --- a/host/lib/usrp/cores/tx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_200.cpp @@ -70,7 +70,7 @@ public: this->set_underflow_policy("next_packet"); } - void clear(void) + void clear(void) override { _iface->poke32(REG_TX_CTRL_CLEAR, 1); // reset and flush technique std::this_thread::sleep_for(std::chrono::milliseconds(10)); @@ -89,18 +89,18 @@ public: "USRP TX cannot handle requested underflow policy: " + policy); } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { _tick_rate = rate; } - void set_link_rate(const double rate) + void set_link_rate(const double rate) override { //_link_rate = rate/sizeof(uint32_t); //in samps/s _link_rate = rate / sizeof(uint16_t); // in samps/s (allows for 8sc) } - uhd::meta_range_t get_host_rates(void) + uhd::meta_range_t get_host_rates(void) override { meta_range_t range; for (int rate = 512; rate > 256; rate -= 4) { @@ -115,7 +115,7 @@ public: return range; } - double set_host_rate(const double rate) + double set_host_rate(const double rate) override { const size_t interp_rate = boost::math::iround(_tick_rate / this->get_host_rates().clip(rate, true)); @@ -165,12 +165,12 @@ public: _iface->poke32(REG_DSP_TX_SCALE_IQ, actual_scalar); } - double get_scaling_adjustment(void) + double get_scaling_adjustment(void) override { return _fxpt_scalar_correction * _host_extra_scaling * 32767.; } - double set_freq(const double requested_freq) + double set_freq(const double requested_freq) override { double actual_freq; int32_t freq_word; @@ -179,13 +179,13 @@ public: return actual_freq; } - uhd::meta_range_t get_freq_range(void) + uhd::meta_range_t get_freq_range(void) override { return uhd::meta_range_t( -_tick_rate / 2, +_tick_rate / 2, _tick_rate / std::pow(2.0, 32)); } - void set_updates(const size_t cycles_per_up, const size_t packets_per_up) + void set_updates(const size_t cycles_per_up, const size_t packets_per_up) override { _iface->poke32(REG_TX_CTRL_CYCLES_PER_UP, (cycles_per_up == 0) ? 0 : (FLAG_TX_CTRL_UP_ENB | cycles_per_up)); @@ -193,7 +193,7 @@ public: (packets_per_up == 0) ? 0 : (FLAG_TX_CTRL_UP_ENB | packets_per_up)); } - void setup(const uhd::stream_args_t& stream_args) + void setup(const uhd::stream_args_t& stream_args) override { if (not stream_args.args.has_key("noclear")) this->clear(); diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp index 3b0d85c00..f46938de3 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp @@ -46,19 +46,19 @@ public: this->set_tick_rate(1.0); } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { _tick_rate = rate; set_freq(_current_freq); } - void set_link_rate(const double rate) + void set_link_rate(const double rate) override { //_link_rate = rate/sizeof(uint32_t); //in samps/s _link_rate = rate / sizeof(uint16_t); // in samps/s (allows for 8sc) } - uhd::meta_range_t get_host_rates(void) + uhd::meta_range_t get_host_rates(void) override { meta_range_t range; for (int rate = 512; rate > 256; rate -= 4) { @@ -73,7 +73,7 @@ public: return range; } - double set_host_rate(const double rate) + double set_host_rate(const double rate) override { const size_t interp_rate = boost::math::iround(_tick_rate / this->get_host_rates().clip(rate, true)); @@ -128,12 +128,12 @@ public: _iface->poke32(REG_DSP_TX_SCALE_IQ, actual_scalar); } - double get_scaling_adjustment(void) + double get_scaling_adjustment(void) override { return _fxpt_scalar_correction * _host_extra_scaling * 32767.; } - double set_freq(const double requested_freq) + double set_freq(const double requested_freq) override { double actual_freq; int32_t freq_word; @@ -143,18 +143,18 @@ public: return actual_freq; } - double get_freq(void) + double get_freq(void) override { return _current_freq; } - uhd::meta_range_t get_freq_range(void) + uhd::meta_range_t get_freq_range(void) override { return uhd::meta_range_t( -_tick_rate / 2, +_tick_rate / 2, _tick_rate / std::pow(2.0, 32)); } - void setup(const uhd::stream_args_t& stream_args) + void setup(const uhd::stream_args_t& stream_args) override { if (stream_args.otw_format == "sc16") { _dsp_extra_scaling = 1.0; @@ -181,7 +181,7 @@ public: this->update_scalar(); } - void populate_subtree(property_tree::sptr subtree) + void populate_subtree(property_tree::sptr subtree) override { subtree->create<meta_range_t>("rate/range") .set_publisher(std::bind(&tx_dsp_core_3000::get_host_rates, this)); diff --git a/host/lib/usrp/cores/tx_frontend_core_200.cpp b/host/lib/usrp/cores/tx_frontend_core_200.cpp index 46a79c497..45b2045dd 100644 --- a/host/lib/usrp/cores/tx_frontend_core_200.cpp +++ b/host/lib/usrp/cores/tx_frontend_core_200.cpp @@ -51,7 +51,7 @@ public: // NOP } - void set_mux(const std::string& mode) + void set_mux(const std::string& mode) override { static const uhd::dict<std::string, uint32_t> mode_to_mux = boost::assign::map_list_of( @@ -63,7 +63,7 @@ public: _iface->poke32(REG_TX_FE_MUX, mode_to_mux[mode]); } - std::complex<double> set_dc_offset(const std::complex<double>& off) + std::complex<double> set_dc_offset(const std::complex<double>& off) override { static const double scaler = double(1ul << 23); const int32_t i_dc_off = boost::math::iround(off.real() * scaler); @@ -75,13 +75,13 @@ public: return std::complex<double>(i_dc_off / scaler, q_dc_off / scaler); } - void set_iq_balance(const std::complex<double>& cor) + void set_iq_balance(const std::complex<double>& cor) override { _iface->poke32(REG_TX_FE_MAG_CORRECTION, fs_to_bits(cor.real(), 18)); _iface->poke32(REG_TX_FE_PHASE_CORRECTION, fs_to_bits(cor.imag(), 18)); } - void populate_subtree(uhd::property_tree::sptr subtree) + void populate_subtree(uhd::property_tree::sptr subtree) override { subtree->create<uhd::meta_range_t>("dc_offset/range") .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX)); diff --git a/host/lib/usrp/cores/tx_vita_core_3000.cpp b/host/lib/usrp/cores/tx_vita_core_3000.cpp index c89301464..d586e2cfc 100644 --- a/host/lib/usrp/cores/tx_vita_core_3000.cpp +++ b/host/lib/usrp/cores/tx_vita_core_3000.cpp @@ -44,12 +44,12 @@ struct tx_vita_core_3000_impl : tx_vita_core_3000 this->clear(); } - ~tx_vita_core_3000_impl(void) + ~tx_vita_core_3000_impl(void) override { UHD_SAFE_CALL(this->clear();) } - void clear(void) + void clear(void) override { this->configure_flow_control(0, 0); this->set_underflow_policy(_policy); // clears the seq @@ -69,14 +69,15 @@ struct tx_vita_core_3000_impl : tx_vita_core_3000 _policy = policy; } - void setup(const uhd::stream_args_t& stream_args) + void setup(const uhd::stream_args_t& stream_args) override { if (stream_args.args.has_key("underflow_policy")) { this->set_underflow_policy(stream_args.args["underflow_policy"]); } } - void configure_flow_control(const size_t cycs_per_up, const size_t pkts_per_up) + void configure_flow_control( + const size_t cycs_per_up, const size_t pkts_per_up) override { if (cycs_per_up == 0) _iface->poke32(_fc_base + REG_CTRL_FC_CYCLE_OFFSET, 0); diff --git a/host/lib/usrp/cores/user_settings_core_200.cpp b/host/lib/usrp/cores/user_settings_core_200.cpp index c3606738a..abe1bee5f 100644 --- a/host/lib/usrp/cores/user_settings_core_200.cpp +++ b/host/lib/usrp/cores/user_settings_core_200.cpp @@ -26,7 +26,7 @@ public: // NOP } - void set_reg(const user_reg_t& reg) + void set_reg(const user_reg_t& reg) override { _iface->poke32(REG_USER_ADDR, reg.first); _iface->poke32(REG_USER_DATA, reg.second); diff --git a/host/lib/usrp/cores/user_settings_core_3000.cpp b/host/lib/usrp/cores/user_settings_core_3000.cpp index 7518756f7..9e04175c2 100644 --- a/host/lib/usrp/cores/user_settings_core_3000.cpp +++ b/host/lib/usrp/cores/user_settings_core_3000.cpp @@ -25,7 +25,7 @@ public: { } - void poke64(const wb_addr_type offset, const uint64_t value) + void poke64(const wb_addr_type offset, const uint64_t value) override { if (offset % sizeof(uint64_t) != 0) throw uhd::value_error("poke64: Incorrect address alignment"); @@ -33,7 +33,7 @@ public: poke32(offset + 4, static_cast<uint32_t>(value >> 32)); } - uint64_t peek64(const wb_addr_type offset) + uint64_t peek64(const wb_addr_type offset) override { if (offset % sizeof(uint64_t) != 0) throw uhd::value_error("peek64: Incorrect address alignment"); @@ -44,7 +44,7 @@ public: return _iface->peek64(_rb_reg_addr); } - void poke32(const wb_addr_type offset, const uint32_t value) + void poke32(const wb_addr_type offset, const uint32_t value) override { if (offset % sizeof(uint32_t) != 0) throw uhd::value_error("poke32: Incorrect address alignment"); @@ -55,7 +55,7 @@ public: _iface->poke32(REG_USER_SR_DATA, value); } - uint32_t peek32(const wb_addr_type offset) + uint32_t peek32(const wb_addr_type offset) override { if (offset % sizeof(uint32_t) != 0) throw uhd::value_error("peek32: Incorrect address alignment"); diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index 3282d53c3..d97220fde 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp @@ -28,7 +28,7 @@ class basic_rx : public rx_dboard_base { public: basic_rx(ctor_args_t args, double max_freq); - virtual ~basic_rx(void); + ~basic_rx(void) override; private: double _max_freq; @@ -38,7 +38,7 @@ class basic_tx : public tx_dboard_base { public: basic_tx(ctor_args_t args, double max_freq); - virtual ~basic_tx(void); + ~basic_tx(void) override; private: double _max_freq; diff --git a/host/lib/usrp/dboard/db_sbx_common.hpp b/host/lib/usrp/dboard/db_sbx_common.hpp index c11f0bbe2..235d45fd2 100644 --- a/host/lib/usrp/dboard/db_sbx_common.hpp +++ b/host/lib/usrp/dboard/db_sbx_common.hpp @@ -124,7 +124,7 @@ class sbx_xcvr : public xcvr_dboard_base { public: sbx_xcvr(ctor_args_t args); - virtual ~sbx_xcvr(void); + ~sbx_xcvr(void) override; protected: uhd::dict<std::string, double> _tx_gains, _rx_gains; @@ -182,9 +182,9 @@ protected: { public: sbx_version3(sbx_xcvr* _self_sbx_xcvr); - virtual ~sbx_version3(void); + ~sbx_version3(void) override; - double set_lo_freq(dboard_iface::unit_t unit, double target_freq); + double set_lo_freq(dboard_iface::unit_t unit, double target_freq) override; /*! This is the registered instance of the wrapper class, sbx_base. */ sbx_xcvr* self_base; @@ -204,9 +204,9 @@ protected: { public: sbx_version4(sbx_xcvr* _self_sbx_xcvr); - virtual ~sbx_version4(void); + ~sbx_version4(void) override; - double set_lo_freq(dboard_iface::unit_t unit, double target_freq); + double set_lo_freq(dboard_iface::unit_t unit, double target_freq) override; /*! This is the registered instance of the wrapper class, sbx_base. */ sbx_xcvr* self_base; @@ -231,9 +231,9 @@ protected: { public: cbx(sbx_xcvr* _self_sbx_xcvr); - virtual ~cbx(void); + ~cbx(void) override; - double set_lo_freq(dboard_iface::unit_t unit, double target_freq); + double set_lo_freq(dboard_iface::unit_t unit, double target_freq) override; /*! This is the registered instance of the wrapper class, sbx_base. */ sbx_xcvr* self_base; diff --git a/host/lib/usrp/dboard/db_twinrx.cpp b/host/lib/usrp/dboard/db_twinrx.cpp index a7c57979d..9aa67318b 100644 --- a/host/lib/usrp/dboard/db_twinrx.cpp +++ b/host/lib/usrp/dboard/db_twinrx.cpp @@ -247,7 +247,7 @@ public: _expert, prepend_ch("synth/LO2/mapping", _ch_name), MAPPING_NONE); } - virtual ~twinrx_rcvr_fe(void) {} + ~twinrx_rcvr_fe(void) override {} sensor_value_t get_lo_locked() { @@ -287,7 +287,7 @@ public: _expert = expert_factory::create_container("twinrx_expert"); } - virtual ~twinrx_rcvr(void) {} + ~twinrx_rcvr(void) override {} inline expert_container::sptr get_expert() { @@ -299,7 +299,7 @@ public: return _ctrl; } - virtual void initialize() + void initialize() override { //--------------------------------------------------------- // Add internal channel-agnostic data nodes to expert diff --git a/host/lib/usrp/dboard/db_wbx_common.hpp b/host/lib/usrp/dboard/db_wbx_common.hpp index e7beabd8b..63a40c504 100644 --- a/host/lib/usrp/dboard/db_wbx_common.hpp +++ b/host/lib/usrp/dboard/db_wbx_common.hpp @@ -95,7 +95,7 @@ class wbx_base : public xcvr_dboard_base { public: wbx_base(ctor_args_t args); - virtual ~wbx_base(void); + ~wbx_base(void) override; protected: virtual double set_rx_gain(double gain, const std::string& name); @@ -156,11 +156,11 @@ protected: { public: wbx_version2(wbx_base* _self_wbx_base); - virtual ~wbx_version2(void); + ~wbx_version2(void) override; - double set_tx_gain(double gain, const std::string& name); - void set_tx_enabled(bool enb); - double set_lo_freq(dboard_iface::unit_t unit, double target_freq); + double set_tx_gain(double gain, const std::string& name) override; + void set_tx_enabled(bool enb) override; + double set_lo_freq(dboard_iface::unit_t unit, double target_freq) override; }; /*! @@ -172,11 +172,11 @@ protected: { public: wbx_version3(wbx_base* _self_wbx_base); - virtual ~wbx_version3(void); + ~wbx_version3(void) override; - double set_tx_gain(double gain, const std::string& name); - void set_tx_enabled(bool enb); - double set_lo_freq(dboard_iface::unit_t unit, double target_freq); + double set_tx_gain(double gain, const std::string& name) override; + void set_tx_enabled(bool enb) override; + double set_lo_freq(dboard_iface::unit_t unit, double target_freq) override; }; /*! @@ -188,11 +188,11 @@ protected: { public: wbx_version4(wbx_base* _self_wbx_base); - virtual ~wbx_version4(void); + ~wbx_version4(void) override; - double set_tx_gain(double gain, const std::string& name); - void set_tx_enabled(bool enb); - double set_lo_freq(dboard_iface::unit_t unit, double target_freq); + double set_tx_gain(double gain, const std::string& name) override; + void set_tx_enabled(bool enb) override; + double set_lo_freq(dboard_iface::unit_t unit, double target_freq) override; }; /*! diff --git a/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp b/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp index 04fa800e2..0fe0ccd56 100644 --- a/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp +++ b/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp @@ -29,9 +29,9 @@ public: * Structors and deinit ***********************************************************************/ e31x_radio_control_impl(make_args_ptr make_args); - virtual ~e31x_radio_control_impl(); + ~e31x_radio_control_impl() override; - std::vector<std::string> get_gpio_banks() const + std::vector<std::string> get_gpio_banks() const override { return {E31x_GPIO_BANK}; } @@ -117,22 +117,22 @@ private: /************************************************************************ * E3XX API calls ***********************************************************************/ - const std::string get_default_timing_mode() + const std::string get_default_timing_mode() override { return TIMING_MODE_1R1T; }; uint32_t get_rx_switches( - const size_t chan, const double freq, const std::string& ant); + const size_t chan, const double freq, const std::string& ant) override; - uint32_t get_tx_switches(const size_t chan, const double freq); + uint32_t get_tx_switches(const size_t chan, const double freq) override; - uint32_t get_idle_switches(); + uint32_t get_idle_switches() override; - uint32_t get_tx_led(); - uint32_t get_rx_led(); - uint32_t get_txrx_led(); - uint32_t get_idle_led(); + uint32_t get_tx_led() override; + uint32_t get_rx_led() override; + uint32_t get_txrx_led() override; + uint32_t get_idle_led() override; }; }} /* namespace uhd::rfnoc */ diff --git a/host/lib/usrp/dboard/e3xx/e320_radio_control_impl.hpp b/host/lib/usrp/dboard/e3xx/e320_radio_control_impl.hpp index f781eb49d..7ba64b0ab 100644 --- a/host/lib/usrp/dboard/e3xx/e320_radio_control_impl.hpp +++ b/host/lib/usrp/dboard/e3xx/e320_radio_control_impl.hpp @@ -28,9 +28,9 @@ public: * Structors ***********************************************************************/ e320_radio_control_impl(make_args_ptr make_args); - virtual ~e320_radio_control_impl(); + ~e320_radio_control_impl() override; - std::vector<std::string> get_gpio_banks() const + std::vector<std::string> get_gpio_banks() const override { return {E320_GPIO_BANK}; } @@ -103,22 +103,22 @@ protected: /************************************************************************ * E3XX API calls ***********************************************************************/ - const std::string get_default_timing_mode() + const std::string get_default_timing_mode() override { return TIMING_MODE_2R2T; }; uint32_t get_rx_switches( - const size_t chan, const double freq, const std::string& ant); + const size_t chan, const double freq, const std::string& ant) override; - uint32_t get_tx_switches(const size_t chan, const double freq); + uint32_t get_tx_switches(const size_t chan, const double freq) override; - uint32_t get_idle_switches(); + uint32_t get_idle_switches() override; - uint32_t get_tx_led(); - uint32_t get_rx_led(); - uint32_t get_txrx_led(); - uint32_t get_idle_led(); + uint32_t get_tx_led() override; + uint32_t get_rx_led() override; + uint32_t get_txrx_led() override; + uint32_t get_idle_led() override; }; }} /* namespace uhd::rfnoc */ diff --git a/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp b/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp index acd0be211..108b94a80 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp @@ -21,94 +21,94 @@ public: _log_prefix, "Initialized controls with RPC prefix " << _rpc_prefix); } - double set_bw_filter(const std::string& which, const double bw) + double set_bw_filter(const std::string& which, const double bw) override { return _rpcc->request_with_token<double>( this->_rpc_prefix + "set_bw_filter", which, bw); } - double set_gain(const std::string& which, const double value) + double set_gain(const std::string& which, const double value) override { return _rpcc->request_with_token<double>( this->_rpc_prefix + "set_gain", which, value); } - void set_agc(const std::string& which, bool enable) + void set_agc(const std::string& which, bool enable) override { _rpcc->request_with_token<void>(this->_rpc_prefix + "set_agc", which, enable); } - void set_agc_mode(const std::string& which, const std::string& mode) + void set_agc_mode(const std::string& which, const std::string& mode) override { _rpcc->request_with_token<void>(this->_rpc_prefix + "set_agc_mode", which, mode); } - double set_clock_rate(const double rate) + double set_clock_rate(const double rate) override { return _rpcc->request_with_token<double>( E3XX_RATE_TIMEOUT, this->_rpc_prefix + "set_catalina_clock_rate", rate); } - void set_active_chains(bool tx1, bool tx2, bool rx1, bool rx2) + void set_active_chains(bool tx1, bool tx2, bool rx1, bool rx2) override { _rpcc->request_with_token<void>( this->_rpc_prefix + "set_active_chains", tx1, tx2, rx1, rx2); } - double tune(const std::string& which, const double value) + double tune(const std::string& which, const double value) override { return _rpcc->request_with_token<double>( E3XX_TUNE_TIMEOUT, this->_rpc_prefix + "catalina_tune", which, value); } - void set_dc_offset_auto(const std::string& which, const bool on) + void set_dc_offset_auto(const std::string& which, const bool on) override { _rpcc->request_with_token<void>( this->_rpc_prefix + "set_dc_offset_auto", which, on); } - void set_timing_mode(const std::string& timing_mode) + void set_timing_mode(const std::string& timing_mode) override { _rpcc->request_with_token<void>( this->_rpc_prefix + "set_timing_mode", timing_mode); } - void set_iq_balance_auto(const std::string& which, const bool on) + void set_iq_balance_auto(const std::string& which, const bool on) override { _rpcc->request_with_token<void>( this->_rpc_prefix + "set_iq_balance_auto", which, on); } - double get_freq(const std::string& which) + double get_freq(const std::string& which) override { return _rpcc->request_with_token<double>(this->_rpc_prefix + "get_freq", which); } - void data_port_loopback(const bool on) + void data_port_loopback(const bool on) override { _rpcc->request_with_token<void>(this->_rpc_prefix + "data_port_loopback", on); } - sensor_value_t get_rssi(const std::string& which) + sensor_value_t get_rssi(const std::string& which) override { return sensor_value_t(_rpcc->request_with_token<sensor_value_t::sensor_map_t>( this->_rpc_prefix + "get_rssi", which)); } - sensor_value_t get_temperature() + sensor_value_t get_temperature() override { return sensor_value_t(_rpcc->request_with_token<sensor_value_t::sensor_map_t>( this->_rpc_prefix + "get_temperature")); } - std::vector<std::string> get_filter_names(const std::string& which) + std::vector<std::string> get_filter_names(const std::string& which) override { return _rpcc->request_with_token<std::vector<std::string>>( this->_rpc_prefix + "get_filter_names", which); } filter_info_base::sptr get_filter( - const std::string& /*which*/, const std::string& /*filter_name*/) + const std::string& /*which*/, const std::string& /*filter_name*/) override { throw uhd::runtime_error( "ad9361_ctrl::get_filter is not supported over an RPC connection"); @@ -116,13 +116,13 @@ public: void set_filter(const std::string& /*which*/, const std::string& /*filter_name*/, - const filter_info_base::sptr /*filter*/) + const filter_info_base::sptr /*filter*/) override { throw uhd::runtime_error( "ad9361_ctrl::set_filter is not supported over an RPC connection"); } - void output_digital_test_tone(bool enb) + void output_digital_test_tone(bool enb) override { _rpcc->request_with_token<void>( this->_rpc_prefix + "output_digital_test_tone", enb); diff --git a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp index d5714634c..658edc987 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp @@ -71,90 +71,94 @@ public: * Structors ***********************************************************************/ e3xx_radio_control_impl(make_args_ptr make_args); - virtual ~e3xx_radio_control_impl(); + ~e3xx_radio_control_impl() override; /************************************************************************ * node_t && noc_block_base API calls ***********************************************************************/ - void deinit(); + void deinit() override; bool check_topology(const std::vector<size_t>& connected_inputs, - const std::vector<size_t>& connected_outputs); + const std::vector<size_t>& connected_outputs) override; /************************************************************************ * radio_control API calls ***********************************************************************/ - double set_rate(const double rate); - uhd::meta_range_t get_rate_range() const; + double set_rate(const double rate) override; + uhd::meta_range_t get_rate_range() const override; // Setters - void set_tx_antenna(const std::string& ant, const size_t chan); - void set_rx_antenna(const std::string& ant, const size_t chan); - double set_tx_frequency(const double freq, const size_t chan); - double set_rx_frequency(const double freq, const size_t chan); - double set_tx_gain(const double gain, const size_t chan); - double set_rx_gain(const double gain, const size_t chan); - void set_rx_agc(const bool enable, const size_t chan); - double set_tx_bandwidth(const double bandwidth, const size_t chan); - double set_rx_bandwidth(const double bandwidth, const size_t chan); + void set_tx_antenna(const std::string& ant, const size_t chan) override; + void set_rx_antenna(const std::string& ant, const size_t chan) override; + double set_tx_frequency(const double freq, const size_t chan) override; + double set_rx_frequency(const double freq, const size_t chan) override; + double set_tx_gain(const double gain, const size_t chan) override; + double set_rx_gain(const double gain, const size_t chan) override; + void set_rx_agc(const bool enable, const size_t chan) override; + double set_tx_bandwidth(const double bandwidth, const size_t chan) override; + double set_rx_bandwidth(const double bandwidth, const size_t chan) override; // Getters - std::vector<std::string> get_tx_antennas(const size_t chan) const; - std::vector<std::string> get_rx_antennas(const size_t chan) const; - uhd::freq_range_t get_tx_frequency_range(const size_t chan) const; - uhd::freq_range_t get_rx_frequency_range(const size_t chan) const; - uhd::gain_range_t get_tx_gain_range(const size_t) const; - uhd::gain_range_t get_rx_gain_range(const size_t) const; - meta_range_t get_tx_bandwidth_range(size_t chan) const; - meta_range_t get_rx_bandwidth_range(size_t chan) const; + std::vector<std::string> get_tx_antennas(const size_t chan) const override; + std::vector<std::string> get_rx_antennas(const size_t chan) const override; + uhd::freq_range_t get_tx_frequency_range(const size_t chan) const override; + uhd::freq_range_t get_rx_frequency_range(const size_t chan) const override; + uhd::gain_range_t get_tx_gain_range(const size_t) const override; + uhd::gain_range_t get_rx_gain_range(const size_t) const override; + meta_range_t get_tx_bandwidth_range(size_t chan) const override; + meta_range_t get_rx_bandwidth_range(size_t chan) const override; /************************************************************************** * Calibration-Related API Calls *************************************************************************/ - virtual void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS); - virtual void set_rx_iq_balance(const bool enb, size_t chan); + void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) override; + void set_rx_iq_balance(const bool enb, size_t chan) override; /************************************************************************** * GPIO Controls *************************************************************************/ - virtual void set_gpio_attr( - const std::string& bank, const std::string& attr, const uint32_t value); - virtual uint32_t get_gpio_attr(const std::string& bank, const std::string& attr); + void set_gpio_attr( + const std::string& bank, const std::string& attr, const uint32_t value) override; + uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) override; /************************************************************************** * Sensor API *************************************************************************/ - std::vector<std::string> get_rx_sensor_names(size_t chan) const; - uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan); - std::vector<std::string> get_tx_sensor_names(size_t chan) const; - uhd::sensor_value_t get_tx_sensor(const std::string& name, 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) const override; + uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) override; /************************************************************************** * Filter API *************************************************************************/ - std::vector<std::string> get_rx_filter_names(const size_t chan) const; - uhd::filter_info_base::sptr get_rx_filter(const std::string& name, const size_t chan); - void set_rx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan); - - std::vector<std::string> get_tx_filter_names(const size_t chan) const; - uhd::filter_info_base::sptr get_tx_filter(const std::string& name, const size_t chan); - void set_tx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan); + std::vector<std::string> get_rx_filter_names(const size_t chan) const override; + uhd::filter_info_base::sptr get_rx_filter( + const std::string& name, const size_t chan) override; + void set_rx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) override; + + std::vector<std::string> get_tx_filter_names(const size_t chan) const override; + uhd::filter_info_base::sptr get_tx_filter( + const std::string& name, const size_t chan) override; + void set_tx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) override; /************************************************************************** * Radio Identification API Calls *************************************************************************/ - std::string get_slot_name() const + std::string get_slot_name() const override { return "A"; } - virtual size_t get_chan_from_dboard_fe( - const std::string& fe, const uhd::direction_t direction) const; - virtual std::string get_dboard_fe_from_chan( - const size_t chan, const uhd::direction_t direction) const; - virtual std::string get_fe_name( - const size_t chan, const uhd::direction_t direction) const; + size_t get_chan_from_dboard_fe( + const std::string& fe, const uhd::direction_t direction) const override; + std::string get_dboard_fe_from_chan( + const size_t chan, const uhd::direction_t direction) const override; + std::string get_fe_name( + const size_t chan, const uhd::direction_t direction) const override; protected: //! Map a frequency in Hz to an rx_band value. Will return @@ -239,9 +243,9 @@ private: void _set_atr_bits(const size_t chan); - void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom); + void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) override; - uhd::eeprom_map_t get_db_eeprom(); + uhd::eeprom_map_t get_db_eeprom() override; /************************************************************************** * Private attributes diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp index e8c252605..897e00868 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.hpp @@ -67,99 +67,107 @@ public: * Structors ***********************************************************************/ magnesium_radio_control_impl(make_args_ptr make_args); - virtual ~magnesium_radio_control_impl(); + ~magnesium_radio_control_impl() override; /************************************************************************ * RF API calls ***********************************************************************/ // Note: We use the cached values in radio_ctrl_impl, so most getters are // not reimplemented here - double set_rate(double rate); + double set_rate(double rate) override; // Setters - void set_tx_antenna(const std::string& ant, const size_t chan); - void set_rx_antenna(const std::string& ant, const size_t chan); - double set_tx_frequency(const double freq, const size_t chan); - double set_rx_frequency(const double freq, const size_t chan); - double set_tx_gain(const double gain, const size_t chan); - double set_tx_gain(const double gain, const std::string& name, const size_t chan); - double set_rx_gain(const double gain, const size_t chan); - double set_rx_gain(const double gain, const std::string& name, const size_t chan); - double set_tx_bandwidth(const double bandwidth, const size_t chan); - double set_rx_bandwidth(const double bandwidth, const size_t chan); + void set_tx_antenna(const std::string& ant, const size_t chan) override; + void set_rx_antenna(const std::string& ant, const size_t chan) override; + double set_tx_frequency(const double freq, const size_t chan) override; + double set_rx_frequency(const double freq, const size_t chan) override; + double set_tx_gain(const double gain, const size_t chan) override; + double set_tx_gain( + const double gain, const std::string& name, const size_t chan) override; + double set_rx_gain(const double gain, const size_t chan) override; + double set_rx_gain( + const double gain, const std::string& name, const size_t chan) override; + double set_tx_bandwidth(const double bandwidth, const size_t chan) override; + double set_rx_bandwidth(const double bandwidth, const size_t chan) override; // Getters - std::vector<std::string> get_tx_antennas(const size_t chan) const; - std::vector<std::string> get_rx_antennas(const size_t chan) const; - uhd::freq_range_t get_tx_frequency_range(const size_t chan) const; - uhd::freq_range_t get_rx_frequency_range(const size_t chan) const; - std::vector<std::string> get_tx_gain_names(const size_t) const; - std::vector<std::string> get_rx_gain_names(const size_t) const; - double get_tx_gain(const std::string&, size_t); - double get_rx_gain(const std::string&, size_t); - uhd::gain_range_t get_tx_gain_range(const size_t) const; - uhd::gain_range_t get_tx_gain_range(const std::string&, const size_t) const; - uhd::gain_range_t get_rx_gain_range(const size_t) const; - uhd::gain_range_t get_rx_gain_range(const std::string&, const size_t) const; - uhd::meta_range_t get_tx_bandwidth_range(size_t chan) const; - uhd::meta_range_t get_rx_bandwidth_range(size_t chan) const; + std::vector<std::string> get_tx_antennas(const size_t chan) const override; + std::vector<std::string> get_rx_antennas(const size_t chan) const override; + uhd::freq_range_t get_tx_frequency_range(const size_t chan) const override; + uhd::freq_range_t get_rx_frequency_range(const size_t chan) const override; + std::vector<std::string> get_tx_gain_names(const size_t) const override; + std::vector<std::string> get_rx_gain_names(const size_t) const override; + double get_tx_gain(const std::string&, size_t) override; + double get_rx_gain(const std::string&, size_t) override; + uhd::gain_range_t get_tx_gain_range(const size_t) const override; + uhd::gain_range_t get_tx_gain_range(const std::string&, const size_t) const override; + uhd::gain_range_t get_rx_gain_range(const size_t) const override; + uhd::gain_range_t get_rx_gain_range(const std::string&, const size_t) const override; + uhd::meta_range_t get_tx_bandwidth_range(size_t chan) const override; + uhd::meta_range_t get_rx_bandwidth_range(size_t chan) const override; /************************************************************************** * LO Controls *************************************************************************/ - std::vector<std::string> get_rx_lo_names(const size_t chan) const; + std::vector<std::string> get_rx_lo_names(const size_t chan) const override; std::vector<std::string> get_rx_lo_sources( - const std::string& name, const size_t chan) const; - freq_range_t get_rx_lo_freq_range(const std::string& name, const size_t chan) const; + const std::string& name, const size_t chan) const override; + freq_range_t get_rx_lo_freq_range( + 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); + 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; - double set_rx_lo_freq(double freq, const std::string& name, const size_t chan); - double get_rx_lo_freq(const std::string& name, const size_t chan); - std::vector<std::string> get_tx_lo_names(const size_t chan) const; + 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; - freq_range_t get_tx_lo_freq_range(const std::string& name, const size_t chan); + freq_range_t get_tx_lo_freq_range( + const std::string& name, const size_t chan) override; void set_tx_lo_source( - const std::string& src, const std::string& name, const size_t chan); - const std::string get_tx_lo_source(const std::string& name, const size_t chan); - double set_tx_lo_freq(const double freq, const std::string& name, const size_t chan); - double get_tx_lo_freq(const std::string& name, const size_t chan); + const std::string& src, const std::string& name, const size_t chan) override; + const std::string get_tx_lo_source( + const std::string& name, const size_t chan) override; + double set_tx_lo_freq( + const double freq, const std::string& name, const size_t chan) override; + double get_tx_lo_freq(const std::string& name, const size_t chan) override; /************************************************************************** * GPIO Controls *************************************************************************/ - std::vector<std::string> get_gpio_banks() const; + std::vector<std::string> get_gpio_banks() const override; void set_gpio_attr( - const std::string& bank, const std::string& attr, const uint32_t value); - uint32_t get_gpio_attr(const std::string& bank, const std::string& attr); + const std::string& bank, const std::string& attr, const uint32_t value) override; + uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) override; /************************************************************************** * EEPROM API *************************************************************************/ - void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom); - uhd::eeprom_map_t get_db_eeprom(); + void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) override; + uhd::eeprom_map_t get_db_eeprom() override; /************************************************************************** * Sensor API *************************************************************************/ std::vector<std::string> get_rx_sensor_names(size_t chan); - uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan); + 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); - uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan); + uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) override; /************************************************************************** * Radio Identification API Calls *************************************************************************/ - std::string get_slot_name() const + std::string get_slot_name() const override { return _radio_slot; } size_t get_chan_from_dboard_fe( - const std::string& fe, const uhd::direction_t direction) const; + const std::string& fe, const uhd::direction_t direction) const override; std::string get_dboard_fe_from_chan( - const size_t chan, const uhd::direction_t direction) const; - std::string get_fe_name(const size_t chan, const uhd::direction_t direction) const; + const size_t chan, const uhd::direction_t direction) const override; + std::string get_fe_name( + const size_t chan, const uhd::direction_t direction) const override; private: /************************************************************************** diff --git a/host/lib/usrp/dboard/rhodium/rhodium_radio_control.hpp b/host/lib/usrp/dboard/rhodium/rhodium_radio_control.hpp index 1d33f0357..4d5ce2cbd 100644 --- a/host/lib/usrp/dboard/rhodium/rhodium_radio_control.hpp +++ b/host/lib/usrp/dboard/rhodium/rhodium_radio_control.hpp @@ -61,98 +61,105 @@ public: * Structors ***********************************************************************/ rhodium_radio_control_impl(make_args_ptr make_args); - virtual ~rhodium_radio_control_impl(); + ~rhodium_radio_control_impl() override; /************************************************************************ * RF API calls ***********************************************************************/ // Note: We use the cached values in radio_ctrl_impl, so most getters are // not reimplemented here - double set_rate(double rate); + double set_rate(double rate) override; // Setters - void set_tx_antenna(const std::string& ant, const size_t chan); - void set_rx_antenna(const std::string& ant, const size_t chan); - double set_tx_frequency(const double freq, const size_t chan); - double set_rx_frequency(const double freq, const size_t chan); - void set_tx_tune_args(const uhd::device_addr_t&, const size_t chan); - void set_rx_tune_args(const uhd::device_addr_t&, const size_t chan); - double set_tx_gain(const double gain, const size_t chan); - double set_rx_gain(const double gain, const size_t chan); + void set_tx_antenna(const std::string& ant, const size_t chan) override; + void set_rx_antenna(const std::string& ant, const size_t chan) override; + double set_tx_frequency(const double freq, const size_t chan) override; + double set_rx_frequency(const double freq, const size_t chan) override; + void set_tx_tune_args(const uhd::device_addr_t&, const size_t chan) override; + void set_rx_tune_args(const uhd::device_addr_t&, const size_t chan) override; + double set_tx_gain(const double gain, const size_t chan) override; + double set_rx_gain(const double gain, const size_t chan) override; // Getters - std::vector<std::string> get_tx_antennas(const size_t) const; - std::vector<std::string> get_rx_antennas(const size_t) const; - uhd::freq_range_t get_tx_frequency_range(const size_t) const; - uhd::freq_range_t get_rx_frequency_range(const size_t) const; - uhd::gain_range_t get_tx_gain_range(const size_t) const; - uhd::gain_range_t get_rx_gain_range(const size_t) const; - uhd::meta_range_t get_tx_bandwidth_range(size_t) const; - uhd::meta_range_t get_rx_bandwidth_range(size_t) const; + std::vector<std::string> get_tx_antennas(const size_t) const override; + std::vector<std::string> get_rx_antennas(const size_t) const override; + uhd::freq_range_t get_tx_frequency_range(const size_t) const override; + uhd::freq_range_t get_rx_frequency_range(const size_t) const override; + uhd::gain_range_t get_tx_gain_range(const size_t) const override; + uhd::gain_range_t get_rx_gain_range(const size_t) const override; + uhd::meta_range_t get_tx_bandwidth_range(size_t) const override; + uhd::meta_range_t get_rx_bandwidth_range(size_t) const override; /************************************************************************** * LO Controls *************************************************************************/ - std::vector<std::string> get_rx_lo_names(const size_t chan) const; + std::vector<std::string> get_rx_lo_names(const size_t chan) const override; std::vector<std::string> get_rx_lo_sources( - const std::string& name, const size_t chan) const; - freq_range_t get_rx_lo_freq_range(const std::string& name, const size_t chan) const; + const std::string& name, const size_t chan) const override; + freq_range_t get_rx_lo_freq_range( + 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); - const std::string get_rx_lo_source(const std::string& name, const size_t chan); - double set_rx_lo_freq(double freq, const std::string& name, const size_t chan); - double get_rx_lo_freq(const std::string& name, const size_t chan); - std::vector<std::string> get_tx_lo_names(const size_t chan) const; + 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) 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; - freq_range_t get_tx_lo_freq_range(const std::string& name, const size_t chan); + freq_range_t get_tx_lo_freq_range( + const std::string& name, const size_t chan) override; void set_tx_lo_source( - const std::string& src, const std::string& name, const size_t chan); - const std::string get_tx_lo_source(const std::string& name, const size_t chan); - double set_tx_lo_freq(const double freq, const std::string& name, const size_t chan); - double get_tx_lo_freq(const std::string& name, const size_t chan); + const std::string& src, const std::string& name, const size_t chan) override; + const std::string get_tx_lo_source( + const std::string& name, const size_t chan) override; + double set_tx_lo_freq( + const double freq, const std::string& name, const size_t chan) override; + double get_tx_lo_freq(const std::string& name, const size_t chan) override; // LO Export Control void set_tx_lo_export_enabled( - const bool enabled, const std::string& name, const size_t chan); + const bool enabled, const std::string& name, const size_t chan) override; void set_rx_lo_export_enabled( - const bool enabled, const std::string& name, const size_t chan); - bool get_tx_lo_export_enabled(const std::string& name, const size_t chan); + const bool enabled, const std::string& name, const size_t chan) override; + bool get_tx_lo_export_enabled(const std::string& name, const size_t chan) override; bool get_rx_lo_export_enabled(const std::string& name, const size_t chan); /************************************************************************** * GPIO Controls *************************************************************************/ - std::vector<std::string> get_gpio_banks() const; + std::vector<std::string> get_gpio_banks() const override; void set_gpio_attr( - const std::string& bank, const std::string& attr, const uint32_t value); - uint32_t get_gpio_attr(const std::string& bank, const std::string& attr); + const std::string& bank, const std::string& attr, const uint32_t value) override; + uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) override; /************************************************************************** * EEPROM API *************************************************************************/ - void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom); - uhd::eeprom_map_t get_db_eeprom(); + void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) override; + uhd::eeprom_map_t get_db_eeprom() override; /************************************************************************** * Sensor API *************************************************************************/ - std::vector<std::string> get_rx_sensor_names(size_t chan) const; - uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan); - std::vector<std::string> get_tx_sensor_names(size_t chan) const; - uhd::sensor_value_t get_tx_sensor(const std::string& name, 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) const override; + uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) override; /************************************************************************** * Radio Identification API Calls *************************************************************************/ - std::string get_slot_name() const + std::string get_slot_name() const override { return _radio_slot; } size_t get_chan_from_dboard_fe( - const std::string& fe, const uhd::direction_t direction) const; + const std::string& fe, const uhd::direction_t direction) const override; std::string get_dboard_fe_from_chan( - const size_t chan, const uhd::direction_t direction) const; - std::string get_fe_name(const size_t chan, const uhd::direction_t direction) const; + const size_t chan, const uhd::direction_t direction) const override; + std::string get_fe_name( + const size_t chan, const uhd::direction_t direction) const override; /************************************************************************ * ??? calls @@ -201,7 +208,7 @@ private: //! Safely shut down all peripherals // // Reminder: After this is called, no peeks and pokes are allowed! - void deinit() + void deinit() override { RFNOC_LOG_TRACE("deinit()"); // Remove access to all peripherals diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp index 9d2269916..0d5fea42c 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp @@ -77,7 +77,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs experts::data_reader_t<time_spec_t> _command_time; @@ -126,7 +126,7 @@ public: } private: - virtual void resolve(); + void resolve() override; static lo_inj_side_t _compute_lo2_inj_side( double lo1_freq, double if1_freq, double if2_freq, double bandwidth); static bool _has_mixer_spurs(double lo1_freq, @@ -189,7 +189,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs experts::data_reader_t<std::string> _lo_source_ch0; @@ -240,7 +240,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs experts::data_reader_t<twinrx_ctrl::lo_source_t> _lox_src_ch0; @@ -282,7 +282,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs experts::data_reader_t<double> _lo1_freq_c; @@ -331,7 +331,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs const std::string _channel; @@ -390,7 +390,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs experts::data_reader_t<std::string> _antenna_ch0; @@ -449,7 +449,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs experts::data_reader_t<double> _gain; @@ -519,7 +519,7 @@ public: } private: - virtual void resolve(); + void resolve() override; // Inputs experts::data_reader_t<twinrx_ctrl::antenna_mapping_t> _ant_mapping; @@ -610,7 +610,7 @@ public: } private: - virtual void resolve(); + void resolve() override; void _resolve_lox_freq(lo_stage_t lo_stage, experts::data_reader_t<double>& ch0_freq_d, experts::data_reader_t<double>& ch1_freq_d, diff --git a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp index 2949138dd..538b0bfa8 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp @@ -88,7 +88,7 @@ public: _db_iface->set_gpio_out(dboard_iface::UNIT_BOTH, 0, ~GPIO_PINCTRL_MASK); } - ~twinrx_gpio() + ~twinrx_gpio() override { _db_iface->set_gpio_ddr(dboard_iface::UNIT_BOTH, ~GPIO_OUTPUT_MASK, SET_ALL_BITS); } @@ -111,7 +111,7 @@ public: } // CPLD register write-only interface - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { boost::lock_guard<boost::mutex> lock(_mutex); using namespace soft_reg_field; diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index dc7ca6ac9..4fe3e8a00 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -198,19 +198,19 @@ public: dboard_iface::sptr iface, property_tree::sptr subtree, bool defer_db_init); - virtual ~dboard_manager_impl(void); + ~dboard_manager_impl(void) override; - inline const std::vector<std::string>& get_rx_frontends() const + inline const std::vector<std::string>& get_rx_frontends() const override { return _rx_frontends; } - inline const std::vector<std::string>& get_tx_frontends() const + inline const std::vector<std::string>& get_tx_frontends() const override { return _tx_frontends; } - void initialize_dboards(); + void initialize_dboards() override; private: void init(dboard_eeprom_t, dboard_eeprom_t, property_tree::sptr, bool); diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index 60866b85e..bcf938863 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -248,20 +248,20 @@ public: update_cache(); } - ~gps_ctrl_impl(void) + ~gps_ctrl_impl(void) override { /* NOP */ } // return a list of supported sensors - std::vector<std::string> get_sensors(void) + std::vector<std::string> get_sensors(void) override { std::vector<std::string> ret{ "gps_gpgga", "gps_gprmc", "gps_time", "gps_locked", "gps_servo"}; return ret; } - uhd::sensor_value_t get_sensor(std::string key) + uhd::sensor_value_t get_sensor(std::string key) override { if (key == "gps_gpgga" or key == "gps_gprmc") { return sensor_value_t(boost::to_upper_copy(key), @@ -333,7 +333,7 @@ private: std::string datestr = get_token(reply, 9); std::string timestr = get_token(reply, 1); - if (datestr.size() == 0 or timestr.size() == 0) { + if (datestr.empty() or timestr.empty()) { throw uhd::value_error( str(boost::format("Invalid response \"%s\"") % reply)); } @@ -368,7 +368,7 @@ private: return (get_time() - from_time_t(0)).total_seconds(); } - bool gps_detected(void) + bool gps_detected(void) override { return (_gps_type != GPS_TYPE_NONE); } diff --git a/host/lib/usrp/mpmd/mpmd_find.cpp b/host/lib/usrp/mpmd/mpmd_find.cpp index 5d5aab1ba..97e6fab80 100644 --- a/host/lib/usrp/mpmd/mpmd_find.cpp +++ b/host/lib/usrp/mpmd/mpmd_find.cpp @@ -160,7 +160,7 @@ device_addrs_t mpmd_find_with_addrs(const device_addrs_t& hints) UHD_LOG_TRACE("MPMD FIND", "Device responded: " << reply_addrs[0].to_string()); found_devices.push_back(reply_addrs[0]); } - if (found_devices.size() == 0) { + if (found_devices.empty()) { return device_addrs_t(); } else if (found_devices.size() == 1) { return found_devices; diff --git a/host/lib/usrp/mpmd/mpmd_impl.hpp b/host/lib/usrp/mpmd/mpmd_impl.hpp index 5b19bcc00..a8d7909e0 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.hpp +++ b/host/lib/usrp/mpmd/mpmd_impl.hpp @@ -222,12 +222,12 @@ public: * Structors ************************************************************************/ mpmd_impl(const uhd::device_addr_t& device_addr); - ~mpmd_impl(); + ~mpmd_impl() override; /************************************************************************** * API ************************************************************************/ - uhd::rfnoc::mb_iface& get_mb_iface(const size_t mb_idx) + uhd::rfnoc::mb_iface& get_mb_iface(const size_t mb_idx) override { if (mb_idx >= _mb.size()) { throw uhd::index_error( diff --git a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp index 56557bc39..dcb5d3473 100644 --- a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp +++ b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp @@ -82,13 +82,12 @@ std::vector<std::string> get_addrs_from_mb_args(const uhd::device_addr_t& mb_arg const mpmd_link_if_ctrl_udp::udp_link_info_map& link_info_list) { std::vector<std::string> addrs; - if(link_info_list.size() > 0 && - link_info_list.begin()->second.link_type == "internal") { + if (!link_info_list.empty() + && link_info_list.begin()->second.link_type == "internal") { // If link_type is "internal" we are local. In this case // use this address always. MPM knows better than us. addrs.push_back(link_info_list.begin()->first); - } - else { + } else { if (mb_args.has_key(FIRST_ADDR_KEY)) { addrs.push_back(mb_args[FIRST_ADDR_KEY]); } @@ -97,10 +96,9 @@ std::vector<std::string> get_addrs_from_mb_args(const uhd::device_addr_t& mb_arg } } if(addrs.empty()) { - if(link_info_list.size() > 0) { + if (!link_info_list.empty()) { addrs.push_back(link_info_list.begin()->first); - } - else { + } else { UHD_LOG_WARNING("MPMD::XPORT::UDP", "The `" << FIRST_ADDR_KEY << "' key must be specified in " diff --git a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp index 13d28e42b..876109aa4 100644 --- a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp +++ b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp @@ -36,16 +36,16 @@ public: const mpmd_link_if_mgr::xport_info_list_t& xport_info, const uhd::rfnoc::chdr_w_t chdr_w); - size_t get_num_links() const; + size_t get_num_links() const override; uhd::transport::both_links_t get_link(const size_t link_idx, const uhd::transport::link_type_t link_type, - const uhd::device_addr_t& link_args); - size_t get_mtu(const uhd::direction_t) const + const uhd::device_addr_t& link_args) override; + size_t get_mtu(const uhd::direction_t) const override { return _mtu; } - double get_link_rate(const size_t link_idx) const; - const uhd::rfnoc::chdr::chdr_packet_factory& get_packet_factory() const; + double get_link_rate(const size_t link_idx) const override; + const uhd::rfnoc::chdr::chdr_packet_factory& get_packet_factory() const override; private: const uhd::device_addr_t _mb_args; diff --git a/host/lib/usrp/mpmd/mpmd_link_if_mgr.cpp b/host/lib/usrp/mpmd/mpmd_link_if_mgr.cpp index 558570257..2b27e83cb 100644 --- a/host/lib/usrp/mpmd/mpmd_link_if_mgr.cpp +++ b/host/lib/usrp/mpmd/mpmd_link_if_mgr.cpp @@ -35,7 +35,7 @@ public: *************************************************************************/ bool connect(const std::string& link_type, const xport_info_list_t& xport_info, - const uhd::rfnoc::chdr_w_t chdr_w) + const uhd::rfnoc::chdr_w_t chdr_w) override { auto link_if_ctrl = make_link_if_ctrl(link_type, xport_info, chdr_w); if (!link_if_ctrl) { @@ -57,14 +57,14 @@ public: return true; } - size_t get_num_links() + size_t get_num_links() override { return _link_link_if_ctrl_map.size(); } uhd::transport::both_links_t get_link(const size_t link_idx, const uhd::transport::link_type_t link_type, - const uhd::device_addr_t& link_args) + const uhd::device_addr_t& link_args) override { const size_t link_if_ctrl_idx = _link_link_if_ctrl_map.at(link_idx).first; const size_t xport_link_idx = _link_link_if_ctrl_map.at(link_idx).second; @@ -72,13 +72,13 @@ public: ->get_link(xport_link_idx, link_type, link_args); } - size_t get_mtu(const size_t link_idx, const uhd::direction_t dir) const + size_t get_mtu(const size_t link_idx, const uhd::direction_t dir) const override { return _link_if_ctrls.at(_link_link_if_ctrl_map.at(link_idx).first)->get_mtu(dir); } const uhd::rfnoc::chdr::chdr_packet_factory& get_packet_factory( - const size_t link_idx) const + const size_t link_idx) const override { const size_t link_if_ctrl_idx = _link_link_if_ctrl_map.at(link_idx).first; return _link_if_ctrls.at(link_if_ctrl_idx)->get_packet_factory(); diff --git a/host/lib/usrp/mpmd/mpmd_mb_iface.hpp b/host/lib/usrp/mpmd/mpmd_mb_iface.hpp index 4e54cfc12..f1b7285ec 100644 --- a/host/lib/usrp/mpmd/mpmd_mb_iface.hpp +++ b/host/lib/usrp/mpmd/mpmd_mb_iface.hpp @@ -22,24 +22,26 @@ public: using uptr = std::unique_ptr<mpmd_mb_iface>; using clock_iface_list_t = std::vector<std::map<std::string, std::string>>; mpmd_mb_iface(const uhd::device_addr_t& mb_args, uhd::rpc_client::sptr rpc); - ~mpmd_mb_iface() = default; + ~mpmd_mb_iface() override = default; /*** mpmd_mb_iface API calls *****************************************/ //! Initialize transports void init(); /*** mb_iface API calls **********************************************/ - uint16_t get_proto_ver(); - uhd::rfnoc::chdr_w_t get_chdr_w(); - uhd::endianness_t get_endianness(const uhd::rfnoc::device_id_t local_device_id); - uhd::rfnoc::device_id_t get_remote_device_id(); - std::vector<uhd::rfnoc::device_id_t> get_local_device_ids(); + uint16_t get_proto_ver() override; + uhd::rfnoc::chdr_w_t get_chdr_w() override; + uhd::endianness_t get_endianness( + const uhd::rfnoc::device_id_t local_device_id) override; + uhd::rfnoc::device_id_t get_remote_device_id() override; + std::vector<uhd::rfnoc::device_id_t> get_local_device_ids() override; uhd::transport::adapter_id_t get_adapter_id( - const uhd::rfnoc::device_id_t local_device_id); - void reset_network(); - uhd::rfnoc::clock_iface::sptr get_clock_iface(const std::string& clock_name); + const uhd::rfnoc::device_id_t local_device_id) override; + void reset_network() override; + uhd::rfnoc::clock_iface::sptr get_clock_iface(const std::string& clock_name) override; uhd::rfnoc::chdr_ctrl_xport::sptr make_ctrl_transport( - uhd::rfnoc::device_id_t local_device_id, const uhd::rfnoc::sep_id_t& local_epid); + uhd::rfnoc::device_id_t local_device_id, + const uhd::rfnoc::sep_id_t& local_epid) override; uhd::rfnoc::chdr_rx_data_xport::uptr make_rx_data_transport( uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal, const uhd::rfnoc::sep_addr_pair_t& addrs, @@ -47,7 +49,7 @@ public: const uhd::rfnoc::sw_buff_t pyld_buff_fmt, const uhd::rfnoc::sw_buff_t mdata_buff_fmt, const uhd::device_addr_t& xport_args, - const std::string& streamer_id); + const std::string& streamer_id) override; uhd::rfnoc::chdr_tx_data_xport::uptr make_tx_data_transport( uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal, const uhd::rfnoc::sep_addr_pair_t& addrs, @@ -55,7 +57,7 @@ public: const uhd::rfnoc::sw_buff_t pyld_buff_fmt, const uhd::rfnoc::sw_buff_t mdata_buff_fmt, const uhd::device_addr_t& xport_args, - const std::string& streamer_id); + const std::string& streamer_id) override; private: uhd::device_addr_t _mb_args; diff --git a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp index ac620f3e0..6e67b4b7e 100644 --- a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp @@ -293,7 +293,7 @@ mpmd_mboard_impl::mpmd_mboard_impl( UHD_LOG_DEBUG("MPMD", "MPM reports device info: " << device_info.to_string()); /// Get dboard info const auto dboards_info = rpc->request<std::vector<dev_info>>("get_dboard_info"); - UHD_ASSERT_THROW(this->dboard_info.size() == 0); + UHD_ASSERT_THROW(this->dboard_info.empty()); for (const auto& dboard_info_dict : dboards_info) { uhd::device_addr_t this_db_info; for (const auto& info_pair : dboard_info_dict) { diff --git a/host/lib/usrp/mpmd/sim_find.cpp b/host/lib/usrp/mpmd/sim_find.cpp index 2f957977e..d41d8dc10 100644 --- a/host/lib/usrp/mpmd/sim_find.cpp +++ b/host/lib/usrp/mpmd/sim_find.cpp @@ -81,7 +81,7 @@ public: { } - ~sim_impl() + ~sim_impl() override { // Destroys the mb_ifaces, causing mpm to be unclaimed before shutting down the // simulator diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 78205fbdd..b80790f64 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -404,17 +404,17 @@ public: _tree = _dev->get_tree(); } - device::sptr get_device(void) + device::sptr get_device(void) override { return _dev; } - uhd::property_tree::sptr get_tree() const + uhd::property_tree::sptr get_tree() const override { return _tree; } - dict<std::string, std::string> get_usrp_rx_info(size_t chan) + dict<std::string, std::string> get_usrp_rx_info(size_t chan) override { mboard_chan_pair mcp = rx_chan_to_mcp(chan); dict<std::string, std::string> usrp_info; @@ -453,7 +453,7 @@ public: return usrp_info; } - dict<std::string, std::string> get_usrp_tx_info(size_t chan) + dict<std::string, std::string> get_usrp_tx_info(size_t chan) override { mboard_chan_pair mcp = tx_chan_to_mcp(chan); dict<std::string, std::string> usrp_info; @@ -495,7 +495,7 @@ public: /******************************************************************* * Mboard methods ******************************************************************/ - void set_master_clock_rate(double rate, size_t mboard) + void set_master_clock_rate(double rate, size_t mboard) override { if (mboard != ALL_MBOARDS) { if (_tree->exists(mb_root(mboard) / "auto_tick_rate") @@ -512,12 +512,12 @@ public: } } - double get_master_clock_rate(size_t mboard) + double get_master_clock_rate(size_t mboard) override { return _tree->access<double>(mb_root(mboard) / "tick_rate").get(); } - meta_range_t get_master_clock_rate_range(const size_t mboard) + meta_range_t get_master_clock_rate_range(const size_t mboard) override { if (_tree->exists(mb_root(mboard) / "tick_rate/range")) { return _tree->access<meta_range_t>(mb_root(mboard) / "tick_rate/range").get(); @@ -528,7 +528,7 @@ public: return meta_range_t(tick_rate, tick_rate, 0); } - std::string get_pp_string(void) + std::string get_pp_string(void) override { std::string buff = str(boost::format("%s USRP:\n" " Device: %s\n") @@ -570,22 +570,22 @@ public: return buff; } - std::string get_mboard_name(size_t mboard) + std::string get_mboard_name(size_t mboard) override { return _tree->access<std::string>(mb_root(mboard) / "name").get(); } - time_spec_t get_time_now(size_t mboard = 0) + time_spec_t get_time_now(size_t mboard = 0) override { return _tree->access<time_spec_t>(mb_root(mboard) / "time/now").get(); } - time_spec_t get_time_last_pps(size_t mboard = 0) + time_spec_t get_time_last_pps(size_t mboard = 0) override { return _tree->access<time_spec_t>(mb_root(mboard) / "time/pps").get(); } - void set_time_now(const time_spec_t& time_spec, size_t mboard) + void set_time_now(const time_spec_t& time_spec, size_t mboard) override { if (mboard != ALL_MBOARDS) { _tree->access<time_spec_t>(mb_root(mboard) / "time/now").set(time_spec); @@ -596,7 +596,7 @@ public: } } - void set_time_next_pps(const time_spec_t& time_spec, size_t mboard) + void set_time_next_pps(const time_spec_t& time_spec, size_t mboard) override { if (mboard != ALL_MBOARDS) { _tree->access<time_spec_t>(mb_root(mboard) / "time/pps").set(time_spec); @@ -607,7 +607,7 @@ public: } } - void set_time_unknown_pps(const time_spec_t& time_spec) + void set_time_unknown_pps(const time_spec_t& time_spec) override { UHD_LOGGER_INFO("MULTI_USRP") << " 1) catch time transition at pps edge"; auto end_time = @@ -643,7 +643,7 @@ public: } } - bool get_time_synchronized(void) + bool get_time_synchronized(void) override { for (size_t m = 1; m < get_num_mboards(); m++) { time_spec_t time_0 = this->get_time_now(0); @@ -654,7 +654,7 @@ public: return true; } - void set_command_time(const time_spec_t& time_spec, size_t mboard) + void set_command_time(const time_spec_t& time_spec, size_t mboard) override { if (mboard != ALL_MBOARDS) { if (not _tree->exists(mb_root(mboard) / "time/cmd")) { @@ -669,7 +669,7 @@ public: } } - void clear_command_time(size_t mboard) + void clear_command_time(size_t mboard) override { if (mboard != ALL_MBOARDS) { _tree->access<time_spec_t>(mb_root(mboard) / "time/cmd") @@ -681,7 +681,7 @@ public: } } - void issue_stream_cmd(const stream_cmd_t& stream_cmd, size_t chan) + void issue_stream_cmd(const stream_cmd_t& stream_cmd, size_t chan) override { if (chan != ALL_CHANS) { _tree->access<stream_cmd_t>(rx_dsp_root(chan) / "stream_cmd").set(stream_cmd); @@ -692,7 +692,7 @@ public: } } - void set_time_source(const std::string& source, const size_t mboard) + void set_time_source(const std::string& source, const size_t mboard) override { if (mboard != ALL_MBOARDS) { const auto time_source_path = mb_root(mboard) / "time_source/value"; @@ -713,7 +713,7 @@ public: } } - std::string get_time_source(const size_t mboard) + std::string get_time_source(const size_t mboard) override { const auto time_source_path = mb_root(mboard) / "time_source/value"; if (_tree->exists(time_source_path)) { @@ -729,7 +729,7 @@ public: throw uhd::runtime_error("Cannot query time_source on this device!"); } - std::vector<std::string> get_time_sources(const size_t mboard) + std::vector<std::string> get_time_sources(const size_t mboard) override { const auto time_source_path = mb_root(mboard) / "time_source/options"; if (_tree->exists(time_source_path)) { @@ -746,7 +746,7 @@ public: throw uhd::runtime_error("Cannot query time_source on this device!"); } - void set_clock_source(const std::string& source, const size_t mboard) + void set_clock_source(const std::string& source, const size_t mboard) override { if (mboard != ALL_MBOARDS) { const auto clock_source_path = mb_root(mboard) / "clock_source/value"; @@ -767,7 +767,7 @@ public: } } - std::string get_clock_source(const size_t mboard) + std::string get_clock_source(const size_t mboard) override { const auto clock_source_path = mb_root(mboard) / "clock_source/value"; if (_tree->exists(clock_source_path)) { @@ -786,7 +786,7 @@ public: void set_sync_source(const std::string& clock_source, const std::string& time_source, - const size_t mboard) + const size_t mboard) override { device_addr_t sync_args; sync_args["clock_source"] = clock_source; @@ -794,7 +794,7 @@ public: set_sync_source(sync_args, mboard); } - void set_sync_source(const device_addr_t& sync_source, const size_t mboard) + void set_sync_source(const device_addr_t& sync_source, const size_t mboard) override { if (mboard != ALL_MBOARDS) { const auto sync_source_path = mb_root(mboard) / "sync_source/value"; @@ -818,7 +818,7 @@ public: } } - device_addr_t get_sync_source(const size_t mboard) + device_addr_t get_sync_source(const size_t mboard) override { const auto sync_source_path = mb_root(mboard) / "sync_source/value"; if (_tree->exists(sync_source_path)) { @@ -834,7 +834,7 @@ public: return sync_source; } - std::vector<device_addr_t> get_sync_sources(const size_t mboard) + std::vector<device_addr_t> get_sync_sources(const size_t mboard) override { const auto sync_source_path = mb_root(mboard) / "sync_source/options"; if (_tree->exists(sync_source_path)) { @@ -857,7 +857,7 @@ public: return sync_sources; } - std::vector<std::string> get_clock_sources(const size_t mboard) + std::vector<std::string> get_clock_sources(const size_t mboard) override { const auto clock_source_path = mb_root(mboard) / "clock_source/options"; if (_tree->exists(clock_source_path)) { @@ -874,7 +874,7 @@ public: throw uhd::runtime_error("Cannot query clock_source on this device!"); } - void set_clock_source_out(const bool enb, const size_t mboard) + void set_clock_source_out(const bool enb, const size_t mboard) override { if (mboard != ALL_MBOARDS) { if (_tree->exists(mb_root(mboard) / "clock_source" / "output")) { @@ -890,7 +890,7 @@ public: } } - void set_time_source_out(const bool enb, const size_t mboard) + void set_time_source_out(const bool enb, const size_t mboard) override { if (mboard != ALL_MBOARDS) { if (_tree->exists(mb_root(mboard) / "time_source" / "output")) { @@ -906,17 +906,17 @@ public: } } - size_t get_num_mboards(void) + size_t get_num_mboards(void) override { return _tree->list("/mboards").size(); } - sensor_value_t get_mboard_sensor(const std::string& name, size_t mboard) + sensor_value_t get_mboard_sensor(const std::string& name, size_t mboard) override { return _tree->access<sensor_value_t>(mb_root(mboard) / "sensors" / name).get(); } - std::vector<std::string> get_mboard_sensor_names(size_t mboard) + std::vector<std::string> get_mboard_sensor_names(size_t mboard) override { if (_tree->exists(mb_root(mboard) / "sensors")) { return _tree->list(mb_root(mboard) / "sensors"); @@ -924,7 +924,8 @@ public: return {}; } - void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard) + void set_user_register( + const uint8_t addr, const uint32_t data, size_t mboard) override { if (mboard != ALL_MBOARDS) { typedef std::pair<uint8_t, uint32_t> user_reg_t; @@ -937,7 +938,7 @@ public: } } - wb_iface::sptr get_user_settings_iface(const size_t chan) + wb_iface::sptr get_user_settings_iface(const size_t chan) override { const auto user_settings_path = rx_rf_fe_root(chan) / "user_settings" / "iface"; if (_tree->exists(user_settings_path)) { @@ -948,7 +949,7 @@ public: return nullptr; } - uhd::rfnoc::radio_control& get_radio_control(const size_t) + uhd::rfnoc::radio_control& get_radio_control(const size_t) override { throw uhd::not_implemented_error( "get_radio_control() not supported on this device!"); @@ -957,7 +958,7 @@ public: /******************************************************************* * RX methods ******************************************************************/ - rx_streamer::sptr get_rx_stream(const stream_args_t& args) + rx_streamer::sptr get_rx_stream(const stream_args_t& args) override { _check_link_rate(args, false); stream_args_t args_ = args; @@ -972,7 +973,7 @@ public: return this->get_device()->get_rx_stream(args_); } - void set_rx_subdev_spec(const subdev_spec_t& spec, size_t mboard) + void set_rx_subdev_spec(const subdev_spec_t& spec, size_t mboard) override { if (mboard != ALL_MBOARDS) { _tree->access<subdev_spec_t>(mb_root(mboard) / "rx_subdev_spec").set(spec); @@ -983,7 +984,7 @@ public: } } - subdev_spec_t get_rx_subdev_spec(size_t mboard) + subdev_spec_t get_rx_subdev_spec(size_t mboard) override { subdev_spec_t spec = _tree->access<subdev_spec_t>(mb_root(mboard) / "rx_subdev_spec").get(); @@ -1009,7 +1010,7 @@ public: return spec; } - size_t get_rx_num_channels(void) + size_t get_rx_num_channels(void) override { size_t sum = 0; for (size_t m = 0; m < get_num_mboards(); m++) { @@ -1018,12 +1019,12 @@ public: return sum; } - std::string get_rx_subdev_name(size_t chan) + std::string get_rx_subdev_name(size_t chan) override { return _tree->access<std::string>(rx_rf_fe_root(chan) / "name").get(); } - void set_rx_rate(double rate, size_t chan) + void set_rx_rate(double rate, size_t chan) override { if (chan != ALL_CHANS) { _tree->access<double>(rx_dsp_root(chan) / "rate" / "value").set(rate); @@ -1035,22 +1036,22 @@ public: } } - void set_rx_spp(const size_t spp, const size_t chan = ALL_CHANS) + void set_rx_spp(const size_t spp, const size_t chan = ALL_CHANS) override { _rx_spp[chan] = spp; } - double get_rx_rate(size_t chan) + double get_rx_rate(size_t chan) override { return _tree->access<double>(rx_dsp_root(chan) / "rate" / "value").get(); } - meta_range_t get_rx_rates(size_t chan) + meta_range_t get_rx_rates(size_t chan) override { return _tree->access<meta_range_t>(rx_dsp_root(chan) / "rate" / "range").get(); } - tune_result_t set_rx_freq(const tune_request_t& tune_request, size_t chan) + tune_result_t set_rx_freq(const tune_request_t& tune_request, size_t chan) override { // If any mixer is driven by an external LO the daughterboard assumes that no // CORDIC correction is necessary. Since the LO might be sourced from another @@ -1080,14 +1081,14 @@ public: return result; } - double get_rx_freq(size_t chan) + double get_rx_freq(size_t chan) override { return derive_freq_from_xx_subdev_and_dsp(RX_SIGN, _tree->subtree(rx_dsp_root(chan)), _tree->subtree(rx_rf_fe_root(chan))); } - freq_range_t get_rx_freq_range(size_t chan) + freq_range_t get_rx_freq_range(size_t chan) override { return make_overall_tune_range( _tree->access<meta_range_t>(rx_rf_fe_root(chan) / "freq" / "range").get(), @@ -1095,7 +1096,7 @@ public: this->get_rx_bandwidth(chan)); } - freq_range_t get_fe_rx_freq_range(size_t chan) + freq_range_t get_fe_rx_freq_range(size_t chan) override { return _tree->access<meta_range_t>(rx_rf_fe_root(chan) / "freq" / "range").get(); } @@ -1103,7 +1104,7 @@ public: /************************************************************************** * LO controls *************************************************************************/ - std::vector<std::string> get_rx_lo_names(size_t chan = 0) + std::vector<std::string> get_rx_lo_names(size_t chan = 0) override { std::vector<std::string> lo_names; if (_tree->exists(rx_rf_fe_root(chan) / "los")) { @@ -1114,8 +1115,9 @@ public: return lo_names; } - void set_rx_lo_source( - const std::string& src, const std::string& name = ALL_LOS, size_t chan = 0) + void set_rx_lo_source(const std::string& src, + const std::string& name = ALL_LOS, + size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1148,7 +1150,8 @@ public: } } - const std::string get_rx_lo_source(const std::string& name = ALL_LOS, size_t chan = 0) + const std::string get_rx_lo_source( + const std::string& name = ALL_LOS, size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1174,7 +1177,7 @@ public: } std::vector<std::string> get_rx_lo_sources( - const std::string& name = ALL_LOS, size_t chan = 0) + const std::string& name = ALL_LOS, size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1205,7 +1208,7 @@ public: } void set_rx_lo_export_enabled( - bool enabled, const std::string& name = ALL_LOS, size_t chan = 0) + bool enabled, const std::string& name = ALL_LOS, size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1234,7 +1237,8 @@ public: } } - bool get_rx_lo_export_enabled(const std::string& name = ALL_LOS, size_t chan = 0) + bool get_rx_lo_export_enabled( + const std::string& name = ALL_LOS, size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1257,7 +1261,8 @@ public: } } - double set_rx_lo_freq(double freq, const std::string& name = ALL_LOS, size_t chan = 0) + double set_rx_lo_freq( + double freq, const std::string& name = ALL_LOS, size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1283,7 +1288,7 @@ public: } } - double get_rx_lo_freq(const std::string& name = ALL_LOS, size_t chan = 0) + double get_rx_lo_freq(const std::string& name = ALL_LOS, size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1305,7 +1310,8 @@ public: } } - freq_range_t get_rx_lo_freq_range(const std::string& name = ALL_LOS, size_t chan = 0) + freq_range_t get_rx_lo_freq_range( + const std::string& name = ALL_LOS, size_t chan = 0) override { if (_tree->exists(rx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1328,7 +1334,7 @@ public: } } - std::vector<std::string> get_tx_lo_names(const size_t chan = 0) + std::vector<std::string> get_tx_lo_names(const size_t chan = 0) override { std::vector<std::string> lo_names; if (_tree->exists(tx_rf_fe_root(chan) / "los")) { @@ -1339,8 +1345,9 @@ public: return lo_names; } - void set_tx_lo_source( - const std::string& src, const std::string& name = ALL_LOS, const size_t chan = 0) + void set_tx_lo_source(const std::string& src, + const std::string& name = ALL_LOS, + const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1373,7 +1380,7 @@ public: } const std::string get_tx_lo_source( - const std::string& name = ALL_LOS, const size_t chan = 0) + const std::string& name = ALL_LOS, const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { @@ -1392,7 +1399,7 @@ public: } std::vector<std::string> get_tx_lo_sources( - const std::string& name = ALL_LOS, const size_t chan = 0) + const std::string& name = ALL_LOS, const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1423,8 +1430,9 @@ public: } } - void set_tx_lo_export_enabled( - const bool enabled, const std::string& name = ALL_LOS, const size_t chan = 0) + void set_tx_lo_export_enabled(const bool enabled, + const std::string& name = ALL_LOS, + const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1454,7 +1462,7 @@ public: } bool get_tx_lo_export_enabled( - const std::string& name = ALL_LOS, const size_t chan = 0) + const std::string& name = ALL_LOS, const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { @@ -1470,8 +1478,9 @@ public: } } - double set_tx_lo_freq( - const double freq, const std::string& name = ALL_LOS, const size_t chan = 0) + double set_tx_lo_freq(const double freq, + const std::string& name = ALL_LOS, + const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1494,7 +1503,8 @@ public: } } - double get_tx_lo_freq(const std::string& name = ALL_LOS, const size_t chan = 0) + double get_tx_lo_freq( + const std::string& name = ALL_LOS, const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1518,7 +1528,7 @@ public: } freq_range_t get_tx_lo_freq_range( - const std::string& name = ALL_LOS, const size_t chan = 0) + const std::string& name = ALL_LOS, const size_t chan = 0) override { if (_tree->exists(tx_rf_fe_root(chan) / "los")) { if (name == ALL_LOS) { @@ -1545,7 +1555,7 @@ public: /************************************************************************** * Gain control *************************************************************************/ - void set_rx_gain(double gain, const std::string& name, size_t chan) + void set_rx_gain(double gain, const std::string& name, size_t chan) override { /* Check if any AGC mode is enable and if so warn the user */ if (chan != ALL_CHANS) { @@ -1581,7 +1591,7 @@ public: } } - void set_rx_gain_profile(const std::string& profile, const size_t chan) + void set_rx_gain_profile(const std::string& profile, const size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_rf_fe_root(chan) / "gains/all/profile/value")) { @@ -1601,7 +1611,7 @@ public: } } - std::string get_rx_gain_profile(const size_t chan) + std::string get_rx_gain_profile(const size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_rf_fe_root(chan) / "gains/all/profile/value")) { @@ -1616,7 +1626,7 @@ public: return ""; } - std::vector<std::string> get_rx_gain_profile_names(const size_t chan) + std::vector<std::string> get_rx_gain_profile_names(const size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_rf_fe_root(chan) / "gains/all/profile/options")) { @@ -1632,7 +1642,7 @@ public: return std::vector<std::string>(); } - void set_normalized_rx_gain(double gain, size_t chan = 0) + void set_normalized_rx_gain(double gain, size_t chan = 0) override { if (gain > 1.0 || gain < 0.0) { throw uhd::runtime_error("Normalized gain out of range, " @@ -1644,7 +1654,7 @@ public: set_rx_gain(abs_gain, ALL_GAINS, chan); } - void set_rx_agc(bool enable, size_t chan = 0) + void set_rx_agc(bool enable, size_t chan = 0) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_rf_fe_root(chan) / "gain" / "agc" / "enable")) { @@ -1661,7 +1671,7 @@ public: } } - double get_rx_gain(const std::string& name, size_t chan) + double get_rx_gain(const std::string& name, size_t chan) override { try { return rx_gain_group(chan)->get_value(name); @@ -1670,7 +1680,7 @@ public: } } - double get_normalized_rx_gain(size_t chan) + double get_normalized_rx_gain(size_t chan) override { gain_range_t gain_range = get_rx_gain_range(ALL_GAINS, chan); double gain_range_width = gain_range.stop() - gain_range.start(); @@ -1688,7 +1698,7 @@ public: return norm_gain; } - gain_range_t get_rx_gain_range(const std::string& name, size_t chan) + gain_range_t get_rx_gain_range(const std::string& name, size_t chan) override { try { return rx_gain_group(chan)->get_range(name); @@ -1697,7 +1707,7 @@ public: } } - std::vector<std::string> get_rx_gain_names(size_t chan) + std::vector<std::string> get_rx_gain_names(size_t chan) override { return rx_gain_group(chan)->get_names(); } @@ -1705,12 +1715,12 @@ public: /************************************************************************** * RX Power control *************************************************************************/ - bool has_rx_power_reference(const size_t chan) + bool has_rx_power_reference(const size_t chan) override { return _tree->exists(rx_rf_fe_root(chan) / "ref_power/value"); } - void set_rx_power_reference(const double power_dbm, const size_t chan = 0) + void set_rx_power_reference(const double power_dbm, const size_t chan = 0) override { const auto power_ref_path = rx_rf_fe_root(chan) / "ref_power/value"; if (!_tree->exists(power_ref_path)) { @@ -1720,7 +1730,7 @@ public: _tree->access<double>(power_ref_path).set(power_dbm); } - double get_rx_power_reference(const size_t chan = 0) + double get_rx_power_reference(const size_t chan = 0) override { const auto power_ref_path = rx_rf_fe_root(chan) / "ref_power/value"; if (!_tree->exists(power_ref_path)) { @@ -1730,7 +1740,7 @@ public: return _tree->access<double>(power_ref_path).get(); } - meta_range_t get_rx_power_range(const size_t chan) + meta_range_t get_rx_power_range(const size_t chan) override { const auto power_ref_path = rx_rf_fe_root(chan) / "ref_power/range"; if (!_tree->exists(power_ref_path)) { @@ -1741,18 +1751,18 @@ public: } - void set_rx_antenna(const std::string& ant, size_t chan) + void set_rx_antenna(const std::string& ant, size_t chan) override { _tree->access<std::string>(rx_rf_fe_root(chan) / "antenna" / "value").set(ant); } - std::string get_rx_antenna(size_t chan) + std::string get_rx_antenna(size_t chan) override { return _tree->access<std::string>(rx_rf_fe_root(chan) / "antenna" / "value") .get(); } - std::vector<std::string> get_rx_antennas(size_t chan) + std::vector<std::string> get_rx_antennas(size_t chan) override { return _tree ->access<std::vector<std::string>>( @@ -1760,23 +1770,23 @@ public: .get(); } - void set_rx_bandwidth(double bandwidth, size_t chan) + void set_rx_bandwidth(double bandwidth, size_t chan) override { _tree->access<double>(rx_rf_fe_root(chan) / "bandwidth" / "value").set(bandwidth); } - double get_rx_bandwidth(size_t chan) + double get_rx_bandwidth(size_t chan) override { return _tree->access<double>(rx_rf_fe_root(chan) / "bandwidth" / "value").get(); } - meta_range_t get_rx_bandwidth_range(size_t chan) + meta_range_t get_rx_bandwidth_range(size_t chan) override { return _tree->access<meta_range_t>(rx_rf_fe_root(chan) / "bandwidth" / "range") .get(); } - dboard_iface::sptr get_rx_dboard_iface(size_t chan) + dboard_iface::sptr get_rx_dboard_iface(size_t chan) override { return _tree ->access<dboard_iface::sptr>( @@ -1784,13 +1794,13 @@ public: .get(); } - sensor_value_t get_rx_sensor(const std::string& name, size_t chan) + sensor_value_t get_rx_sensor(const std::string& name, size_t chan) override { return _tree->access<sensor_value_t>(rx_rf_fe_root(chan) / "sensors" / name) .get(); } - std::vector<std::string> get_rx_sensor_names(size_t chan) + std::vector<std::string> get_rx_sensor_names(size_t chan) override { std::vector<std::string> sensor_names; if (_tree->exists(rx_rf_fe_root(chan) / "sensors")) { @@ -1799,7 +1809,7 @@ public: return sensor_names; } - void set_rx_dc_offset(const bool enb, size_t chan) + void set_rx_dc_offset(const bool enb, size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_fe_root(chan) / "dc_offset" / "enable")) { @@ -1820,7 +1830,7 @@ public: } } - void set_rx_dc_offset(const std::complex<double>& offset, size_t chan) + void set_rx_dc_offset(const std::complex<double>& offset, size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_fe_root(chan) / "dc_offset" / "value")) { @@ -1839,7 +1849,7 @@ public: } } - meta_range_t get_rx_dc_offset_range(size_t chan) + meta_range_t get_rx_dc_offset_range(size_t chan) override { if (_tree->exists(rx_fe_root(chan) / "dc_offset" / "range")) { return _tree @@ -1852,7 +1862,7 @@ public: } } - void set_rx_iq_balance(const bool enb, size_t chan) + void set_rx_iq_balance(const bool enb, size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_rf_fe_root(chan) / "iq_balance" / "enable")) { @@ -1869,7 +1879,7 @@ public: } } - void set_rx_iq_balance(const std::complex<double>& offset, size_t chan) + void set_rx_iq_balance(const std::complex<double>& offset, size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(rx_fe_root(chan) / "iq_balance" / "value")) { @@ -1888,7 +1898,7 @@ public: } } - std::vector<std::string> get_rx_filter_names(const size_t chan) + std::vector<std::string> get_rx_filter_names(const size_t chan) override { if (chan >= get_rx_num_channels()) { throw uhd::index_error("Attempting to get non-existent RX filter names"); @@ -1913,7 +1923,8 @@ public: return ret; } - uhd::filter_info_base::sptr get_rx_filter(const std::string& name, const size_t chan) + uhd::filter_info_base::sptr get_rx_filter( + const std::string& name, const size_t chan) override { std::vector<std::string> possible_names = get_rx_filter_names(chan); std::vector<std::string>::iterator it; @@ -1925,8 +1936,9 @@ public: return _tree->access<filter_info_base::sptr>(fs_path(name) / "value").get(); } - void set_rx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan) + void set_rx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) override { std::vector<std::string> possible_names = get_rx_filter_names(chan); std::vector<std::string>::iterator it; @@ -1938,7 +1950,7 @@ public: _tree->access<filter_info_base::sptr>(fs_path(name) / "value").set(filter); } - std::vector<std::string> get_tx_filter_names(const size_t chan) + std::vector<std::string> get_tx_filter_names(const size_t chan) override { if (chan >= get_tx_num_channels()) { throw uhd::index_error("Attempting to get non-existent TX filter names"); @@ -1963,7 +1975,8 @@ public: return ret; } - uhd::filter_info_base::sptr get_tx_filter(const std::string& name, const size_t chan) + uhd::filter_info_base::sptr get_tx_filter( + const std::string& name, const size_t chan) override { std::vector<std::string> possible_names = get_tx_filter_names(chan); std::vector<std::string>::iterator it; @@ -1975,8 +1988,9 @@ public: return _tree->access<filter_info_base::sptr>(fs_path(name) / "value").get(); } - void set_tx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan) + void set_tx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) override { std::vector<std::string> possible_names = get_tx_filter_names(chan); std::vector<std::string>::iterator it; @@ -1991,13 +2005,13 @@ public: /******************************************************************* * TX methods ******************************************************************/ - tx_streamer::sptr get_tx_stream(const stream_args_t& args) + tx_streamer::sptr get_tx_stream(const stream_args_t& args) override { _check_link_rate(args, true); return this->get_device()->get_tx_stream(args); } - void set_tx_subdev_spec(const subdev_spec_t& spec, size_t mboard) + void set_tx_subdev_spec(const subdev_spec_t& spec, size_t mboard) override { if (mboard != ALL_MBOARDS) { _tree->access<subdev_spec_t>(mb_root(mboard) / "tx_subdev_spec").set(spec); @@ -2008,7 +2022,7 @@ public: } } - subdev_spec_t get_tx_subdev_spec(size_t mboard) + subdev_spec_t get_tx_subdev_spec(size_t mboard) override { subdev_spec_t spec = _tree->access<subdev_spec_t>(mb_root(mboard) / "tx_subdev_spec").get(); @@ -2034,7 +2048,7 @@ public: return spec; } - size_t get_tx_num_channels(void) + size_t get_tx_num_channels(void) override { size_t sum = 0; for (size_t m = 0; m < get_num_mboards(); m++) { @@ -2043,12 +2057,12 @@ public: return sum; } - std::string get_tx_subdev_name(size_t chan) + std::string get_tx_subdev_name(size_t chan) override { return _tree->access<std::string>(tx_rf_fe_root(chan) / "name").get(); } - void set_tx_rate(double rate, size_t chan) + void set_tx_rate(double rate, size_t chan) override { if (chan != ALL_CHANS) { _tree->access<double>(tx_dsp_root(chan) / "rate" / "value").set(rate); @@ -2060,17 +2074,17 @@ public: } } - double get_tx_rate(size_t chan) + double get_tx_rate(size_t chan) override { return _tree->access<double>(tx_dsp_root(chan) / "rate" / "value").get(); } - meta_range_t get_tx_rates(size_t chan) + meta_range_t get_tx_rates(size_t chan) override { return _tree->access<meta_range_t>(tx_dsp_root(chan) / "rate" / "range").get(); } - tune_result_t set_tx_freq(const tune_request_t& tune_request, size_t chan) + tune_result_t set_tx_freq(const tune_request_t& tune_request, size_t chan) override { tune_result_t result = tune_xx_subdev_and_dsp(TX_SIGN, _tree->subtree(tx_dsp_root(chan)), @@ -2080,14 +2094,14 @@ public: return result; } - double get_tx_freq(size_t chan) + double get_tx_freq(size_t chan) override { return derive_freq_from_xx_subdev_and_dsp(TX_SIGN, _tree->subtree(tx_dsp_root(chan)), _tree->subtree(tx_rf_fe_root(chan))); } - freq_range_t get_tx_freq_range(size_t chan) + freq_range_t get_tx_freq_range(size_t chan) override { return make_overall_tune_range( _tree->access<meta_range_t>(tx_rf_fe_root(chan) / "freq" / "range").get(), @@ -2095,12 +2109,12 @@ public: this->get_tx_bandwidth(chan)); } - freq_range_t get_fe_tx_freq_range(size_t chan) + freq_range_t get_fe_tx_freq_range(size_t chan) override { return _tree->access<meta_range_t>(tx_rf_fe_root(chan) / "freq" / "range").get(); } - void set_tx_gain(double gain, const std::string& name, size_t chan) + void set_tx_gain(double gain, const std::string& name, size_t chan) override { try { return tx_gain_group(chan)->set_value(gain, name); @@ -2109,7 +2123,7 @@ public: } } - void set_tx_gain_profile(const std::string& profile, const size_t chan) + void set_tx_gain_profile(const std::string& profile, const size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(tx_rf_fe_root(chan) / "gains/all/profile/value")) { @@ -2129,7 +2143,7 @@ public: } } - std::string get_tx_gain_profile(const size_t chan) + std::string get_tx_gain_profile(const size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(tx_rf_fe_root(chan) / "gains/all/profile/value")) { @@ -2144,7 +2158,7 @@ public: return ""; } - std::vector<std::string> get_tx_gain_profile_names(const size_t chan) + std::vector<std::string> get_tx_gain_profile_names(const size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(tx_rf_fe_root(chan) / "gains/all/profile/options")) { @@ -2160,7 +2174,7 @@ public: return std::vector<std::string>(); } - void set_normalized_tx_gain(double gain, size_t chan = 0) + void set_normalized_tx_gain(double gain, size_t chan = 0) override { if (gain > 1.0 || gain < 0.0) { throw uhd::runtime_error("Normalized gain out of range, must be in [0, 1]."); @@ -2172,7 +2186,7 @@ public: } - double get_tx_gain(const std::string& name, size_t chan) + double get_tx_gain(const std::string& name, size_t chan) override { try { return tx_gain_group(chan)->get_value(name); @@ -2181,7 +2195,7 @@ public: } } - double get_normalized_tx_gain(size_t chan) + double get_normalized_tx_gain(size_t chan) override { gain_range_t gain_range = get_tx_gain_range(ALL_GAINS, chan); double gain_range_width = gain_range.stop() - gain_range.start(); @@ -2199,7 +2213,7 @@ public: return norm_gain; } - gain_range_t get_tx_gain_range(const std::string& name, size_t chan) + gain_range_t get_tx_gain_range(const std::string& name, size_t chan) override { try { return tx_gain_group(chan)->get_range(name); @@ -2208,7 +2222,7 @@ public: } } - std::vector<std::string> get_tx_gain_names(size_t chan) + std::vector<std::string> get_tx_gain_names(size_t chan) override { return tx_gain_group(chan)->get_names(); } @@ -2216,12 +2230,12 @@ public: /************************************************************************** * TX Power Controls *************************************************************************/ - bool has_tx_power_reference(const size_t chan) + bool has_tx_power_reference(const size_t chan) override { return _tree->exists(tx_rf_fe_root(chan) / "ref_power/value"); } - void set_tx_power_reference(const double power_dbm, const size_t chan = 0) + void set_tx_power_reference(const double power_dbm, const size_t chan = 0) override { const auto power_ref_path = tx_rf_fe_root(chan) / "ref_power/value"; if (!_tree->exists(power_ref_path)) { @@ -2231,7 +2245,7 @@ public: _tree->access<double>(power_ref_path).set(power_dbm); } - double get_tx_power_reference(const size_t chan = 0) + double get_tx_power_reference(const size_t chan = 0) override { const auto power_ref_path = tx_rf_fe_root(chan) / "ref_power/value"; if (!_tree->exists(power_ref_path)) { @@ -2241,7 +2255,7 @@ public: return _tree->access<double>(power_ref_path).get(); } - meta_range_t get_tx_power_range(const size_t chan) + meta_range_t get_tx_power_range(const size_t chan) override { const auto power_ref_path = tx_rf_fe_root(chan) / "ref_power/range"; if (!_tree->exists(power_ref_path)) { @@ -2251,18 +2265,18 @@ public: return _tree->access<meta_range_t>(power_ref_path).get(); } - void set_tx_antenna(const std::string& ant, size_t chan) + void set_tx_antenna(const std::string& ant, size_t chan) override { _tree->access<std::string>(tx_rf_fe_root(chan) / "antenna" / "value").set(ant); } - std::string get_tx_antenna(size_t chan) + std::string get_tx_antenna(size_t chan) override { return _tree->access<std::string>(tx_rf_fe_root(chan) / "antenna" / "value") .get(); } - std::vector<std::string> get_tx_antennas(size_t chan) + std::vector<std::string> get_tx_antennas(size_t chan) override { return _tree ->access<std::vector<std::string>>( @@ -2270,23 +2284,23 @@ public: .get(); } - void set_tx_bandwidth(double bandwidth, size_t chan) + void set_tx_bandwidth(double bandwidth, size_t chan) override { _tree->access<double>(tx_rf_fe_root(chan) / "bandwidth" / "value").set(bandwidth); } - double get_tx_bandwidth(size_t chan) + double get_tx_bandwidth(size_t chan) override { return _tree->access<double>(tx_rf_fe_root(chan) / "bandwidth" / "value").get(); } - meta_range_t get_tx_bandwidth_range(size_t chan) + meta_range_t get_tx_bandwidth_range(size_t chan) override { return _tree->access<meta_range_t>(tx_rf_fe_root(chan) / "bandwidth" / "range") .get(); } - dboard_iface::sptr get_tx_dboard_iface(size_t chan) + dboard_iface::sptr get_tx_dboard_iface(size_t chan) override { return _tree ->access<dboard_iface::sptr>( @@ -2294,13 +2308,13 @@ public: .get(); } - sensor_value_t get_tx_sensor(const std::string& name, size_t chan) + sensor_value_t get_tx_sensor(const std::string& name, size_t chan) override { return _tree->access<sensor_value_t>(tx_rf_fe_root(chan) / "sensors" / name) .get(); } - std::vector<std::string> get_tx_sensor_names(size_t chan) + std::vector<std::string> get_tx_sensor_names(size_t chan) override { std::vector<std::string> sensor_names; if (_tree->exists(rx_rf_fe_root(chan) / "sensors")) { @@ -2309,7 +2323,7 @@ public: return sensor_names; } - void set_tx_dc_offset(const std::complex<double>& offset, size_t chan) + void set_tx_dc_offset(const std::complex<double>& offset, size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(tx_fe_root(chan) / "dc_offset" / "value")) { @@ -2328,7 +2342,7 @@ public: } } - meta_range_t get_tx_dc_offset_range(size_t chan) + meta_range_t get_tx_dc_offset_range(size_t chan) override { if (_tree->exists(tx_fe_root(chan) / "dc_offset" / "range")) { return _tree @@ -2341,7 +2355,7 @@ public: } } - void set_tx_iq_balance(const std::complex<double>& offset, size_t chan) + void set_tx_iq_balance(const std::complex<double>& offset, size_t chan) override { if (chan != ALL_CHANS) { if (_tree->exists(tx_fe_root(chan) / "iq_balance" / "value")) { @@ -2363,7 +2377,7 @@ public: /******************************************************************* * GPIO methods ******************************************************************/ - std::vector<std::string> get_gpio_banks(const size_t mboard) + std::vector<std::string> get_gpio_banks(const size_t mboard) override { std::vector<std::string> banks; if (_tree->exists(mb_root(mboard) / "gpio")) { @@ -2382,7 +2396,7 @@ public: const std::string& attr, const uint32_t value, const uint32_t mask, - const size_t mboard) + const size_t mboard) override { std::vector<std::string> attr_value; if (_tree->exists(mb_root(mboard) / "gpio" / bank)) { @@ -2466,7 +2480,7 @@ public: } uint32_t get_gpio_attr( - const std::string& bank, const std::string& attr, const size_t mboard) + const std::string& bank, const std::string& attr, const size_t mboard) override { std::vector<std::string> str_val; @@ -2533,31 +2547,32 @@ public: } // The next four methods are only for RFNoC devices - std::vector<std::string> get_gpio_src_banks(const size_t) + std::vector<std::string> get_gpio_src_banks(const size_t) override { throw uhd::not_implemented_error( "get_gpio_src_banks() not implemented for this motherboard!"); } - std::vector<std::string> get_gpio_srcs(const std::string&, const size_t) + std::vector<std::string> get_gpio_srcs(const std::string&, const size_t) override { throw uhd::not_implemented_error( "get_gpio_srcs() not implemented for this motherboard!"); } - std::vector<std::string> get_gpio_src(const std::string&, const size_t) + std::vector<std::string> get_gpio_src(const std::string&, const size_t) override { throw uhd::not_implemented_error( "get_gpio_src() not implemented for this motherboard!"); } - void set_gpio_src(const std::string&, const std::vector<std::string>&, const size_t) + void set_gpio_src( + const std::string&, const std::vector<std::string>&, const size_t) override { throw uhd::not_implemented_error( "set_gpio_src() not implemented for this motherboard!"); } - uhd::rfnoc::mb_controller& get_mb_controller(const size_t /*mboard*/) + uhd::rfnoc::mb_controller& get_mb_controller(const size_t /*mboard*/) override { throw uhd::not_implemented_error( "get_mb_controller() not supported on this device!"); diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index b9e8f0a1f..bed364e60 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -76,19 +76,19 @@ class redirector_device : public uhd::device public: redirector_device(multi_usrp* musrp_ptr) : _musrp(musrp_ptr) {} - rx_streamer::sptr get_rx_stream(const stream_args_t& args) + rx_streamer::sptr get_rx_stream(const stream_args_t& args) override { return _musrp->get_rx_stream(args); } - tx_streamer::sptr get_tx_stream(const stream_args_t& args) + tx_streamer::sptr get_tx_stream(const stream_args_t& args) override { auto streamer = _musrp->get_tx_stream(args); _last_tx_streamer = streamer; return streamer; } - bool recv_async_msg(async_metadata_t& md, double timeout) + bool recv_async_msg(async_metadata_t& md, double timeout) override { std::call_once(_async_warning_flag, []() { UHD_LOG_WARNING(LOG_ID, @@ -255,22 +255,22 @@ public: _graph->commit(); } - ~multi_usrp_rfnoc() + ~multi_usrp_rfnoc() override { // nop } - device::sptr get_device(void) + device::sptr get_device(void) override { return _device; } - uhd::property_tree::sptr get_tree() const + uhd::property_tree::sptr get_tree() const override { return _tree; } - rx_streamer::sptr get_rx_stream(const stream_args_t& args_) + rx_streamer::sptr get_rx_stream(const stream_args_t& args_) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); stream_args_t args = sanitize_stream_args(args_); @@ -355,7 +355,7 @@ public: return rx_streamer; } - tx_streamer::sptr get_tx_stream(const stream_args_t& args_) + tx_streamer::sptr get_tx_stream(const stream_args_t& args_) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); stream_args_t args = sanitize_stream_args(args_); @@ -467,7 +467,7 @@ public: return range; } - dict<std::string, std::string> get_usrp_rx_info(size_t chan) + dict<std::string, std::string> get_usrp_rx_info(size_t chan) override { auto& rx_chain = _get_rx_chan(chan); const size_t mb_idx = rx_chain.radio->get_block_id().get_device_no(); @@ -501,7 +501,7 @@ public: return usrp_info; } - dict<std::string, std::string> get_usrp_tx_info(size_t chan) + dict<std::string, std::string> get_usrp_tx_info(size_t chan) override { auto& tx_chain = _get_tx_chan(chan); const size_t mb_idx = tx_chain.radio->get_block_id().get_device_no(); @@ -640,7 +640,7 @@ public: /******************************************************************* * Mboard methods ******************************************************************/ - void set_master_clock_rate(double rate, size_t mboard) + void set_master_clock_rate(double rate, size_t mboard) override { for (auto& chain : _rx_chans) { auto radio = chain.second.radio; @@ -658,7 +658,7 @@ public: } } - double get_master_clock_rate(size_t mboard) + double get_master_clock_rate(size_t mboard) override { // We pick the first radio we can find on this mboard, and hope that all // radios have the same range. @@ -677,7 +677,7 @@ public: throw uhd::key_error("Invalid mboard index!"); } - meta_range_t get_master_clock_rate_range(const size_t mboard) + meta_range_t get_master_clock_rate_range(const size_t mboard) override { // We pick the first radio we can find on this mboard, and hope that all // radios have the same range. @@ -696,7 +696,7 @@ public: throw uhd::key_error("Invalid mboard index!"); } - std::string get_pp_string(void) + std::string get_pp_string(void) override { std::string buff = str(boost::format("%s USRP:\n" " Device: %s\n") @@ -735,34 +735,35 @@ public: return buff; } - std::string get_mboard_name(size_t mboard = 0) + std::string get_mboard_name(size_t mboard = 0) override { return _get_mbc(mboard)->get_mboard_name(); } - time_spec_t get_time_now(size_t mboard = 0) + time_spec_t get_time_now(size_t mboard = 0) override { return _get_mbc(mboard)->get_timekeeper(0)->get_time_now(); } - time_spec_t get_time_last_pps(size_t mboard = 0) + time_spec_t get_time_last_pps(size_t mboard = 0) override { return _get_mbc(mboard)->get_timekeeper(0)->get_time_last_pps(); } - void set_time_now(const time_spec_t& time_spec, size_t mboard = ALL_MBOARDS) + void set_time_now(const time_spec_t& time_spec, size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_time_now, time_spec); _get_mbc(mboard)->get_timekeeper(0)->set_time_now(time_spec); } - void set_time_next_pps(const time_spec_t& time_spec, size_t mboard = ALL_MBOARDS) + void set_time_next_pps( + const time_spec_t& time_spec, size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_time_next_pps, time_spec); _get_mbc(mboard)->get_timekeeper(0)->set_time_next_pps(time_spec); } - void set_time_unknown_pps(const time_spec_t& time_spec) + void set_time_unknown_pps(const time_spec_t& time_spec) override { UHD_LOGGER_INFO("MULTI_USRP") << " 1) catch time transition at pps edge"; auto end_time = std::chrono::steady_clock::now() + 1100ms; @@ -796,7 +797,7 @@ public: } } - bool get_time_synchronized(void) + bool get_time_synchronized(void) override { for (size_t m = 1; m < get_num_mboards(); m++) { time_spec_t time_0 = this->get_time_now(0); @@ -808,7 +809,8 @@ public: return true; } - void set_command_time(const uhd::time_spec_t& time_spec, size_t mboard = ALL_MBOARDS) + void set_command_time( + const uhd::time_spec_t& time_spec, size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_command_time, time_spec); @@ -833,7 +835,7 @@ public: } } - void clear_command_time(size_t mboard = ALL_MBOARDS) + void clear_command_time(size_t mboard = ALL_MBOARDS) override { if (mboard == ALL_MBOARDS) { for (size_t i = 0; i < get_num_mboards(); ++i) { @@ -863,7 +865,8 @@ public: } } - void issue_stream_cmd(const stream_cmd_t& stream_cmd, size_t chan = ALL_CHANS) + void issue_stream_cmd( + const stream_cmd_t& stream_cmd, size_t chan = ALL_CHANS) override { MUX_RX_API_CALL(issue_stream_cmd, stream_cmd); auto& rx_chain = _get_rx_chan(chan); @@ -874,104 +877,106 @@ public: } } - void set_time_source(const std::string& source, const size_t mboard = ALL_MBOARDS) + void set_time_source( + const std::string& source, const size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_time_source, source); _get_mbc(mboard)->set_time_source(source); } - std::string get_time_source(const size_t mboard) + std::string get_time_source(const size_t mboard) override { return _get_mbc(mboard)->get_time_source(); } - std::vector<std::string> get_time_sources(const size_t mboard) + std::vector<std::string> get_time_sources(const size_t mboard) override { return _get_mbc(mboard)->get_time_sources(); } - void set_clock_source(const std::string& source, const size_t mboard = ALL_MBOARDS) + void set_clock_source( + const std::string& source, const size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_clock_source, source); _get_mbc(mboard)->set_clock_source(source); } - std::string get_clock_source(const size_t mboard) + std::string get_clock_source(const size_t mboard) override { return _get_mbc(mboard)->get_clock_source(); } - std::vector<std::string> get_clock_sources(const size_t mboard) + std::vector<std::string> get_clock_sources(const size_t mboard) override { return _get_mbc(mboard)->get_clock_sources(); } void set_sync_source(const std::string& clock_source, const std::string& time_source, - const size_t mboard = ALL_MBOARDS) + const size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_sync_source, clock_source, time_source); _get_mbc(mboard)->set_sync_source(clock_source, time_source); } void set_sync_source( - const device_addr_t& sync_source, const size_t mboard = ALL_MBOARDS) + const device_addr_t& sync_source, const size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_sync_source, sync_source); _get_mbc(mboard)->set_sync_source(sync_source); } - device_addr_t get_sync_source(const size_t mboard) + device_addr_t get_sync_source(const size_t mboard) override { return _get_mbc(mboard)->get_sync_source(); } - std::vector<device_addr_t> get_sync_sources(const size_t mboard) + std::vector<device_addr_t> get_sync_sources(const size_t mboard) override { return _get_mbc(mboard)->get_sync_sources(); } - void set_clock_source_out(const bool enb, const size_t mboard = ALL_MBOARDS) + void set_clock_source_out(const bool enb, const size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_clock_source_out, enb); _get_mbc(mboard)->set_clock_source_out(enb); } - void set_time_source_out(const bool enb, const size_t mboard = ALL_MBOARDS) + void set_time_source_out(const bool enb, const size_t mboard = ALL_MBOARDS) override { MUX_MB_API_CALL(set_time_source_out, enb); _get_mbc(mboard)->set_time_source_out(enb); } - size_t get_num_mboards(void) + size_t get_num_mboards(void) override { return _graph->get_num_mboards(); } - sensor_value_t get_mboard_sensor(const std::string& name, size_t mboard = 0) + sensor_value_t get_mboard_sensor(const std::string& name, size_t mboard = 0) override { return _get_mbc(mboard)->get_sensor(name); } - std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) + std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) override { return _get_mbc(mboard)->get_sensor_names(); } // This only works on the USRP2 and B100, both of which are not rfnoc_device - void set_user_register(const uint8_t, const uint32_t, size_t) + void set_user_register(const uint8_t, const uint32_t, size_t) override { throw uhd::not_implemented_error( "set_user_register(): Not implemented on this device!"); } // This only works on the B200, which is not an rfnoc_device - uhd::wb_iface::sptr get_user_settings_iface(const size_t) + uhd::wb_iface::sptr get_user_settings_iface(const size_t) override { return nullptr; } - uhd::rfnoc::radio_control& get_radio_control(const size_t chan = 0) + uhd::rfnoc::radio_control& get_radio_control(const size_t chan = 0) override { return *_get_rx_chan(chan).radio; } @@ -1075,7 +1080,7 @@ public: } void set_rx_subdev_spec( - const uhd::usrp::subdev_spec_t& spec, size_t mboard = ALL_MBOARDS) + const uhd::usrp::subdev_spec_t& spec, size_t mboard = ALL_MBOARDS) override { // First, generate a vector of the RX channels that we need to register auto new_rx_chans = [this, spec, mboard]() { @@ -1127,7 +1132,7 @@ public: } } - uhd::usrp::subdev_spec_t get_rx_subdev_spec(size_t mboard = 0) + uhd::usrp::subdev_spec_t get_rx_subdev_spec(size_t mboard = 0) override { uhd::usrp::subdev_spec_t result; for (size_t rx_chan = 0; rx_chan < get_rx_num_channels(); rx_chan++) { @@ -1143,18 +1148,18 @@ public: return result; } - size_t get_rx_num_channels(void) + size_t get_rx_num_channels(void) override { return _rx_chans.size(); } - std::string get_rx_subdev_name(size_t chan = 0) + std::string get_rx_subdev_name(size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_fe_name(rx_chain.block_chan, uhd::RX_DIRECTION); } - void set_rx_rate(double rate, size_t chan = ALL_CHANS) + void set_rx_rate(double rate, size_t chan = ALL_CHANS) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); MUX_RX_API_CALL(set_rx_rate, rate); @@ -1175,7 +1180,7 @@ public: _rx_rates[chan] = actual_rate; } - void set_rx_spp(const size_t spp, const size_t chan = ALL_CHANS) + void set_rx_spp(const size_t spp, const size_t chan = ALL_CHANS) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); MUX_RX_API_CALL(set_rx_spp, spp); @@ -1184,7 +1189,7 @@ public: "spp", narrow_cast<int>(spp), rx_chain.block_chan); } - double get_rx_rate(size_t chan = 0) + double get_rx_rate(size_t chan = 0) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); auto& rx_chain = _get_rx_chan(chan); @@ -1194,7 +1199,7 @@ public: return rx_chain.radio->get_rate(); } - meta_range_t get_rx_rates(size_t chan = 0) + meta_range_t get_rx_rates(size_t chan = 0) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); auto rx_chain = _get_rx_chan(chan); @@ -1204,7 +1209,8 @@ public: return rx_chain.radio->get_rate_range(); } - tune_result_t set_rx_freq(const tune_request_t& tune_request, size_t chan = 0) + tune_result_t set_rx_freq( + const tune_request_t& tune_request, size_t chan = 0) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); @@ -1254,7 +1260,7 @@ public: tune_request); } - double get_rx_freq(size_t chan = 0) + double get_rx_freq(size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); @@ -1267,7 +1273,7 @@ public: return actual_rf_freq - actual_dsp_freq * RX_SIGN; } - freq_range_t get_rx_freq_range(size_t chan = 0) + freq_range_t get_rx_freq_range(size_t chan = 0) override { auto fe_freq_range = get_fe_rx_freq_range(chan); @@ -1280,7 +1286,7 @@ public: return dsp_freq_range; } - freq_range_t get_fe_rx_freq_range(size_t chan = 0) + freq_range_t get_fe_rx_freq_range(size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_frequency_range(rx_chain.block_chan); @@ -1289,74 +1295,78 @@ public: /************************************************************************** * LO controls *************************************************************************/ - std::vector<std::string> get_rx_lo_names(size_t chan = 0) + std::vector<std::string> get_rx_lo_names(size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_lo_names(rx_chain.block_chan); } - void set_rx_lo_source( - const std::string& src, const std::string& name = ALL_LOS, size_t chan = 0) + void set_rx_lo_source(const std::string& src, + const std::string& name = ALL_LOS, + size_t chan = 0) override { MUX_RX_API_CALL(set_rx_lo_source, src, name); auto rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_lo_source(src, name, rx_chain.block_chan); } - const std::string get_rx_lo_source(const std::string& name = ALL_LOS, size_t chan = 0) + const std::string get_rx_lo_source( + const std::string& name = ALL_LOS, size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_lo_source(name, rx_chain.block_chan); } std::vector<std::string> get_rx_lo_sources( - const std::string& name = ALL_LOS, size_t chan = 0) + const std::string& name = ALL_LOS, size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_lo_sources(name, rx_chain.block_chan); } void set_rx_lo_export_enabled( - bool enabled, const std::string& name = ALL_LOS, size_t chan = 0) + bool enabled, const std::string& name = ALL_LOS, size_t chan = 0) override { MUX_RX_API_CALL(set_rx_lo_export_enabled, enabled, name); auto rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_lo_export_enabled(enabled, name, rx_chain.block_chan); } - bool get_rx_lo_export_enabled(const std::string& name = ALL_LOS, size_t chan = 0) + bool get_rx_lo_export_enabled( + const std::string& name = ALL_LOS, size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_lo_export_enabled(name, rx_chain.block_chan); } - double set_rx_lo_freq(double freq, const std::string& name, size_t chan = 0) + double set_rx_lo_freq(double freq, const std::string& name, size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->set_rx_lo_freq(freq, name, rx_chain.block_chan); } - double get_rx_lo_freq(const std::string& name, size_t chan = 0) + double get_rx_lo_freq(const std::string& name, size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_lo_freq(name, rx_chain.block_chan); } - freq_range_t get_rx_lo_freq_range(const std::string& name, size_t chan = 0) + freq_range_t get_rx_lo_freq_range(const std::string& name, size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_lo_freq_range(name, rx_chain.block_chan); } /*** TX LO API ***/ - std::vector<std::string> get_tx_lo_names(size_t chan = 0) + std::vector<std::string> get_tx_lo_names(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_lo_names(tx_chain.block_chan); } - void set_tx_lo_source( - const std::string& src, const std::string& name = ALL_LOS, const size_t chan = 0) + void set_tx_lo_source(const std::string& src, + const std::string& name = ALL_LOS, + const size_t chan = 0) override { MUX_TX_API_CALL(set_tx_lo_source, src, name); auto tx_chain = _get_tx_chan(chan); @@ -1364,21 +1374,22 @@ public: } const std::string get_tx_lo_source( - const std::string& name = ALL_LOS, const size_t chan = 0) + const std::string& name = ALL_LOS, const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_lo_source(name, tx_chain.block_chan); } std::vector<std::string> get_tx_lo_sources( - const std::string& name = ALL_LOS, const size_t chan = 0) + const std::string& name = ALL_LOS, const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_lo_sources(name, tx_chain.block_chan); } - void set_tx_lo_export_enabled( - const bool enabled, const std::string& name = ALL_LOS, const size_t chan = 0) + void set_tx_lo_export_enabled(const bool enabled, + const std::string& name = ALL_LOS, + const size_t chan = 0) override { MUX_TX_API_CALL(set_tx_lo_export_enabled, enabled, name); auto tx_chain = _get_tx_chan(chan); @@ -1386,26 +1397,27 @@ public: } bool get_tx_lo_export_enabled( - const std::string& name = ALL_LOS, const size_t chan = 0) + const std::string& name = ALL_LOS, const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_lo_export_enabled(name, tx_chain.block_chan); } double set_tx_lo_freq( - const double freq, const std::string& name, const size_t chan = 0) + const double freq, const std::string& name, const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->set_tx_lo_freq(freq, name, tx_chain.block_chan); } - double get_tx_lo_freq(const std::string& name, const size_t chan = 0) + double get_tx_lo_freq(const std::string& name, const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_lo_freq(name, tx_chain.block_chan); } - freq_range_t get_tx_lo_freq_range(const std::string& name, const size_t chan = 0) + freq_range_t get_tx_lo_freq_range( + const std::string& name, const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_lo_freq_range(name, tx_chain.block_chan); @@ -1414,33 +1426,33 @@ public: /************************************************************************** * Gain controls *************************************************************************/ - void set_rx_gain(double gain, const std::string& name, size_t chan = 0) + void set_rx_gain(double gain, const std::string& name, size_t chan = 0) override { MUX_RX_API_CALL(set_rx_gain, gain, name); auto rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_gain(gain, name, rx_chain.block_chan); } - std::vector<std::string> get_rx_gain_profile_names(const size_t chan = 0) + std::vector<std::string> get_rx_gain_profile_names(const size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_gain_profile_names(rx_chain.block_chan); } - void set_rx_gain_profile(const std::string& profile, const size_t chan = 0) + void set_rx_gain_profile(const std::string& profile, const size_t chan = 0) override { MUX_RX_API_CALL(set_rx_gain_profile, profile); auto rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_gain_profile(profile, rx_chain.block_chan); } - std::string get_rx_gain_profile(const size_t chan = 0) + std::string get_rx_gain_profile(const size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_gain_profile(rx_chain.block_chan); } - void set_normalized_rx_gain(double gain, size_t chan = 0) + void set_normalized_rx_gain(double gain, size_t chan = 0) override { if (gain > 1.0 || gain < 0.0) { throw uhd::runtime_error("Normalized gain out of range, must be in [0, 1]."); @@ -1452,20 +1464,20 @@ public: set_rx_gain(abs_gain, ALL_GAINS, chan); } - void set_rx_agc(bool enable, size_t chan = 0) + void set_rx_agc(bool enable, size_t chan = 0) override { MUX_RX_API_CALL(set_rx_agc, enable); auto& rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_agc(enable, rx_chain.block_chan); } - double get_rx_gain(const std::string& name, size_t chan = 0) + double get_rx_gain(const std::string& name, size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_gain(name, rx_chain.block_chan); } - double get_normalized_rx_gain(size_t chan = 0) + double get_normalized_rx_gain(size_t chan = 0) override { gain_range_t gain_range = get_rx_gain_range(ALL_GAINS, chan); const double gain_range_width = gain_range.stop() - gain_range.start(); @@ -1479,120 +1491,121 @@ public: return std::max(std::min(norm_gain, 1.0), 0.0); } - gain_range_t get_rx_gain_range(const std::string& name, size_t chan = 0) + gain_range_t get_rx_gain_range(const std::string& name, size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_gain_range(name, rx_chain.block_chan); } - std::vector<std::string> get_rx_gain_names(size_t chan = 0) + std::vector<std::string> get_rx_gain_names(size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_gain_names(rx_chain.block_chan); } - bool has_rx_power_reference(const size_t chan = 0) + bool has_rx_power_reference(const size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->has_rx_power_reference(rx_chain.block_chan); } - void set_rx_power_reference(const double power_dbm, const size_t chan = 0) + void set_rx_power_reference(const double power_dbm, const size_t chan = 0) override { MUX_RX_API_CALL(set_rx_power_reference, power_dbm); auto& rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_power_reference(power_dbm, rx_chain.block_chan); } - double get_rx_power_reference(const size_t chan = 0) + double get_rx_power_reference(const size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_power_reference(rx_chain.block_chan); } - meta_range_t get_rx_power_range(const size_t chan) + meta_range_t get_rx_power_range(const size_t chan) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_power_range(rx_chain.block_chan); } - void set_rx_antenna(const std::string& ant, size_t chan = 0) + void set_rx_antenna(const std::string& ant, size_t chan = 0) override { MUX_RX_API_CALL(set_rx_antenna, ant); auto& rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_antenna(ant, rx_chain.block_chan); } - std::string get_rx_antenna(size_t chan = 0) + std::string get_rx_antenna(size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_antenna(rx_chain.block_chan); } - std::vector<std::string> get_rx_antennas(size_t chan = 0) + std::vector<std::string> get_rx_antennas(size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_antennas(rx_chain.block_chan); } - void set_rx_bandwidth(double bandwidth, size_t chan = 0) + void set_rx_bandwidth(double bandwidth, size_t chan = 0) override { MUX_RX_API_CALL(set_rx_bandwidth, bandwidth); auto& rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_bandwidth(bandwidth, rx_chain.block_chan); } - double get_rx_bandwidth(size_t chan = 0) + double get_rx_bandwidth(size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_bandwidth(rx_chain.block_chan); } - meta_range_t get_rx_bandwidth_range(size_t chan = 0) + meta_range_t get_rx_bandwidth_range(size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_bandwidth_range(rx_chain.block_chan); } - dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) + dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) override { auto& rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_tree()->access<dboard_iface::sptr>("iface").get(); } - sensor_value_t get_rx_sensor(const std::string& name, size_t chan = 0) + sensor_value_t get_rx_sensor(const std::string& name, size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_sensor(name, rx_chain.block_chan); } - std::vector<std::string> get_rx_sensor_names(size_t chan = 0) + std::vector<std::string> get_rx_sensor_names(size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_sensor_names(rx_chain.block_chan); } - void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) + void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) override { MUX_RX_API_CALL(set_rx_dc_offset, enb); const auto rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_dc_offset(enb, rx_chain.block_chan); } - void set_rx_dc_offset(const std::complex<double>& offset, size_t chan = ALL_CHANS) + void set_rx_dc_offset( + const std::complex<double>& offset, size_t chan = ALL_CHANS) override { MUX_RX_API_CALL(set_rx_dc_offset, offset); const auto rx_chain = _get_rx_chan(chan); rx_chain.radio->set_rx_dc_offset(offset, rx_chain.block_chan); } - meta_range_t get_rx_dc_offset_range(size_t chan = 0) + meta_range_t get_rx_dc_offset_range(size_t chan = 0) override { auto rx_chain = _get_rx_chan(chan); return rx_chain.radio->get_rx_dc_offset_range(rx_chain.block_chan); } - void set_rx_iq_balance(const bool enb, size_t chan) + void set_rx_iq_balance(const bool enb, size_t chan) override { MUX_RX_API_CALL(set_rx_iq_balance, enb); auto rx_chain = _get_rx_chan(chan); @@ -1600,7 +1613,7 @@ public: } void set_rx_iq_balance( - const std::complex<double>& correction, size_t chan = ALL_CHANS) + const std::complex<double>& correction, size_t chan = ALL_CHANS) override { MUX_RX_API_CALL(set_rx_iq_balance, correction); const auto rx_chain = _get_rx_chan(chan); @@ -1707,7 +1720,7 @@ public: } void set_tx_subdev_spec( - const uhd::usrp::subdev_spec_t& spec, size_t mboard = ALL_MBOARDS) + const uhd::usrp::subdev_spec_t& spec, size_t mboard = ALL_MBOARDS) override { /* TODO: Refactor with get_rx_subdev_spec- the algorithms are the same, just the * types are different @@ -1762,7 +1775,7 @@ public: } } - uhd::usrp::subdev_spec_t get_tx_subdev_spec(size_t mboard = 0) + uhd::usrp::subdev_spec_t get_tx_subdev_spec(size_t mboard = 0) override { uhd::usrp::subdev_spec_t result; for (size_t tx_chan = 0; tx_chan < get_tx_num_channels(); tx_chan++) { @@ -1778,18 +1791,18 @@ public: return result; } - size_t get_tx_num_channels(void) + size_t get_tx_num_channels(void) override { return _tx_chans.size(); } - std::string get_tx_subdev_name(size_t chan = 0) + std::string get_tx_subdev_name(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_fe_name(tx_chain.block_chan, uhd::TX_DIRECTION); } - void set_tx_rate(double rate, size_t chan = ALL_CHANS) + void set_tx_rate(double rate, size_t chan = ALL_CHANS) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); MUX_TX_API_CALL(set_tx_rate, rate); @@ -1810,7 +1823,7 @@ public: _tx_rates[chan] = actual_rate; } - double get_tx_rate(size_t chan = 0) + double get_tx_rate(size_t chan = 0) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); auto& tx_chain = _get_tx_chan(chan); @@ -1820,7 +1833,7 @@ public: return tx_chain.radio->get_rate(); } - meta_range_t get_tx_rates(size_t chan = 0) + meta_range_t get_tx_rates(size_t chan = 0) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); auto tx_chain = _get_tx_chan(chan); @@ -1830,7 +1843,8 @@ public: return tx_chain.radio->get_rate_range(); } - tune_result_t set_tx_freq(const tune_request_t& tune_request, size_t chan = 0) + tune_result_t set_tx_freq( + const tune_request_t& tune_request, size_t chan = 0) override { std::lock_guard<std::recursive_mutex> l(_graph_mutex); auto tx_chain = _get_tx_chan(chan); @@ -1877,7 +1891,7 @@ public: tune_request); } - double get_tx_freq(size_t chan = 0) + double get_tx_freq(size_t chan = 0) override { auto& tx_chain = _get_tx_chan(chan); // extract actual dsp and IF frequencies @@ -1889,7 +1903,7 @@ public: return actual_rf_freq - actual_dsp_freq * TX_SIGN; } - freq_range_t get_tx_freq_range(size_t chan = 0) + freq_range_t get_tx_freq_range(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return (tx_chain.duc) @@ -1899,39 +1913,39 @@ public: : get_fe_tx_freq_range(chan); } - freq_range_t get_fe_tx_freq_range(size_t chan = 0) + freq_range_t get_fe_tx_freq_range(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_frequency_range(tx_chain.block_chan); } - void set_tx_gain(double gain, const std::string& name, size_t chan = 0) + void set_tx_gain(double gain, const std::string& name, size_t chan = 0) override { MUX_TX_API_CALL(set_tx_gain, gain, name); auto tx_chain = _get_tx_chan(chan); tx_chain.radio->set_tx_gain(gain, name, tx_chain.block_chan); } - std::vector<std::string> get_tx_gain_profile_names(const size_t chan = 0) + std::vector<std::string> get_tx_gain_profile_names(const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_gain_profile_names(tx_chain.block_chan); } - void set_tx_gain_profile(const std::string& profile, const size_t chan = 0) + void set_tx_gain_profile(const std::string& profile, const size_t chan = 0) override { MUX_TX_API_CALL(set_tx_gain_profile, profile); auto tx_chain = _get_tx_chan(chan); tx_chain.radio->set_tx_gain_profile(profile, tx_chain.block_chan); } - std::string get_tx_gain_profile(const size_t chan = 0) + std::string get_tx_gain_profile(const size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_gain_profile(tx_chain.block_chan); } - void set_normalized_tx_gain(double gain, size_t chan = 0) + void set_normalized_tx_gain(double gain, size_t chan = 0) override { if (gain > 1.0 || gain < 0.0) { throw uhd::runtime_error("Normalized gain out of range, must be in [0, 1]."); @@ -1943,13 +1957,13 @@ public: set_tx_gain(abs_gain, ALL_GAINS, chan); } - double get_tx_gain(const std::string& name, size_t chan = 0) + double get_tx_gain(const std::string& name, size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_gain(name, tx_chain.block_chan); } - double get_normalized_tx_gain(size_t chan = 0) + double get_normalized_tx_gain(size_t chan = 0) override { gain_range_t gain_range = get_tx_gain_range(ALL_GAINS, chan); const double gain_range_width = gain_range.stop() - gain_range.start(); @@ -1963,114 +1977,115 @@ public: return std::max(std::min(norm_gain, 1.0), 0.0); } - gain_range_t get_tx_gain_range(const std::string& name, size_t chan = 0) + gain_range_t get_tx_gain_range(const std::string& name, size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_gain_range(name, tx_chain.block_chan); } - std::vector<std::string> get_tx_gain_names(size_t chan = 0) + std::vector<std::string> get_tx_gain_names(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_gain_names(tx_chain.block_chan); } - bool has_tx_power_reference(const size_t chan = 0) + bool has_tx_power_reference(const size_t chan = 0) override { auto& tx_chain = _get_tx_chan(chan); return tx_chain.radio->has_rx_power_reference(tx_chain.block_chan); } - void set_tx_power_reference(const double power_dbm, const size_t chan = 0) + void set_tx_power_reference(const double power_dbm, const size_t chan = 0) override { MUX_TX_API_CALL(set_tx_power_reference, power_dbm); auto& tx_chain = _get_tx_chan(chan); tx_chain.radio->set_tx_power_reference(power_dbm, tx_chain.block_chan); } - double get_tx_power_reference(const size_t chan = 0) + double get_tx_power_reference(const size_t chan = 0) override { auto& tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_power_reference(tx_chain.block_chan); } - meta_range_t get_tx_power_range(const size_t chan) + meta_range_t get_tx_power_range(const size_t chan) override { auto& tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_power_range(tx_chain.block_chan); } - void set_tx_antenna(const std::string& ant, size_t chan = 0) + void set_tx_antenna(const std::string& ant, size_t chan = 0) override { MUX_TX_API_CALL(set_tx_antenna, ant); auto tx_chain = _get_tx_chan(chan); tx_chain.radio->set_tx_antenna(ant, tx_chain.block_chan); } - std::string get_tx_antenna(size_t chan = 0) + std::string get_tx_antenna(size_t chan = 0) override { auto& tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_antenna(tx_chain.block_chan); } - std::vector<std::string> get_tx_antennas(size_t chan = 0) + std::vector<std::string> get_tx_antennas(size_t chan = 0) override { auto& tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_antennas(tx_chain.block_chan); } - void set_tx_bandwidth(double bandwidth, size_t chan = 0) + void set_tx_bandwidth(double bandwidth, size_t chan = 0) override { MUX_TX_API_CALL(set_tx_bandwidth, bandwidth); auto tx_chain = _get_tx_chan(chan); tx_chain.radio->set_tx_bandwidth(bandwidth, tx_chain.block_chan); } - double get_tx_bandwidth(size_t chan = 0) + double get_tx_bandwidth(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_bandwidth(tx_chain.block_chan); } - meta_range_t get_tx_bandwidth_range(size_t chan = 0) + meta_range_t get_tx_bandwidth_range(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_bandwidth_range(tx_chain.block_chan); } - dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) + dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) override { auto& tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tree()->access<dboard_iface::sptr>("iface").get(); } - sensor_value_t get_tx_sensor(const std::string& name, size_t chan = 0) + sensor_value_t get_tx_sensor(const std::string& name, size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_sensor(name, tx_chain.block_chan); } - std::vector<std::string> get_tx_sensor_names(size_t chan = 0) + std::vector<std::string> get_tx_sensor_names(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_sensor_names(tx_chain.block_chan); } - void set_tx_dc_offset(const std::complex<double>& offset, size_t chan = ALL_CHANS) + void set_tx_dc_offset( + const std::complex<double>& offset, size_t chan = ALL_CHANS) override { MUX_TX_API_CALL(set_tx_dc_offset, offset); const auto tx_chain = _get_tx_chan(chan); tx_chain.radio->set_tx_dc_offset(offset, tx_chain.block_chan); } - meta_range_t get_tx_dc_offset_range(size_t chan = 0) + meta_range_t get_tx_dc_offset_range(size_t chan = 0) override { auto tx_chain = _get_tx_chan(chan); return tx_chain.radio->get_tx_dc_offset_range(tx_chain.block_chan); } void set_tx_iq_balance( - const std::complex<double>& correction, size_t chan = ALL_CHANS) + const std::complex<double>& correction, size_t chan = ALL_CHANS) override { MUX_TX_API_CALL(set_tx_iq_balance, correction); const auto tx_chain = _get_tx_chan(chan); @@ -2133,7 +2148,7 @@ public: return {radio, normalized_bank}; } - std::vector<std::string> get_gpio_banks(const size_t mboard) + std::vector<std::string> get_gpio_banks(const size_t mboard) override { auto radio_blocks = _graph->find_blocks<uhd::rfnoc::radio_control>( std::to_string(mboard) + "/Radio"); @@ -2153,7 +2168,7 @@ public: const std::string& attr, const uint32_t value, const uint32_t mask = 0xffffffff, - const size_t mboard = 0) + const size_t mboard = 0) override { auto radio_bank_pair = _get_gpio_radio_bank(bank, mboard); const uint32_t current = @@ -2162,33 +2177,34 @@ public: radio_bank_pair.first->set_gpio_attr(radio_bank_pair.second, attr, new_value); } - uint32_t get_gpio_attr( - const std::string& bank, const std::string& attr, const size_t mboard = 0) + uint32_t get_gpio_attr(const std::string& bank, + const std::string& attr, + const size_t mboard = 0) override { auto radio_bank_pair = _get_gpio_radio_bank(bank, mboard); return radio_bank_pair.first->get_gpio_attr(radio_bank_pair.second, attr); } - std::vector<std::string> get_gpio_src_banks(const size_t mboard = 0) + std::vector<std::string> get_gpio_src_banks(const size_t mboard = 0) override { return _get_mbc(mboard)->get_gpio_banks(); } std::vector<std::string> get_gpio_srcs( - const std::string& bank, const size_t mboard = 0) + const std::string& bank, const size_t mboard = 0) override { return _get_mbc(mboard)->get_gpio_srcs(bank); } std::vector<std::string> get_gpio_src( - const std::string& bank, const size_t mboard = 0) + const std::string& bank, const size_t mboard = 0) override { return _get_mbc(mboard)->get_gpio_src(bank); } void set_gpio_src(const std::string& bank, const std::vector<std::string>& src, - const size_t mboard = 0) + const size_t mboard = 0) override { _get_mbc(mboard)->set_gpio_src(bank, src); } @@ -2196,7 +2212,7 @@ public: /******************************************************************* * Filter API methods ******************************************************************/ - std::vector<std::string> get_rx_filter_names(const size_t chan) + std::vector<std::string> get_rx_filter_names(const size_t chan) override { std::vector<std::string> filter_names; // Grab the Radio's filters @@ -2238,7 +2254,8 @@ public: return filter_names; } - uhd::filter_info_base::sptr get_rx_filter(const std::string& name, const size_t chan) + uhd::filter_info_base::sptr get_rx_filter( + const std::string& name, const size_t chan) override { try { // The block_id_t constructor is pretty smart; let it handle the parsing. @@ -2276,8 +2293,9 @@ public: } } - void set_rx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan) + void set_rx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) override { MUX_RX_API_CALL(set_rx_filter, name, filter); try { @@ -2317,7 +2335,7 @@ public: } } - std::vector<std::string> get_tx_filter_names(const size_t chan) + std::vector<std::string> get_tx_filter_names(const size_t chan) override { std::vector<std::string> filter_names; // Grab the Radio's filters @@ -2359,7 +2377,8 @@ public: return filter_names; } - uhd::filter_info_base::sptr get_tx_filter(const std::string& name, const size_t chan) + uhd::filter_info_base::sptr get_tx_filter( + const std::string& name, const size_t chan) override { try { // The block_id_t constructor is pretty smart; let it handle the parsing. @@ -2397,8 +2416,9 @@ public: } } - void set_tx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan) + void set_tx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) override { MUX_TX_API_CALL(set_tx_filter, name, filter); try { @@ -2438,7 +2458,7 @@ public: } } - mb_controller& get_mb_controller(const size_t mboard) + mb_controller& get_mb_controller(const size_t mboard) override { return *_get_mbc(mboard); } diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index 0d271e832..657584e92 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.cpp @@ -63,7 +63,7 @@ subdev_spec_t::subdev_spec_t(const std::string& markup) std::string subdev_spec_t::to_pp_string(void) const { - if (this->size() == 0) + if (this->empty()) return "Empty Subdevice Specification"; std::stringstream ss; diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp index 8ad7a5466..7d2a44f39 100644 --- a/host/lib/usrp/usrp1/dboard_iface.cpp +++ b/host/lib/usrp/usrp1/dboard_iface.cpp @@ -81,12 +81,12 @@ public: // else _codec->bypass_adc_buffers(false); //don't think this is necessary } - ~usrp1_dboard_iface() + ~usrp1_dboard_iface() override { /* NOP */ } - special_props_t get_special_props() + special_props_t get_special_props() override { special_props_t props; props.soft_clock_divider = true; @@ -94,44 +94,44 @@ public: return props; } - void write_aux_dac(unit_t, aux_dac_t, double); - double read_aux_adc(unit_t, aux_adc_t); + void write_aux_dac(unit_t, aux_dac_t, double) override; + double read_aux_adc(unit_t, aux_adc_t) override; - void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_pin_ctrl(unit_t unit); + void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_pin_ctrl(unit_t unit) override; void set_atr_reg( - unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_atr_reg(unit_t unit, atr_reg_t reg); - void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_ddr(unit_t unit); - void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_out(unit_t unit); - uint32_t read_gpio(unit_t unit); + unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_atr_reg(unit_t unit, atr_reg_t reg) override; + void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_ddr(unit_t unit) override; + void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_out(unit_t unit) override; + uint32_t read_gpio(unit_t unit) override; void _set_pin_ctrl(unit_t, uint16_t); void _set_atr_reg(unit_t, atr_reg_t, uint16_t); void _set_gpio_ddr(unit_t, uint16_t); void _set_gpio_out(unit_t, uint16_t); - void set_command_time(const uhd::time_spec_t& t); - uhd::time_spec_t get_command_time(void); + void set_command_time(const uhd::time_spec_t& t) override; + uhd::time_spec_t get_command_time(void) override; - void write_i2c(uint16_t, const byte_vector_t&); - byte_vector_t read_i2c(uint16_t, size_t); + void write_i2c(uint16_t, const byte_vector_t&) override; + byte_vector_t read_i2c(uint16_t, size_t) override; void write_spi( - unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits); + unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) override; uint32_t read_write_spi( - unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits); + unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) override; - void set_clock_rate(unit_t, double); - std::vector<double> get_clock_rates(unit_t); - double get_clock_rate(unit_t); - void set_clock_enabled(unit_t, bool); - double get_codec_rate(unit_t); + void set_clock_rate(unit_t, double) override; + std::vector<double> get_clock_rates(unit_t) override; + double get_clock_rate(unit_t) override; + void set_clock_enabled(unit_t, bool) override; + double get_codec_rate(unit_t) override; void set_fe_connection( - unit_t unit, const std::string&, const fe_connection_t& fe_conn); + unit_t unit, const std::string&, const fe_connection_t& fe_conn) override; private: usrp1_iface::sptr _iface; diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 4788c3d9e..b93cfa094 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -86,7 +86,7 @@ public: /* NOP */ } - void release(void) + void release(void) override { this->_commit_cb(_curr_buff, _next_buff, size()); } @@ -337,12 +337,12 @@ public: _stc = stc; } - size_t get_num_channels(void) const + size_t get_num_channels(void) const override { return this->size(); } - size_t get_max_num_samps(void) const + size_t get_max_num_samps(void) const override { return _max_num_samps; } @@ -351,7 +351,7 @@ public: const size_t nsamps_per_buff, uhd::rx_metadata_t& metadata, const double timeout, - const bool one_packet) + const bool one_packet) override { // interleave a "soft" inline message into the receive stream: if (_stc->get_inline_queue().pop_with_haste(metadata)) @@ -363,7 +363,7 @@ public: return _stc->recv_post(metadata, num_samps_recvd); } - void issue_stream_cmd(const stream_cmd_t& stream_cmd) + void issue_stream_cmd(const stream_cmd_t& stream_cmd) override { _stc->issue_stream_cmd(stream_cmd); } @@ -389,12 +389,12 @@ public: _tx_enb_fcn = tx_enb_fcn; } - size_t get_num_channels(void) const + size_t get_num_channels(void) const override { return this->size(); } - size_t get_max_num_samps(void) const + size_t get_max_num_samps(void) const override { return _max_num_samps; } @@ -402,7 +402,7 @@ public: size_t send(const tx_streamer::buffs_type& buffs, const size_t nsamps_per_buff, const uhd::tx_metadata_t& metadata, - const double timeout_) + const double timeout_) override { double timeout = timeout_; // rw copy _stc->send_pre(metadata, timeout); @@ -426,7 +426,7 @@ public: return num_samps_sent; } - bool recv_async_msg(async_metadata_t& async_metadata, double timeout = 0.1) + bool recv_async_msg(async_metadata_t& async_metadata, double timeout = 0.1) override { return _stc->get_async_queue().pop_with_timed_wait(async_metadata, timeout); } diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp index 42a1e9712..1c3015480 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp @@ -50,13 +50,13 @@ public: /******************************************************************* * Time control ******************************************************************/ - void set_time(const time_spec_t& time) + void set_time(const time_spec_t& time) override { boost::mutex::scoped_lock lock(_update_mutex); _time_offset = uhd::get_system_time() - time; } - time_spec_t get_time(void) + time_spec_t get_time(void) override { boost::mutex::scoped_lock lock(_update_mutex); return time_now(); @@ -80,7 +80,7 @@ public: /******************************************************************* * Receive control ******************************************************************/ - size_t recv_post(rx_metadata_t& md, const size_t nsamps) + size_t recv_post(rx_metadata_t& md, const size_t nsamps) override { boost::mutex::scoped_lock lock(_update_mutex); @@ -125,7 +125,7 @@ public: return nsamps; } - void issue_stream_cmd(const stream_cmd_t& cmd) + void issue_stream_cmd(const stream_cmd_t& cmd) override { _cmd_queue.push_with_wait(std::make_shared<stream_cmd_t>(cmd)); } @@ -139,7 +139,7 @@ public: /******************************************************************* * Transmit control ******************************************************************/ - void send_pre(const tx_metadata_t& md, double& timeout) + void send_pre(const tx_metadata_t& md, double& timeout) override { if (not md.has_time_spec) return; @@ -211,17 +211,17 @@ public: } } - bounded_buffer<async_metadata_t>& get_async_queue(void) + bounded_buffer<async_metadata_t>& get_async_queue(void) override { return _async_msg_queue; } - bounded_buffer<rx_metadata_t>& get_inline_queue(void) + bounded_buffer<rx_metadata_t>& get_inline_queue(void) override { return _inline_msg_queue; } - void stop(void) + void stop(void) override { _recv_cmd_task.reset(); } diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 574dec51c..bcd416769 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -28,7 +28,7 @@ public: _ctrl_transport = ctrl_transport; } - ~usrp1_iface_impl(void) + ~usrp1_iface_impl(void) override { /* NOP */ } @@ -36,7 +36,7 @@ public: /******************************************************************* * Peek and Poke ******************************************************************/ - void poke32(const uint32_t addr, const uint32_t value) + void poke32(const uint32_t addr, const uint32_t value) override { uint32_t swapped = uhd::htonx(value); @@ -56,7 +56,7 @@ public: throw uhd::io_error("USRP1: failed control write"); } - uint32_t peek32(const uint32_t addr) + uint32_t peek32(const uint32_t addr) override { UHD_LOGGER_TRACE("USRP1") << "peek32(" << std::dec << std::setw(2) << addr << ")"; @@ -77,12 +77,12 @@ public: return uhd::ntohx(value_out); } - void poke16(const uint32_t, const uint16_t) + void poke16(const uint32_t, const uint16_t) override { throw uhd::not_implemented_error("Unhandled command poke16()"); } - uint16_t peek16(const uint32_t) + uint16_t peek16(const uint32_t) override { throw uhd::not_implemented_error("Unhandled command peek16()"); return 0; @@ -91,12 +91,12 @@ public: /******************************************************************* * I2C ******************************************************************/ - void write_i2c(uint16_t addr, const byte_vector_t& bytes) + void write_i2c(uint16_t addr, const byte_vector_t& bytes) override { return _ctrl_transport->write_i2c(addr, bytes); } - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { return _ctrl_transport->read_i2c(addr, num_bytes); } @@ -116,7 +116,7 @@ public: const spi_config_t&, uint32_t bits, size_t num_bits, - bool readback) + bool readback) override { UHD_LOGGER_TRACE("USRP1") << "transact_spi: " diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index d86bf6d56..6ed1a6a69 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -439,9 +439,9 @@ usrp1_impl::usrp1_impl(const device_addr_t& device_addr) _tree->access<double>(mb_path / "rx_dsps" / name / "freq" / "value").set(0.0); } - if (_tree->list(mb_path / "rx_dsps").size() > 0) + if (!_tree->list(mb_path / "rx_dsps").empty()) _tree->access<subdev_spec_t>(mb_path / "rx_subdev_spec").set(_rx_subdev_spec); - if (_tree->list(mb_path / "tx_dsps").size() > 0) + if (!_tree->list(mb_path / "tx_dsps").empty()) _tree->access<subdev_spec_t>(mb_path / "tx_subdev_spec").set(_tx_subdev_spec); _tree->create<double>(mb_path / "link_max_rate").set(USRP1_MAX_RATE_USB2); } diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 336b82baa..a7f205c4a 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -63,12 +63,12 @@ public: // structors usrp1_impl(const uhd::device_addr_t&); - ~usrp1_impl(void); + ~usrp1_impl(void) override; // the io interface - uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args); - uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args); - bool recv_async_msg(uhd::async_metadata_t&, double); + uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args) override; + uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args) override; + bool recv_async_msg(uhd::async_metadata_t&, double) override; static uhd::usrp::mboard_eeprom_t get_mb_eeprom(uhd::i2c_iface::sptr); diff --git a/host/lib/usrp/usrp2/n200_image_loader.cpp b/host/lib/usrp/usrp2/n200_image_loader.cpp index 55b441c8b..9080a6dee 100644 --- a/host/lib/usrp/usrp2/n200_image_loader.cpp +++ b/host/lib/usrp/usrp2/n200_image_loader.cpp @@ -154,15 +154,15 @@ static void print_usrp2_error(const image_loader::image_loader_args_t& image_loa if (image_loader_args.load_firmware) { usrp2_card_burner_gui += str(boost::format("%s--fw=\"%s\"") % nl - % ((image_loader_args.firmware_path == "") - ? find_image_path("usrp2_fw.bin") - : image_loader_args.firmware_path)); + % ((image_loader_args.firmware_path.empty()) + ? find_image_path("usrp2_fw.bin") + : image_loader_args.firmware_path)); } if (image_loader_args.load_fpga) { - usrp2_card_burner_gui += - str(boost::format("%s--fpga=\"%s\"") % nl - % ((image_loader_args.fpga_path == "") ? find_image_path("usrp2_fpga.bin") - : image_loader_args.fpga_path)); + usrp2_card_burner_gui += str( + boost::format("%s--fpga=\"%s\"") % nl + % ((image_loader_args.fpga_path.empty()) ? find_image_path("usrp2_fpga.bin") + : image_loader_args.fpga_path)); } throw uhd::runtime_error(str( @@ -204,7 +204,7 @@ static uhd::device_addr_t n200_find( uhd::device_addrs_t found = usrp2_find(image_loader_args.args); - if (found.size() > 0) { + if (!found.empty()) { uhd::device_addrs_t n200_found; udp_simple::sptr rev_xport; n200_fw_update_data_t pkt_out; @@ -355,8 +355,8 @@ static void n200_setup_session(n200_session_t& session, * EEPROM or is otherwise unable to provide its revision, this is * impossible, and the user must manually provide a firmware file. */ - if ((session.fw and image_loader_args.firmware_path == "") - or image_loader_args.fpga_path == "") { + if ((session.fw and image_loader_args.firmware_path.empty()) + or image_loader_args.fpga_path.empty()) { if (session.dev_addr["hw_rev"] == "n2xx") { throw uhd::runtime_error("This device's revision cannot be determined. " "You must manually specify a filepath."); diff --git a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp index ca3a79ca5..116051216 100644 --- a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp +++ b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp @@ -45,7 +45,7 @@ public: this->init_spi(); } - ~usrp2_fifo_ctrl_impl(void) + ~usrp2_fifo_ctrl_impl(void) override { _timeout = ACK_TIMEOUT; // reset timeout to something small UHD_SAFE_CALL( @@ -56,7 +56,7 @@ public: /******************************************************************* * Peek and poke 32 bit implementation ******************************************************************/ - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { boost::mutex::scoped_lock lock(_mutex); @@ -65,7 +65,7 @@ public: this->wait_for_ack(_seq_out - MAX_SEQS_OUT); } - uint32_t peek32(const wb_addr_type addr) + uint32_t peek32(const wb_addr_type addr) override { boost::mutex::scoped_lock lock(_mutex); @@ -77,12 +77,12 @@ public: /******************************************************************* * Peek and poke 16 bit not implemented ******************************************************************/ - void poke16(const wb_addr_type, const uint16_t) + void poke16(const wb_addr_type, const uint16_t) override { throw uhd::not_implemented_error("poke16 not implemented in fifo ctrl module"); } - uint16_t peek16(const wb_addr_type) + uint16_t peek16(const wb_addr_type) override { throw uhd::not_implemented_error("peek16 not implemented in fifo ctrl module"); } @@ -104,7 +104,7 @@ public: const spi_config_t& config, uint32_t data, size_t num_bits, - bool readback) + bool readback) override { boost::mutex::scoped_lock lock(_mutex); @@ -143,7 +143,7 @@ public: /******************************************************************* * Update methods for time ******************************************************************/ - void set_time(const uhd::time_spec_t& time) + void set_time(const uhd::time_spec_t& time) override { boost::mutex::scoped_lock lock(_mutex); _time = time; @@ -152,13 +152,13 @@ public: _timeout = MASSIVE_TIMEOUT; // permanently sets larger timeout } - uhd::time_spec_t get_time() + uhd::time_spec_t get_time() override { boost::mutex::scoped_lock lock(_mutex); return _time; } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { boost::mutex::scoped_lock lock(_mutex); _tick_rate = rate; diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 029d2b30a..23104d18f 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -76,7 +76,7 @@ public: mb_eeprom = usrp2_impl::get_mb_eeprom(*this); } - ~usrp2_iface_impl(void) + ~usrp2_iface_impl(void) override { UHD_SAFE_CALL(this->lock_device(false);) } @@ -85,7 +85,7 @@ public: * Device locking **********************************************************************/ - void lock_device(bool lock) + void lock_device(bool lock) override { if (lock) { this->pokefw(U2_FW_REG_LOCK_GPID, get_process_hash()); @@ -96,7 +96,7 @@ public: } } - bool is_device_locked(void) + bool is_device_locked(void) override { // never assume lock with fpga image mismatch if ((this->peek32(U2_REG_COMPAT_NUM_RB) >> 16) != USRP2_FPGA_COMPAT_NUM) @@ -135,32 +135,32 @@ public: /*********************************************************************** * Peek and Poke **********************************************************************/ - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { this->get_reg<uint32_t, USRP2_REG_ACTION_FPGA_POKE32>(addr, data); } - uint32_t peek32(const wb_addr_type addr) + uint32_t peek32(const wb_addr_type addr) override { return this->get_reg<uint32_t, USRP2_REG_ACTION_FPGA_PEEK32>(addr); } - void poke16(const wb_addr_type addr, const uint16_t data) + void poke16(const wb_addr_type addr, const uint16_t data) override { this->get_reg<uint16_t, USRP2_REG_ACTION_FPGA_POKE16>(addr, data); } - uint16_t peek16(const wb_addr_type addr) + uint16_t peek16(const wb_addr_type addr) override { return this->get_reg<uint16_t, USRP2_REG_ACTION_FPGA_PEEK16>(addr); } - void pokefw(wb_addr_type addr, uint32_t data) + void pokefw(wb_addr_type addr, uint32_t data) override { this->get_reg<uint32_t, USRP2_REG_ACTION_FW_POKE32>(addr, data); } - uint32_t peekfw(wb_addr_type addr) + uint32_t peekfw(wb_addr_type addr) override { return this->get_reg<uint32_t, USRP2_REG_ACTION_FW_PEEK32>(addr); } @@ -189,7 +189,7 @@ public: const spi_config_t& config, uint32_t data, size_t num_bits, - bool readback) + bool readback) override { static const uhd::dict<spi_config_t::edge_t, int> spi_edge_to_otw = boost::assign::map_list_of(spi_config_t::EDGE_RISE, USRP2_CLK_EDGE_RISE)( @@ -216,7 +216,7 @@ public: /*********************************************************************** * I2C **********************************************************************/ - void write_i2c(uint16_t addr, const byte_vector_t& buf) + void write_i2c(uint16_t addr, const byte_vector_t& buf) override { // setup the out data usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t(); @@ -236,7 +236,7 @@ public: UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_COOL_IM_DONE_I2C_WRITE_DUDE); } - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { // setup the out data usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t(); @@ -324,7 +324,7 @@ public: throw timeout_error("no control response, possible packet loss"); } - rev_type get_rev(void) + rev_type get_rev(void) override { std::string hw = mb_eeprom["hardware"]; if (hw.empty()) @@ -347,7 +347,7 @@ public: return USRP_NXXX; // unknown type } - const std::string get_cname(void) + const std::string get_cname(void) override { switch (this->get_rev()) { case USRP2_REV3: @@ -368,14 +368,14 @@ public: UHD_THROW_INVALID_CODE_PATH(); } - const std::string get_fw_version_string(void) + const std::string get_fw_version_string(void) override { uint32_t minor = this->get_reg<uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_VER_MINOR); return str(boost::format("%u.%u") % _protocol_compat % minor); } - std::string images_warn_help_message(void) + std::string images_warn_help_message(void) override { // determine the images names std::string fw_image, fpga_image; @@ -457,12 +457,12 @@ public: } } - void set_time(const time_spec_t&) + void set_time(const time_spec_t&) override { throw uhd::not_implemented_error("Timed commands not supported"); } - time_spec_t get_time(void) + time_spec_t get_time(void) override { return (0.0); } diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 792c38a11..14e6ed993 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -61,12 +61,12 @@ class usrp2_impl : public uhd::device { public: usrp2_impl(const uhd::device_addr_t&); - ~usrp2_impl(void); + ~usrp2_impl(void) override; // the io interface - uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args); - uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args); - bool recv_async_msg(uhd::async_metadata_t&, double); + uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args) override; + uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args) override; + bool recv_async_msg(uhd::async_metadata_t&, double) override; static uhd::usrp::mboard_eeprom_t get_mb_eeprom(usrp2_iface&); diff --git a/host/lib/usrp/x300/x300_dac_ctrl.cpp b/host/lib/usrp/x300/x300_dac_ctrl.cpp index 3a3dc7389..1254e035e 100644 --- a/host/lib/usrp/x300/x300_dac_ctrl.cpp +++ b/host/lib/usrp/x300/x300_dac_ctrl.cpp @@ -48,7 +48,7 @@ public: reset(); } - ~x300_dac_ctrl_impl(void) + ~x300_dac_ctrl_impl(void) override { UHD_SAFE_CALL( // Power down all DAC subsystems @@ -59,7 +59,7 @@ public: ) } - void reset() + void reset() override { // ADI recommendations: //- soft reset the chip before configuration @@ -75,7 +75,7 @@ public: _sleep_mode(false); } - void sync() + void sync() override { try { // Just return if PLL is locked and backend is synchronized @@ -102,7 +102,7 @@ public: throw uhd::runtime_error(err_str); } - void verify_sync() + void verify_sync() override { _check_pll(); _check_dac_sync(); diff --git a/host/lib/usrp/x300/x300_dboard_iface.hpp b/host/lib/usrp/x300/x300_dboard_iface.hpp index 713c90748..607fe10dc 100644 --- a/host/lib/usrp/x300/x300_dboard_iface.hpp +++ b/host/lib/usrp/x300/x300_dboard_iface.hpp @@ -36,9 +36,9 @@ class x300_dboard_iface : public uhd::usrp::dboard_iface { public: x300_dboard_iface(const x300_dboard_iface_config_t& config); - ~x300_dboard_iface(void); + ~x300_dboard_iface(void) override; - inline special_props_t get_special_props(void) + inline special_props_t get_special_props(void) override { special_props_t props; props.soft_clock_divider = false; @@ -46,39 +46,44 @@ public: return props; } - void write_aux_dac(unit_t, aux_dac_t, double); - double read_aux_adc(unit_t, aux_adc_t); + void write_aux_dac(unit_t, aux_dac_t, double) override; + double read_aux_adc(unit_t, aux_adc_t) override; - void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_pin_ctrl(unit_t unit); + void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_pin_ctrl(unit_t unit) override; void set_atr_reg( - unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_atr_reg(unit_t unit, atr_reg_t reg); - void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_ddr(unit_t unit); - void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_out(unit_t unit); - uint32_t read_gpio(unit_t unit); - - void set_command_time(const uhd::time_spec_t& t); - uhd::time_spec_t get_command_time(void); - - void write_i2c(uint16_t, const uhd::byte_vector_t&); - uhd::byte_vector_t read_i2c(uint16_t, size_t); - - void set_clock_rate(unit_t, double); - double get_clock_rate(unit_t); - std::vector<double> get_clock_rates(unit_t); - void set_clock_enabled(unit_t, bool); - double get_codec_rate(unit_t); - - void write_spi( - unit_t unit, const uhd::spi_config_t& config, uint32_t data, size_t num_bits); - - uint32_t read_write_spi( - unit_t unit, const uhd::spi_config_t& config, uint32_t data, size_t num_bits); - void set_fe_connection( - unit_t unit, const std::string& name, const uhd::usrp::fe_connection_t& fe_conn); + unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_atr_reg(unit_t unit, atr_reg_t reg) override; + void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_ddr(unit_t unit) override; + void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_out(unit_t unit) override; + uint32_t read_gpio(unit_t unit) override; + + void set_command_time(const uhd::time_spec_t& t) override; + uhd::time_spec_t get_command_time(void) override; + + void write_i2c(uint16_t, const uhd::byte_vector_t&) override; + uhd::byte_vector_t read_i2c(uint16_t, size_t) override; + + void set_clock_rate(unit_t, double) override; + double get_clock_rate(unit_t) override; + std::vector<double> get_clock_rates(unit_t) override; + void set_clock_enabled(unit_t, bool) override; + double get_codec_rate(unit_t) override; + + void write_spi(unit_t unit, + const uhd::spi_config_t& config, + uint32_t data, + size_t num_bits) override; + + uint32_t read_write_spi(unit_t unit, + const uhd::spi_config_t& config, + uint32_t data, + size_t num_bits) override; + void set_fe_connection(unit_t unit, + const std::string& name, + const uhd::usrp::fe_connection_t& fe_conn) override; // X300 can set the FE connection on the RX side bool has_set_fe_connection(const unit_t unit) override diff --git a/host/lib/usrp/x300/x300_device_args.hpp b/host/lib/usrp/x300/x300_device_args.hpp index 7e17c36ce..3a620f7de 100644 --- a/host/lib/usrp/x300/x300_device_args.hpp +++ b/host/lib/usrp/x300/x300_device_args.hpp @@ -146,7 +146,7 @@ public: return _orig_args; } - inline virtual std::string to_string() const + inline std::string to_string() const override { // We leave out blank_eeprom for safety reasons return (!_first_addr.get().empty() ? (_first_addr.to_string() + ", ") : "") @@ -185,7 +185,7 @@ public: } private: - virtual void _parse(const device_addr_t& dev_args) + void _parse(const device_addr_t& dev_args) override { _orig_args = dev_args; // Extract parameters from dev_args diff --git a/host/lib/usrp/x300/x300_eth_mgr.cpp b/host/lib/usrp/x300/x300_eth_mgr.cpp index 8cdba38cc..d7b8b15c4 100644 --- a/host/lib/usrp/x300/x300_eth_mgr.cpp +++ b/host/lib/usrp/x300/x300_eth_mgr.cpp @@ -555,7 +555,7 @@ void eth_manager::discover_eth( } } - if (eth_conns.size() == 0) { + if (eth_conns.empty()) { throw uhd::assertion_error( "X300 Initialization Error: No valid Ethernet interfaces specified."); } diff --git a/host/lib/usrp/x300/x300_eth_mgr.hpp b/host/lib/usrp/x300/x300_eth_mgr.hpp index 19b6064dd..ee1d1d726 100644 --- a/host/lib/usrp/x300/x300_eth_mgr.hpp +++ b/host/lib/usrp/x300/x300_eth_mgr.hpp @@ -39,12 +39,12 @@ public: /*! Return a reference to a ZPU ctrl interface object */ - uhd::wb_iface::sptr get_ctrl_iface(); + uhd::wb_iface::sptr get_ctrl_iface() override; void init_link( const mboard_eeprom_t& mb_eeprom, const std::string& loaded_fpga_image); - size_t get_mtu(uhd::direction_t dir); + size_t get_mtu(uhd::direction_t dir) override; /*! Safely release a ZPU control object * @@ -57,7 +57,7 @@ public: * * Note: this will only be valid after init_link() is called. */ - std::vector<uhd::rfnoc::device_id_t> get_local_device_ids() + std::vector<uhd::rfnoc::device_id_t> get_local_device_ids() override { return _local_device_ids; } @@ -66,7 +66,7 @@ public: const uhd::rfnoc::device_id_t local_device_id, const uhd::rfnoc::sep_id_t& local_epid, const uhd::rfnoc::sep_id_t& remote_epid, - const uhd::device_addr_t& link_args); + const uhd::device_addr_t& link_args) override; private: //! Function to create a udp_simple::sptr (kernel-based or DPDK-based) diff --git a/host/lib/usrp/x300/x300_fw_ctrl.cpp b/host/lib/usrp/x300/x300_fw_ctrl.cpp index cbe48bfe8..9cbad7576 100644 --- a/host/lib/usrp/x300/x300_fw_ctrl.cpp +++ b/host/lib/usrp/x300/x300_fw_ctrl.cpp @@ -39,7 +39,7 @@ public: __flush(); } - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { for (size_t i = 1; i <= num_retries; i++) { boost::mutex::scoped_lock lock(reg_access); @@ -57,7 +57,7 @@ public: } } - uint32_t peek32(const wb_addr_type addr) + uint32_t peek32(const wb_addr_type addr) override { for (size_t i = 1; i <= num_retries; i++) { boost::mutex::scoped_lock lock(reg_access); @@ -105,7 +105,7 @@ public: } protected: - virtual void __poke32(const wb_addr_type addr, const uint32_t data) + void __poke32(const wb_addr_type addr, const uint32_t data) override { // load request struct x300_fw_comms_t request = x300_fw_comms_t(); @@ -136,7 +136,7 @@ protected: UHD_ASSERT_THROW(reply.data == request.data); } - virtual uint32_t __peek32(const wb_addr_type addr) + uint32_t __peek32(const wb_addr_type addr) override { // load request struct x300_fw_comms_t request = x300_fw_comms_t(); @@ -169,14 +169,14 @@ protected: return uhd::ntohx<uint32_t>(reply.data); } - virtual void __flush(void) + void __flush(void) override { char buff[X300_FW_COMMS_MTU] = {}; while (udp->recv(boost::asio::buffer(buff), 0.0)) { } // flush } - virtual std::string __loc_info(void) + std::string __loc_info(void) override { return udp->get_send_addr(); } @@ -233,7 +233,7 @@ public: } protected: - virtual void __poke32(const wb_addr_type addr, const uint32_t data) + void __poke32(const wb_addr_type addr, const uint32_t data) override { nirio_status status = 0; uint32_t reg_data = 0xffffffff; @@ -261,7 +261,7 @@ protected: throw uhd::io_error("x300 fw poke32 - operation timed out"); } - virtual uint32_t __peek32(const wb_addr_type addr) + uint32_t __peek32(const wb_addr_type addr) override { nirio_status status = 0; uint32_t reg_data = 0xffffffff; @@ -293,12 +293,12 @@ protected: return reg_data; } - virtual void __flush(void) + void __flush(void) override { __peek32(0); } - virtual std::string __loc_info(void) + std::string __loc_info(void) override { return std::to_string(_drv_proxy->get_interface_num()); } diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp index 0dde87da5..1bfc2a2e4 100644 --- a/host/lib/usrp/x300/x300_fw_uart.cpp +++ b/host/lib/usrp/x300/x300_fw_uart.cpp @@ -50,7 +50,7 @@ struct x300_uart_iface : uart_iface } } - void write_uart(const std::string& buff) + void write_uart(const std::string& buff) override { boost::mutex::scoped_lock lock(_write_mutex); for (const char ch : buff) { @@ -118,7 +118,7 @@ struct x300_uart_iface : uart_iface } } - std::string read_uart(double timeout) + std::string read_uart(double timeout) override { boost::mutex::scoped_lock lock(_read_mutex); const auto exit_time = std::chrono::steady_clock::now() diff --git a/host/lib/usrp/x300/x300_image_loader.cpp b/host/lib/usrp/x300/x300_image_loader.cpp index 474aed4cb..f18af02b7 100644 --- a/host/lib/usrp/x300/x300_image_loader.cpp +++ b/host/lib/usrp/x300/x300_image_loader.cpp @@ -180,7 +180,7 @@ static void x300_setup_session(x300_session_t& session, const std::string& outpath) { device_addrs_t devs = x300_find(args); - if (devs.size() == 0) { + if (devs.empty()) { session.found = false; return; } else if (devs.size() > 1) { @@ -224,8 +224,8 @@ static void x300_setup_session(x300_session_t& session, * If this cannot be determined, then the user is forced to specify a filename. */ session.fpga_type = args.get("fpga", session.dev_addr.get("fpga", "")); - if (filepath == "") { - if (!session.dev_addr.has_key("product") or session.fpga_type == "") { + if (filepath.empty()) { + if (!session.dev_addr.has_key("product") or session.fpga_type.empty()) { throw uhd::runtime_error( "Found a device but could not auto-generate an image filename."); } else { @@ -243,8 +243,8 @@ static void x300_setup_session(x300_session_t& session, * The user can specify an output image path, or UHD will use the * system temporary path by default */ - if (outpath == "") { - if (!session.dev_addr.has_key("product") or session.fpga_type == "") { + if (outpath.empty()) { + if (!session.dev_addr.has_key("product") or session.fpga_type.empty()) { throw uhd::runtime_error( "Found a device but could not auto-generate an image filename."); } @@ -598,7 +598,7 @@ static bool x300_image_loader(const image_loader::image_loader_args_t& image_loa // See if any X3x0 with the given args is found device_addrs_t devs = x300_find(image_loader_args.args); - if (devs.size() == 0) + if (devs.empty()) return false; x300_session_t session; diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index c506fcf28..218582653 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -45,12 +45,12 @@ class x300_impl : public uhd::rfnoc::detail::rfnoc_device public: x300_impl(const uhd::device_addr_t&); void setup_mb(const size_t which, const uhd::device_addr_t&); - ~x300_impl(void); + ~x300_impl(void) override; /************************************************************************** * rfnoc_device API *************************************************************************/ - virtual uhd::rfnoc::mb_iface& get_mb_iface(const size_t mb_idx) + uhd::rfnoc::mb_iface& get_mb_iface(const size_t mb_idx) override { if (mb_idx >= _mb_ifaces.size()) { throw uhd::index_error( @@ -101,19 +101,21 @@ private: x300_mb_iface(uhd::usrp::x300::conn_manager::sptr conn_mgr, const double radio_clk_freq, const uhd::rfnoc::device_id_t remote_dev_id); - ~x300_mb_iface(); - uint16_t get_proto_ver(); - uhd::rfnoc::chdr_w_t get_chdr_w(); - uhd::endianness_t get_endianness(const uhd::rfnoc::device_id_t local_device_id); - uhd::rfnoc::device_id_t get_remote_device_id(); - std::vector<uhd::rfnoc::device_id_t> get_local_device_ids(); + ~x300_mb_iface() override; + uint16_t get_proto_ver() override; + uhd::rfnoc::chdr_w_t get_chdr_w() override; + uhd::endianness_t get_endianness( + const uhd::rfnoc::device_id_t local_device_id) override; + uhd::rfnoc::device_id_t get_remote_device_id() override; + std::vector<uhd::rfnoc::device_id_t> get_local_device_ids() override; uhd::transport::adapter_id_t get_adapter_id( - const uhd::rfnoc::device_id_t local_device_id); - void reset_network(); - uhd::rfnoc::clock_iface::sptr get_clock_iface(const std::string& clock_name); + const uhd::rfnoc::device_id_t local_device_id) override; + void reset_network() override; + uhd::rfnoc::clock_iface::sptr get_clock_iface( + const std::string& clock_name) override; uhd::rfnoc::chdr_ctrl_xport::sptr make_ctrl_transport( uhd::rfnoc::device_id_t local_device_id, - const uhd::rfnoc::sep_id_t& local_epid); + const uhd::rfnoc::sep_id_t& local_epid) override; uhd::rfnoc::chdr_rx_data_xport::uptr make_rx_data_transport( uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal, const uhd::rfnoc::sep_addr_pair_t& addrs, @@ -121,7 +123,7 @@ private: const uhd::rfnoc::sw_buff_t pyld_buff_fmt, const uhd::rfnoc::sw_buff_t mdata_buff_fmt, const uhd::device_addr_t& xport_args, - const std::string& streamer_id); + const std::string& streamer_id) override; uhd::rfnoc::chdr_tx_data_xport::uptr make_tx_data_transport( uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal, const uhd::rfnoc::sep_addr_pair_t& addrs, @@ -129,7 +131,7 @@ private: const uhd::rfnoc::sw_buff_t pyld_buff_fmt, const uhd::rfnoc::sw_buff_t mdata_buff_fmt, const uhd::device_addr_t& xport_args, - const std::string& streamer_id); + const std::string& streamer_id) override; private: const uhd::rfnoc::device_id_t _remote_dev_id; diff --git a/host/lib/usrp/x300/x300_mb_controller.hpp b/host/lib/usrp/x300/x300_mb_controller.hpp index f33d629c7..6cfa3f525 100644 --- a/host/lib/usrp/x300/x300_mb_controller.hpp +++ b/host/lib/usrp/x300/x300_mb_controller.hpp @@ -42,7 +42,7 @@ public: uhd::usrp::mboard_eeprom_t mb_eeprom, uhd::usrp::x300::x300_device_args_t args); - ~x300_mb_controller(); + ~x300_mb_controller() override; /************************************************************************** * X300-Specific APIs @@ -95,11 +95,11 @@ public: { set_tick_rate(tick_rate); } - uint64_t get_ticks_now(); - uint64_t get_ticks_last_pps(); - void set_ticks_now(const uint64_t ticks); - void set_ticks_next_pps(const uint64_t ticks); - void set_period(const uint64_t period_ns); + uint64_t get_ticks_now() override; + uint64_t get_ticks_last_pps() override; + void set_ticks_now(const uint64_t ticks) override; + void set_ticks_next_pps(const uint64_t ticks) override; + void set_period(const uint64_t period_ns) override; private: uint32_t get_tk_addr(const uint32_t tk_addr); @@ -110,30 +110,31 @@ public: /************************************************************************** * Motherboard Control API (see mb_controller.hpp) *************************************************************************/ - void init(); - std::string get_mboard_name() const; - void set_time_source(const std::string& source); - std::string get_time_source() const; - std::vector<std::string> get_time_sources() const; - void set_clock_source(const std::string& source); - std::string get_clock_source() const; - std::vector<std::string> get_clock_sources() const; - void set_sync_source(const std::string& clock_source, const std::string& time_source); - void set_sync_source(const device_addr_t& sync_source); - device_addr_t get_sync_source() const; - std::vector<device_addr_t> get_sync_sources(); - void set_clock_source_out(const bool enb); - void set_time_source_out(const bool enb); - sensor_value_t get_sensor(const std::string& name); - std::vector<std::string> get_sensor_names(); - uhd::usrp::mboard_eeprom_t get_eeprom(); + void init() override; + std::string get_mboard_name() const override; + void set_time_source(const std::string& source) override; + std::string get_time_source() const override; + std::vector<std::string> get_time_sources() const override; + void set_clock_source(const std::string& source) override; + std::string get_clock_source() const override; + std::vector<std::string> get_clock_sources() const override; + void set_sync_source( + const std::string& clock_source, const std::string& time_source) override; + void set_sync_source(const device_addr_t& sync_source) override; + device_addr_t get_sync_source() const override; + std::vector<device_addr_t> get_sync_sources() override; + void set_clock_source_out(const bool enb) override; + void set_time_source_out(const bool enb) override; + sensor_value_t get_sensor(const std::string& name) override; + std::vector<std::string> get_sensor_names() override; + uhd::usrp::mboard_eeprom_t get_eeprom() override; bool synchronize(std::vector<mb_controller::sptr>& mb_controllers, const uhd::time_spec_t& time_spec = uhd::time_spec_t(0.0), - const bool quiet = false); - std::vector<std::string> get_gpio_banks() const; - std::vector<std::string> get_gpio_srcs(const std::string&) const; - std::vector<std::string> get_gpio_src(const std::string&); - void set_gpio_src(const std::string&, const std::vector<std::string>&); + const bool quiet = false) override; + std::vector<std::string> get_gpio_banks() const override; + std::vector<std::string> get_gpio_srcs(const std::string&) const override; + std::vector<std::string> get_gpio_src(const std::string&) override; + void set_gpio_src(const std::string&, const std::vector<std::string>&) override; private: //! Return a string X300::MB_CTRL#N diff --git a/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp b/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp index 42d0b32ca..4eaccccc4 100644 --- a/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp +++ b/host/lib/usrp/x300/x300_mb_eeprom_iface.cpp @@ -41,7 +41,7 @@ public: _compat_num = _wb->peek32(X300_FW_SHMEM_ADDR(X300_FW_SHMEM_COMPAT_NUM)); } - ~x300_mb_eeprom_iface_impl() + ~x300_mb_eeprom_iface_impl() override { /* NOP */ } @@ -51,7 +51,7 @@ public: * \param addr the address * \param buf the vector of bytes */ - void write_i2c(uint16_t addr, const byte_vector_t& buf) + void write_i2c(uint16_t addr, const byte_vector_t& buf) override { UHD_ASSERT_THROW(addr == MBOARD_EEPROM_ADDR); if (uhd::usrp::x300::claim_status(_wb) != uhd::usrp::x300::CLAIMED_BY_US) { @@ -66,7 +66,7 @@ public: * \param num_bytes number of bytes to read * \return a vector of bytes */ - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { UHD_ASSERT_THROW(addr == MBOARD_EEPROM_ADDR); byte_vector_t bytes; @@ -93,7 +93,7 @@ public: * \param offset byte offset * \param buf the vector of bytes */ - void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& buf) + void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& buf) override { UHD_ASSERT_THROW(addr == MBOARD_EEPROM_ADDR); if (uhd::usrp::x300::claim_status(_wb) != uhd::usrp::x300::CLAIMED_BY_US) { @@ -109,7 +109,7 @@ public: * \param num_bytes number of bytes to read * \return a vector of bytes */ - byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) + byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) override { UHD_ASSERT_THROW(addr == MBOARD_EEPROM_ADDR); byte_vector_t bytes; diff --git a/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp b/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp index 935f6302d..964a98b84 100644 --- a/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp +++ b/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp @@ -19,7 +19,7 @@ class x300_mb_eeprom_iface : public uhd::i2c_iface public: typedef std::shared_ptr<x300_mb_eeprom_iface> sptr; - virtual ~x300_mb_eeprom_iface(void) = 0; + ~x300_mb_eeprom_iface(void) override = 0; static sptr make(uhd::wb_iface::sptr wb, uhd::i2c_iface::sptr i2c); }; diff --git a/host/lib/usrp/x300/x300_pcie_mgr.hpp b/host/lib/usrp/x300/x300_pcie_mgr.hpp index f0a5ed911..d6cb03071 100644 --- a/host/lib/usrp/x300/x300_pcie_mgr.hpp +++ b/host/lib/usrp/x300/x300_pcie_mgr.hpp @@ -37,11 +37,11 @@ public: /*! Return a reference to a ZPU ctrl interface object */ - uhd::wb_iface::sptr get_ctrl_iface(); + uhd::wb_iface::sptr get_ctrl_iface() override; void init_link(); - size_t get_mtu(uhd::direction_t dir); + size_t get_mtu(uhd::direction_t dir) override; /*! Safely release a ZPU control object * @@ -52,7 +52,7 @@ public: /*! Return list of local device IDs associated with this link */ - std::vector<uhd::rfnoc::device_id_t> get_local_device_ids() + std::vector<uhd::rfnoc::device_id_t> get_local_device_ids() override { return {_local_device_id}; } @@ -61,7 +61,7 @@ public: const uhd::rfnoc::device_id_t local_device_id, const uhd::rfnoc::sep_id_t& local_epid, const uhd::rfnoc::sep_id_t& remote_epid, - const uhd::device_addr_t& link_args); + const uhd::device_addr_t& link_args) override; private: /*! Allocate or return a previously allocated PCIe channel pair diff --git a/host/lib/usrp_clock/multi_usrp_clock.cpp b/host/lib/usrp_clock/multi_usrp_clock.cpp index c4bf081cc..e227f345b 100644 --- a/host/lib/usrp_clock/multi_usrp_clock.cpp +++ b/host/lib/usrp_clock/multi_usrp_clock.cpp @@ -28,12 +28,12 @@ public: _tree = _dev->get_tree(); } - device::sptr get_device(void) + device::sptr get_device(void) override { return _dev; } - std::string get_pp_string(void) + std::string get_pp_string(void) override { std::string buff = str(boost::format("%s USRP Clock Device\n") % ((get_num_boards() > 1) ? "Multi" : "Single")); @@ -46,26 +46,26 @@ public: return buff; } - size_t get_num_boards(void) + size_t get_num_boards(void) override { return _tree->list("/mboards").size(); } - uint32_t get_time(size_t board) + uint32_t get_time(size_t board) override { std::string board_str = str(boost::format("/mboards/%d") % board); return _tree->access<uint32_t>(board_str / "time").get(); } - sensor_value_t get_sensor(const std::string& name, size_t board) + sensor_value_t get_sensor(const std::string& name, size_t board) override { std::string board_str = str(boost::format("/mboards/%d") % board); return _tree->access<sensor_value_t>(board_str / "sensors" / name).get(); } - std::vector<std::string> get_sensor_names(size_t board) + std::vector<std::string> get_sensor_names(size_t board) override { std::string board_str = str(boost::format("/mboards/%d") % board); diff --git a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp index c588404aa..aba161584 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp @@ -125,7 +125,7 @@ static void octoclock_setup_session(octoclock_session_t& session, { // See if we can find an OctoClock with the given args device_addrs_t devs = octoclock_find(args); - if (devs.size() == 0) { + if (devs.empty()) { session.found = false; return; } else if (devs.size() > 1) { @@ -151,7 +151,7 @@ static void octoclock_setup_session(octoclock_session_t& session, session.found = true; // If no filepath is given, use the default - if (filepath == "") { + if (filepath.empty()) { session.image_filepath = find_image_path(str(boost::format("octoclock_r%s_fw.hex") % session.dev_addr.get("revision", "4"))); @@ -207,7 +207,7 @@ static void octoclock_reset_into_bootloader(octoclock_session_t& session) std::this_thread::sleep_for(std::chrono::milliseconds(500)); uhd::device_addrs_t octoclocks = uhd::device::find( uhd::device_addr_t(str(boost::format("addr=%s") % session.dev_addr["addr"]))); - if (octoclocks.size() == 0) { + if (octoclocks.empty()) { std::cout << "failed." << std::endl; throw uhd::runtime_error("Failed to reset OctoClock."); } else if (octoclocks[0]["type"] != "octoclock-bootloader") { diff --git a/host/lib/usrp_clock/octoclock/octoclock_impl.hpp b/host/lib/usrp_clock/octoclock/octoclock_impl.hpp index 8f36b17a0..86fd5342d 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_impl.hpp +++ b/host/lib/usrp_clock/octoclock/octoclock_impl.hpp @@ -34,13 +34,13 @@ class octoclock_impl : public uhd::device { public: octoclock_impl(const uhd::device_addr_t&); - ~octoclock_impl(void){}; + ~octoclock_impl(void) override{}; - uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args); + uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args) override; - uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args); + uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args) override; - bool recv_async_msg(uhd::async_metadata_t&, double); + bool recv_async_msg(uhd::async_metadata_t&, double) override; private: struct oc_container_type diff --git a/host/lib/usrp_clock/octoclock/octoclock_uart.hpp b/host/lib/usrp_clock/octoclock/octoclock_uart.hpp index 02fcf25e3..6a43e5ce8 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_uart.hpp +++ b/host/lib/usrp_clock/octoclock/octoclock_uart.hpp @@ -25,10 +25,10 @@ class octoclock_uart_iface : public uhd::uart_iface { public: octoclock_uart_iface(uhd::transport::udp_simple::sptr udp, uint32_t proto_ver); - ~octoclock_uart_iface(void){}; + ~octoclock_uart_iface(void) override{}; - void write_uart(const std::string& buf); - std::string read_uart(double timeout); + void write_uart(const std::string& buf) override; + std::string read_uart(double timeout) override; private: uhd::transport::udp_simple::sptr _udp; diff --git a/host/lib/utils/gain_group.cpp b/host/lib/utils/gain_group.cpp index 5544afb0c..e66692570 100644 --- a/host/lib/utils/gain_group.cpp +++ b/host/lib/utils/gain_group.cpp @@ -63,7 +63,7 @@ public: /*NOP*/ } - gain_range_t get_range(const std::string& name) + gain_range_t get_range(const std::string& name) override { if (not name.empty()) return _name_to_fcns.get(name).get_range(); @@ -83,7 +83,7 @@ public: return gain_range_t(overall_min, overall_max, overall_step); } - double get_value(const std::string& name) + double get_value(const std::string& name) override { if (not name.empty()) return _name_to_fcns.get(name).get_value(); @@ -95,13 +95,13 @@ public: return overall_gain; } - void set_value(double gain, const std::string& name) + void set_value(double gain, const std::string& name) override { if (not name.empty()) return _name_to_fcns.get(name).set_value(gain); std::vector<gain_fcns_t> all_fcns = get_all_fcns(); - if (all_fcns.size() == 0) + if (all_fcns.empty()) return; // nothing to set! // get the max step size among the gains @@ -157,13 +157,13 @@ public: } } - const std::vector<std::string> get_names(void) + const std::vector<std::string> get_names(void) override { return _name_to_fcns.keys(); } void register_fcns( - const std::string& name, const gain_fcns_t& gain_fcns, size_t priority) + const std::string& name, const gain_fcns_t& gain_fcns, size_t priority) override { if (name.empty() or _name_to_fcns.has_key(name)) { // ensure the name name is unique and non-empty diff --git a/host/lib/utils/tasks.cpp b/host/lib/utils/tasks.cpp index ce6e1716c..0eddd2488 100644 --- a/host/lib/utils/tasks.cpp +++ b/host/lib/utils/tasks.cpp @@ -91,7 +91,7 @@ public: _spawn_barrier.wait(); } - ~msg_task_impl(void) + ~msg_task_impl(void) override { _running = false; _thread_group.interrupt_all(); @@ -104,7 +104,7 @@ public: * stranded messages here. This might happen during shutdown when dtors are called. * See also: comments in b200_io_impl->handle_async_task */ - msg_payload_t get_msg_from_dump_queue(uint32_t sid) + msg_payload_t get_msg_from_dump_queue(uint32_t sid) override { boost::mutex::scoped_lock lock(_mutex); msg_payload_t b; diff --git a/host/tests/client_zero_test.cpp b/host/tests/client_zero_test.cpp index 285757baf..dedf801d9 100644 --- a/host/tests/client_zero_test.cpp +++ b/host/tests/client_zero_test.cpp @@ -33,7 +33,7 @@ public: read_memory[0x000C] = device_id | (DEVICE_TYPE << 16); } - virtual ~client_zero_test_iface() = default; + ~client_zero_test_iface() override = default; /************************************************************************** * Test API @@ -76,7 +76,8 @@ public: | NUM_STREAM_ENDPOINTS; } - void _poke_cb(uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb( + uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) override { if (addr < (1 + NUM_STREAM_ENDPOINTS) * SLOT_OFFSET || (addr % SLOT_OFFSET != 0 && addr % SLOT_OFFSET != 4)) { @@ -103,7 +104,7 @@ public: } } - void _peek_cb(uint32_t addr, time_spec_t /*time*/) + void _peek_cb(uint32_t addr, time_spec_t /*time*/) override { if (read_memory.count(addr) == 0) { std::cout << "Bad peek32, addr=" << addr << std::endl; diff --git a/host/tests/common/mock_link.hpp b/host/tests/common/mock_link.hpp index a62aa49c7..b2c5be974 100644 --- a/host/tests/common/mock_link.hpp +++ b/host/tests/common/mock_link.hpp @@ -128,7 +128,7 @@ public: _simulate_io_timeout = simulate_io_timeout; } - adapter_id_t get_send_adapter_id() const + adapter_id_t get_send_adapter_id() const override { return NULL_ADAPTER_ID; } @@ -228,7 +228,7 @@ public: _rx_lens.push_back(len); } - adapter_id_t get_recv_adapter_id() const + adapter_id_t get_recv_adapter_id() const override { return NULL_ADAPTER_ID; } diff --git a/host/tests/common/mock_zero_copy.cpp b/host/tests/common/mock_zero_copy.cpp index 8b9e04f64..45608584f 100644 --- a/host/tests/common/mock_zero_copy.cpp +++ b/host/tests/common/mock_zero_copy.cpp @@ -41,7 +41,7 @@ uhd::transport::managed_recv_buffer::sptr mock_zero_copy::get_recv_buff(double) uhd::transport::managed_send_buffer::sptr mock_zero_copy::get_send_buff(double) { - if (not _reuse_send_memory or _tx_mems.size() == 0) { + if (not _reuse_send_memory or _tx_mems.empty()) { _tx_mems.push_back(boost::shared_array<uint8_t>(new uint8_t[_send_frame_size])); _tx_lens.push_back(_send_frame_size); } diff --git a/host/tests/common/mock_zero_copy.hpp b/host/tests/common/mock_zero_copy.hpp index 038a8e73d..9feb4e287 100644 --- a/host/tests/common/mock_zero_copy.hpp +++ b/host/tests/common/mock_zero_copy.hpp @@ -35,7 +35,7 @@ static constexpr size_t DEFAULT_RECV_FRAME_SIZE = 1024; class mock_msb : public uhd::transport::managed_send_buffer { public: - void release(void) + void release(void) override { /* nop */ } @@ -53,7 +53,7 @@ private: class mock_mrb : public uhd::transport::managed_recv_buffer { public: - void release(void) + void release(void) override { /* nop */ } @@ -76,22 +76,22 @@ public: size_t recv_frame_size = DEFAULT_RECV_FRAME_SIZE, size_t send_frame_size = DEFAULT_SEND_FRAME_SIZE); - uhd::transport::managed_recv_buffer::sptr get_recv_buff(double); - uhd::transport::managed_send_buffer::sptr get_send_buff(double); + uhd::transport::managed_recv_buffer::sptr get_recv_buff(double) override; + uhd::transport::managed_send_buffer::sptr get_send_buff(double) override; - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return 1; } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return 1; } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _recv_frame_size; } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _send_frame_size; } diff --git a/host/tests/constrained_device_args_test.cpp b/host/tests/constrained_device_args_test.cpp index 2fe7e5c16..fc234ae01 100644 --- a/host/tests/constrained_device_args_test.cpp +++ b/host/tests/constrained_device_args_test.cpp @@ -48,14 +48,14 @@ public: return _enum_arg.get(); } - inline virtual std::string to_string() const + inline std::string to_string() const override { return _double_arg.to_string() + ", " + _size_t_arg.to_string() + ", " + _bool_arg.to_string() + ", " + _enum_arg.to_string(); } private: - virtual void _parse(const uhd::device_addr_t& dev_args) + void _parse(const uhd::device_addr_t& dev_args) override { if (dev_args.has_key(_double_arg.key())) _double_arg.parse(dev_args[_double_arg.key()]); diff --git a/host/tests/expert_test.cpp b/host/tests/expert_test.cpp index 34be807ab..a23c9cbb8 100644 --- a/host/tests/expert_test.cpp +++ b/host/tests/expert_test.cpp @@ -27,7 +27,7 @@ public: } private: - void resolve() + void resolve() override { _c = _a + _b; } @@ -51,7 +51,7 @@ public: } private: - void resolve() + void resolve() override { _e.set(_c.get() * _d.get()); } @@ -74,7 +74,7 @@ public: } private: - void resolve() + void resolve() override { _f.set(-_b.get()); } @@ -97,7 +97,7 @@ public: } private: - void resolve() + void resolve() override { _g.set(_e.get() - _f.get()); } @@ -120,7 +120,7 @@ public: } private: - void resolve() + void resolve() override { *_output = _g; } @@ -137,7 +137,7 @@ public: worker6_t() : worker_node_t("null_worker") {} private: - void resolve() {} + void resolve() override {} }; //============================================================================= diff --git a/host/tests/mb_controller_test.cpp b/host/tests/mb_controller_test.cpp index b6fb49371..188dddecc 100644 --- a/host/tests/mb_controller_test.cpp +++ b/host/tests/mb_controller_test.cpp @@ -14,22 +14,22 @@ using namespace uhd::rfnoc; class mock_timekeeper : public mb_controller::timekeeper { public: - uint64_t get_ticks_now() + uint64_t get_ticks_now() override { return _ticks; } - uint64_t get_ticks_last_pps() + uint64_t get_ticks_last_pps() override { return _ticks; } - void set_ticks_now(const uint64_t ticks) + void set_ticks_now(const uint64_t ticks) override { _ticks = ticks; } - void set_ticks_next_pps(const uint64_t ticks) + void set_ticks_next_pps(const uint64_t ticks) override { _ticks = ticks; } @@ -43,7 +43,7 @@ public: } private: - void set_period(const uint64_t period_ns) + void set_period(const uint64_t period_ns) override { _period = period_ns; } @@ -61,79 +61,79 @@ public: /************************************************************************** * Motherboard Control API (see mb_controller.hpp) *************************************************************************/ - std::string get_mboard_name() const + std::string get_mboard_name() const override { return "MOCK-MB"; } - void set_time_source(const std::string& source) + void set_time_source(const std::string& source) override { time_source = source; } - std::string get_time_source() const + std::string get_time_source() const override { return time_source; } - std::vector<std::string> get_time_sources() const + std::vector<std::string> get_time_sources() const override { return {"internal", "external"}; } - void set_clock_source(const std::string& source) + void set_clock_source(const std::string& source) override { clock_source = source; } - std::string get_clock_source() const + std::string get_clock_source() const override { return clock_source; } - std::vector<std::string> get_clock_sources() const + std::vector<std::string> get_clock_sources() const override { return {"internal", "external"}; } void set_sync_source( - const std::string& /*clock_source*/, const std::string& /*time_source*/) + const std::string& /*clock_source*/, const std::string& /*time_source*/) override { } - void set_sync_source(const device_addr_t& /*sync_source*/) {} + void set_sync_source(const device_addr_t& /*sync_source*/) override {} - device_addr_t get_sync_source() const + device_addr_t get_sync_source() const override { return {}; } - std::vector<device_addr_t> get_sync_sources() + std::vector<device_addr_t> get_sync_sources() override { return {}; } - void set_clock_source_out(const bool enb) + void set_clock_source_out(const bool enb) override { clock_source_out = enb; } - void set_time_source_out(const bool enb) + void set_time_source_out(const bool enb) override { time_source_out = enb; } - sensor_value_t get_sensor(const std::string& /*name*/) + sensor_value_t get_sensor(const std::string& /*name*/) override { return sensor_value_t("Ref", false, "locked", "unlocked"); } - std::vector<std::string> get_sensor_names() + std::vector<std::string> get_sensor_names() override { return {"mock_sensor"}; } - uhd::usrp::mboard_eeprom_t get_eeprom() + uhd::usrp::mboard_eeprom_t get_eeprom() override { return {}; } diff --git a/host/tests/offload_io_srv_test.cpp b/host/tests/offload_io_srv_test.cpp index 806d4a3dc..c5ee20488 100644 --- a/host/tests/offload_io_srv_test.cpp +++ b/host/tests/offload_io_srv_test.cpp @@ -32,7 +32,7 @@ class mock_recv_io : public recv_io_if public: mock_recv_io(recv_link_if::sptr link) : _link(link) {} - frame_buff::uptr get_recv_buff(int32_t timeout_ms) + frame_buff::uptr get_recv_buff(int32_t timeout_ms) override { if (_frames_allocated > 0) { _frames_allocated--; @@ -41,7 +41,7 @@ public: return nullptr; } - void release_recv_buff(frame_buff::uptr buff) + void release_recv_buff(frame_buff::uptr buff) override { _link->release_recv_buff(std::move(buff)); } @@ -71,17 +71,17 @@ class mock_send_io : public send_io_if public: mock_send_io(send_link_if::sptr link) : _link(link) {} - frame_buff::uptr get_send_buff(int32_t timeout_ms) + frame_buff::uptr get_send_buff(int32_t timeout_ms) override { return _link->get_send_buff(timeout_ms); } - bool wait_for_dest_ready(size_t, int32_t) + bool wait_for_dest_ready(size_t, int32_t) override { return true; } - void release_send_buff(frame_buff::uptr buff) + void release_send_buff(frame_buff::uptr buff) override { _link->release_send_buff(std::move(buff)); } @@ -103,10 +103,10 @@ private: class mock_io_service : public io_service { public: - void attach_recv_link(recv_link_if::sptr /*link*/) {} - void attach_send_link(send_link_if::sptr /*link*/) {} - void detach_recv_link(recv_link_if::sptr /*link*/) {} - void detach_send_link(send_link_if::sptr /*link*/) {} + void attach_recv_link(recv_link_if::sptr /*link*/) override {} + void attach_send_link(send_link_if::sptr /*link*/) override {} + void detach_recv_link(recv_link_if::sptr /*link*/) override {} + void detach_send_link(send_link_if::sptr /*link*/) override {} send_io_if::sptr make_send_client(send_link_if::sptr send_link, size_t /*num_send_frames*/, @@ -114,7 +114,7 @@ public: recv_link_if::sptr /*recv_link*/, size_t /*num_recv_frames*/, recv_callback_t /*recv_cb*/, - send_io_if::fc_callback_t /*fc_cb*/) + send_io_if::fc_callback_t /*fc_cb*/) override { return std::make_shared<mock_send_io>(send_link); } @@ -124,7 +124,7 @@ public: recv_callback_t /*cb*/, send_link_if::sptr /*fc_link*/, size_t /*num_send_frames*/, - recv_io_if::fc_callback_t /*fc_cb*/) + recv_io_if::fc_callback_t /*fc_cb*/) override { auto io = std::make_shared<mock_recv_io>(recv_link); _recv_io.push_back(io); diff --git a/host/tests/rfnoc_block_tests/fft_block_test.cpp b/host/tests/rfnoc_block_tests/fft_block_test.cpp index 0eac8cf43..15e1de8f2 100644 --- a/host/tests/rfnoc_block_tests/fft_block_test.cpp +++ b/host/tests/rfnoc_block_tests/fft_block_test.cpp @@ -25,8 +25,10 @@ noc_block_base::make_args_t::~make_args_t() = default; class fft_mock_reg_iface_t : public mock_reg_iface_t { public: - virtual void _poke_cb( - uint32_t addr, uint32_t /*data*/, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb(uint32_t addr, + uint32_t /*data*/, + uhd::time_spec_t /*time*/, + bool /*ack*/) override { if (addr == fft_block_control::REG_RESET_ADDR) { fft_was_reset = true; diff --git a/host/tests/rfnoc_block_tests/fir_filter_block_test.cpp b/host/tests/rfnoc_block_tests/fir_filter_block_test.cpp index 0ef725599..fe660b626 100644 --- a/host/tests/rfnoc_block_tests/fir_filter_block_test.cpp +++ b/host/tests/rfnoc_block_tests/fir_filter_block_test.cpp @@ -37,8 +37,8 @@ public: { } - virtual void _poke_cb( - uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb( + uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) override { if (addr == fir_filter_block_control::REG_FIR_MAX_NUM_COEFFS_ADDR) { throw uhd::assertion_error("Invalid write to read-only register"); @@ -52,7 +52,7 @@ public: } } - virtual void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) + void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) override { if (addr == fir_filter_block_control::REG_FIR_MAX_NUM_COEFFS_ADDR) { read_memory[addr] = uhd::narrow_cast<int32_t>(_max_num_coeffs); diff --git a/host/tests/rfnoc_block_tests/fosphor_block_test.cpp b/host/tests/rfnoc_block_tests/fosphor_block_test.cpp index 0cdc678d2..fb3624e02 100644 --- a/host/tests/rfnoc_block_tests/fosphor_block_test.cpp +++ b/host/tests/rfnoc_block_tests/fosphor_block_test.cpp @@ -32,8 +32,8 @@ noc_block_base::make_args_t::~make_args_t() = default; class fosphor_mock_reg_iface_t : public mock_reg_iface_t { public: - virtual void _poke_cb( - uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb( + uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) override { if (addr == fosphor_block_control::REG_ENABLE_ADDR) { fosphor_enable_reg = data; @@ -47,7 +47,7 @@ public: } } - virtual void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) + void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) override { if (addr == fosphor_block_control::REG_ENABLE_ADDR) { read_memory[addr] = fosphor_enable_reg; diff --git a/host/tests/rfnoc_block_tests/keep_one_in_n_test.cpp b/host/tests/rfnoc_block_tests/keep_one_in_n_test.cpp index 694ba7957..86c97db8f 100644 --- a/host/tests/rfnoc_block_tests/keep_one_in_n_test.cpp +++ b/host/tests/rfnoc_block_tests/keep_one_in_n_test.cpp @@ -29,7 +29,7 @@ public: { } - virtual void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) + void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) override { // Emulate the read-only behavior of the WIDTH_N register if (addr == keep_one_in_n_block_control::REG_WIDTH_N_OFFSET) { diff --git a/host/tests/rfnoc_block_tests/siggen_block_test.cpp b/host/tests/rfnoc_block_tests/siggen_block_test.cpp index 6fdcb903b..ea52530e0 100644 --- a/host/tests/rfnoc_block_tests/siggen_block_test.cpp +++ b/host/tests/rfnoc_block_tests/siggen_block_test.cpp @@ -44,8 +44,8 @@ public: { } - virtual void _poke_cb( - uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb( + uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) override { const size_t port = addr / siggen_block_control::REG_BLOCK_SIZE; if (port >= _num_ports) { @@ -72,7 +72,7 @@ public: } } - virtual void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) + void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) override { const size_t port = addr / siggen_block_control::REG_BLOCK_SIZE; if (port >= _num_ports) { diff --git a/host/tests/rfnoc_block_tests/switchboard_block_test.cpp b/host/tests/rfnoc_block_tests/switchboard_block_test.cpp index 693923693..3cc9fd147 100644 --- a/host/tests/rfnoc_block_tests/switchboard_block_test.cpp +++ b/host/tests/rfnoc_block_tests/switchboard_block_test.cpp @@ -41,8 +41,8 @@ public: input_select.push_back(0); } - virtual void _poke_cb( - uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb( + uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) override { size_t chan = addr / switchboard_block_control::REG_BLOCK_SIZE; size_t offset = addr % switchboard_block_control::REG_BLOCK_SIZE; @@ -55,7 +55,7 @@ public: } } - virtual void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) + void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) override { size_t chan = addr / switchboard_block_control::REG_BLOCK_SIZE; size_t offset = addr % switchboard_block_control::REG_BLOCK_SIZE; diff --git a/host/tests/rfnoc_block_tests/vector_iir_block_test.cpp b/host/tests/rfnoc_block_tests/vector_iir_block_test.cpp index 5fc1fd90e..8721d7bb5 100644 --- a/host/tests/rfnoc_block_tests/vector_iir_block_test.cpp +++ b/host/tests/rfnoc_block_tests/vector_iir_block_test.cpp @@ -44,8 +44,8 @@ public: } } - virtual void _poke_cb( - uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb( + uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) override { size_t chan = addr / vector_iir_block_control::REG_BLOCK_SIZE; size_t offset = addr % vector_iir_block_control::REG_BLOCK_SIZE; @@ -54,7 +54,7 @@ public: } } - virtual void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) + void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) override { size_t chan = addr / vector_iir_block_control::REG_BLOCK_SIZE; size_t offset = addr % vector_iir_block_control::REG_BLOCK_SIZE; diff --git a/host/tests/rfnoc_block_tests/window_block_test.cpp b/host/tests/rfnoc_block_tests/window_block_test.cpp index 65e493c4b..a8fcb5db0 100644 --- a/host/tests/rfnoc_block_tests/window_block_test.cpp +++ b/host/tests/rfnoc_block_tests/window_block_test.cpp @@ -42,8 +42,8 @@ public: reset(); } - virtual void _poke_cb( - uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) + void _poke_cb( + uint32_t addr, uint32_t data, uhd::time_spec_t /*time*/, bool /*ack*/) override { size_t chan = addr / window_block_control::REG_WINDOW_BLOCK_SIZE; size_t offset = addr % window_block_control::REG_WINDOW_BLOCK_SIZE; @@ -63,7 +63,7 @@ public: } } - virtual void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) + void _peek_cb(uint32_t addr, uhd::time_spec_t /*time*/) override { size_t chan = addr / window_block_control::REG_WINDOW_BLOCK_SIZE; size_t offset = addr % window_block_control::REG_WINDOW_BLOCK_SIZE; diff --git a/host/tests/rfnoc_graph_mock_nodes.hpp b/host/tests/rfnoc_graph_mock_nodes.hpp index bfa08bea6..12bc5c38a 100644 --- a/host/tests/rfnoc_graph_mock_nodes.hpp +++ b/host/tests/rfnoc_graph_mock_nodes.hpp @@ -114,17 +114,17 @@ public: set_action_forwarding_policy(policy); } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_RADIO" + std::to_string(_radio_idx); } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return 1; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return 1; } @@ -228,17 +228,17 @@ public: }); } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_DDC"; } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return 1; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return 1; } @@ -281,17 +281,17 @@ public: set_action_forwarding_policy(forwarding_policy_t::ONE_TO_ONE); } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_FIFO"; } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return _num_ports; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return _num_ports; } @@ -324,17 +324,17 @@ public: }); } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_STREAMER"; } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return _num_ports; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return _num_ports; } @@ -379,17 +379,17 @@ public: } } - std::string get_unique_id() const + std::string get_unique_id() const override { return _name + std::to_string(_term_count); } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return _num_ports; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return _num_ports; } @@ -483,17 +483,17 @@ public: return node_t::get_property<T>(id, rsi); } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return _input_ports; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return _output_ports; } - std::string get_unique_id() const + std::string get_unique_id() const override { return _name; } @@ -545,17 +545,17 @@ public: set_action_forwarding_policy(forwarding_policy_t::DROP); } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return _input_ports; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return _output_ports; } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_ROUTING_NODE"; } diff --git a/host/tests/rfnoc_node_test.cpp b/host/tests/rfnoc_node_test.cpp index 283d0bf38..562c395e2 100644 --- a/host/tests/rfnoc_node_test.cpp +++ b/host/tests/rfnoc_node_test.cpp @@ -65,11 +65,11 @@ public: {&_double_prop_user}, {&temp}, []() { std::cout << "foo" << std::endl; }); } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return _num_input_ports; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return _num_output_ports; } diff --git a/host/tests/rfnoc_propprop_test.cpp b/host/tests/rfnoc_propprop_test.cpp index f07e9848e..d441d180a 100644 --- a/host/tests/rfnoc_propprop_test.cpp +++ b/host/tests/rfnoc_propprop_test.cpp @@ -29,17 +29,17 @@ public: add_property_resolver({&_out}, {&_in}, [this]() { _in = _out / 2; }); } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_INVALID_NODE1"; } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return 1; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return 1; } @@ -88,17 +88,17 @@ public: _in.set(old_val); } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return 1; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return 1; } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_INVALID_NODE2"; } @@ -136,17 +136,17 @@ public: }); } - size_t get_num_input_ports() const + size_t get_num_input_ports() const override { return 1; } - size_t get_num_output_ports() const + size_t get_num_output_ports() const override { return 1; } - std::string get_unique_id() const + std::string get_unique_id() const override { return "MOCK_CIRCULAR_PROPS"; } diff --git a/host/tests/rx_streamer_test.cpp b/host/tests/rx_streamer_test.cpp index f50fef613..fdc010535 100644 --- a/host/tests/rx_streamer_test.cpp +++ b/host/tests/rx_streamer_test.cpp @@ -106,7 +106,7 @@ public: { } - void issue_stream_cmd(const stream_cmd_t&) {} + void issue_stream_cmd(const stream_cmd_t&) override {} void set_tick_rate(double rate) { diff --git a/host/tests/streamer_benchmark.cpp b/host/tests/streamer_benchmark.cpp index 88dd9665b..bc427b29a 100644 --- a/host/tests/streamer_benchmark.cpp +++ b/host/tests/streamer_benchmark.cpp @@ -175,7 +175,7 @@ public: rx_streamer_impl<xport, true>::set_scale_factor(chan, scale_factor); } - void issue_stream_cmd(const stream_cmd_t& /*stream_cmd*/) {} + void issue_stream_cmd(const stream_cmd_t& /*stream_cmd*/) override {} }; /*! @@ -206,7 +206,7 @@ public: } bool recv_async_msg( - uhd::async_metadata_t& /*async_metadata*/, double /*timeout = 0.1*/) + uhd::async_metadata_t& /*async_metadata*/, double /*timeout = 0.1*/) override { return false; } diff --git a/host/tests/tx_streamer_test.cpp b/host/tests/tx_streamer_test.cpp index 0016f596c..be89fa215 100644 --- a/host/tests/tx_streamer_test.cpp +++ b/host/tests/tx_streamer_test.cpp @@ -89,7 +89,7 @@ public: } bool recv_async_msg( - uhd::async_metadata_t& /*async_metadata*/, double /*timeout = 0.1*/) + uhd::async_metadata_t& /*async_metadata*/, double /*timeout = 0.1*/) override { return false; } diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp index b75ff6960..65c4e52ca 100644 --- a/host/utils/b2xx_fx3_utils.cpp +++ b/host/utils/b2xx_fx3_utils.cpp @@ -173,7 +173,7 @@ uhd::transport::usb_device_handle::sptr open_device( std::vector<uhd::transport::usb_device_handle::vid_pid_pair_t> vid_pid_pair_list( 1, uhd::transport::usb_device_handle::vid_pid_pair_t(vid, pid)); handles = uhd::transport::usb_device_handle::get_device_list(vid_pid_pair_list); - if (handles.size() == 0) { + if (handles.empty()) { if (user_supplied) { std::cerr << (boost::format("Failed to open device with VID 0x%04x and " "PID 0x%04x - trying other known VID/PIDs") @@ -183,15 +183,14 @@ uhd::transport::usb_device_handle::sptr open_device( } // try known VID/PIDs next - for (size_t i = 0; handles.size() == 0 && i < known_vid_pid_vector.size(); - i++) { + for (size_t i = 0; handles.empty() && i < known_vid_pid_vector.size(); i++) { vp = known_vid_pid_vector[i]; handles = uhd::transport::usb_device_handle::get_device_list(vp.vid, vp.pid); } } - if (handles.size() > 0) { + if (!handles.empty()) { handle = handles[0]; std::cout << (boost::format("Device opened (VID=0x%04x,PID=0x%04x)") % vp.vid % vp.pid) diff --git a/host/utils/fx2_init_eeprom.cpp b/host/utils/fx2_init_eeprom.cpp index e375b27f5..3ddc62c41 100644 --- a/host/utils/fx2_init_eeprom.cpp +++ b/host/utils/fx2_init_eeprom.cpp @@ -130,7 +130,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) uhd::device_addrs_t found_addrs = uhd::device::find(device_addr, uhd::device::USRP); - if (found_addrs.size() == 0) { + if (found_addrs.empty()) { std::cerr << "No USRP devices found" << std::endl; return EXIT_FAILURE; } diff --git a/host/utils/latency/lib/Responder.cpp b/host/utils/latency/lib/Responder.cpp index c2f224d00..65c3e2941 100644 --- a/host/utils/latency/lib/Responder.cpp +++ b/host/utils/latency/lib/Responder.cpp @@ -664,7 +664,7 @@ bool Responder::handle_interactive_control() // print updated interactive control value void Responder::print_interactive_msg(std::string msg) { - if (msg != "") { + if (!msg.empty()) { // move cursor back to beginning of line int y, x; getyx(_window, y, x); @@ -1107,7 +1107,7 @@ void Responder::write_log_file() logs << boost::format("device=%s") % _usrp->get_mboard_name() << endl; logs << boost::format("device_args=%s") % _opt.device_args << endl; logs << boost::format("type=%s") % hw_info["type"] << endl; - if (hw_info.size() > 0) { + if (!hw_info.empty()) { logs << boost::format("usrp_addr=%s") % hw_info["usrp_addr"] << endl; logs << boost::format("usrp_name=%s") % hw_info["name"] << endl; logs << boost::format("serial=%s") % hw_info["serial"] << endl; diff --git a/host/utils/octoclock_burn_eeprom.cpp b/host/utils/octoclock_burn_eeprom.cpp index 6221c4e83..1e8341e13 100644 --- a/host/utils/octoclock_burn_eeprom.cpp +++ b/host/utils/octoclock_burn_eeprom.cpp @@ -82,7 +82,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) if (!vm.count("read-all")) { std::cout << std::endl; for (size_t i = 0; i < vals_vec.size(); i++) { - if (vals_vec[i] != "") { + if (!vals_vec[i].empty()) { oc_eeprom[keys_vec[i]] = vals_vec[i]; std::cout << boost::format("Setting EEPROM [\"%s\"] to \"%s\"...") % keys_vec[i] % vals_vec[i] diff --git a/host/utils/uhd_image_loader.cpp b/host/utils/uhd_image_loader.cpp index 87dc22b5c..36936fda1 100644 --- a/host/utils/uhd_image_loader.cpp +++ b/host/utils/uhd_image_loader.cpp @@ -95,7 +95,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) } // Clean up paths, if given - if (image_loader_args.firmware_path != "") { + if (!image_loader_args.firmware_path.empty()) { #ifndef UHD_PLATFORM_WIN32 if (image_loader_args.firmware_path.find("~") == 0) { image_loader_args.firmware_path.replace(0, 1, getenv("HOME")); @@ -104,7 +104,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) image_loader_args.firmware_path = fs::absolute(image_loader_args.firmware_path).string(); } - if (image_loader_args.fpga_path != "") { + if (!image_loader_args.fpga_path.empty()) { #ifndef UHD_PLATFORM_WIN32 if (image_loader_args.fpga_path.find("~") == 0) { image_loader_args.fpga_path.replace(0, 1, getenv("HOME")); @@ -112,7 +112,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) #endif /* UHD_PLATFORM_WIN32 */ image_loader_args.fpga_path = fs::absolute(image_loader_args.fpga_path).string(); } - if (image_loader_args.out_path != "") { + if (!image_loader_args.out_path.empty()) { #ifndef UHD_PLATFORM_WIN32 if (image_loader_args.out_path.find("~") == 0) { image_loader_args.out_path.replace(0, 1, getenv("HOME")); diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 24b82543c..50eabc55b 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -39,7 +39,7 @@ static std::string make_border(const std::string& text) boost::split(lines, text, boost::is_any_of("\n")); while (lines.back().empty()) lines.pop_back(); // strip trailing newlines - if (lines.size()) + if (!lines.empty()) lines[0] = " " + lines[0]; // indent the title line for (const std::string& line : lines) { ss << boost::format("| %s") % line << std::endl; @@ -99,7 +99,7 @@ static std::string get_frontend_pp_string( << std::endl; std::vector<std::string> gain_names = tree->list(path / "gains"); - if (gain_names.size() == 0) + if (gain_names.empty()) ss << "Gain Elements: None" << std::endl; for (const std::string& name : gain_names) { meta_range_t gain_range = @@ -139,7 +139,7 @@ static std::string get_codec_pp_string( ss << boost::format("Name: %s") % (tree->access<std::string>(path / "name").get()) << std::endl; std::vector<std::string> gain_names = tree->list(path / "gains"); - if (gain_names.size() == 0) + if (gain_names.empty()) ss << "Gain Elements: None" << std::endl; for (const std::string& name : gain_names) { meta_range_t gain_range = diff --git a/host/utils/usrp_burn_mb_eeprom.cpp b/host/utils/usrp_burn_mb_eeprom.cpp index 18e8b367b..c0ff18309 100644 --- a/host/utils/usrp_burn_mb_eeprom.cpp +++ b/host/utils/usrp_burn_mb_eeprom.cpp @@ -85,7 +85,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) if (not vals_vec.empty()) { mb_eeprom = uhd::usrp::mboard_eeprom_t(); for (size_t i = 0; i < vals_vec.size(); i++) { - if (vals_vec[i] != "") { + if (!vals_vec[i].empty()) { mb_eeprom[keys_vec[i]] = vals_vec[i]; std::cout << boost::format("Setting EEPROM [\"%s\"] to \"%s\"...") % keys_vec[i] % vals_vec[i] |