From 107a49c0c236940da7d3bd0f57da4bc1e2a34cb4 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 8 Jan 2021 09:33:36 +0100 Subject: host: Update code base using clang-tidy The checks from the new clang-tidy file are applied to the source tree using: $ find . -name "*.cpp" | sort -u | xargs \ --max-procs 8 --max-args 1 clang-tidy --format-style=file \ --fix -p /path/to/compile_commands.json --- host/include/uhd/exception.hpp | 138 +++++++++++++-------------- host/include/uhd/rfnoc/dirtifier.hpp | 16 ++-- host/include/uhd/rfnoc/mock_block.hpp | 26 ++--- host/include/uhd/rfnoc/noc_block_base.hpp | 10 +- host/include/uhd/rfnoc/property.hpp | 16 ++-- host/include/uhd/transport/tcp_zero_copy.hpp | 2 +- host/include/uhd/transport/usb_zero_copy.hpp | 2 +- host/include/uhd/types/filters.hpp | 6 +- host/include/uhd/usrp/dboard_base.hpp | 6 +- host/include/uhd/usrp/dboard_iface.hpp | 2 +- host/include/uhd/utils/soft_register.hpp | 30 +++--- 11 files changed, 127 insertions(+), 127 deletions(-) (limited to 'host/include') 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 addrs, const std::vector 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 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 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 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; - 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(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(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*>(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 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 @@ -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 enumerate() const + std::vector enumerate() const override { std::vector 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 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 enumerate() const + std::vector enumerate() const override { std::vector paths; for (const soft_regmap_accessor_t* regmap : _regmaps) { -- cgit v1.2.3