diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-06-06 18:47:05 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:26 -0800 |
commit | 4b23b6102c182e4f5a8612e16752d34465bf190c (patch) | |
tree | 4c505de324038addba02073879de4aae235f1674 /host | |
parent | bba75b29feed2d3b42f9b6c4eb4bc574c09924c7 (diff) | |
download | uhd-4b23b6102c182e4f5a8612e16752d34465bf190c.tar.gz uhd-4b23b6102c182e4f5a8612e16752d34465bf190c.tar.bz2 uhd-4b23b6102c182e4f5a8612e16752d34465bf190c.zip |
rfnoc: noc_block_base: Store property tree reference from make_args
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/rfnoc/noc_block_base.hpp | 13 | ||||
-rw-r--r-- | host/lib/rfnoc/noc_block_base.cpp | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp index fb26f6089..e951ffc72 100644 --- a/host/include/uhd/rfnoc/noc_block_base.hpp +++ b/host/include/uhd/rfnoc/noc_block_base.hpp @@ -8,6 +8,7 @@ #define INCLUDED_LIBUHD_NOC_BLOCK_BASE_HPP #include <uhd/config.hpp> +#include <uhd/property_tree.hpp> #include <uhd/rfnoc/block_id.hpp> #include <uhd/rfnoc/node.hpp> #include <uhd/rfnoc/register_iface_holder.hpp> @@ -105,6 +106,12 @@ public: */ uhd::device_addr_t get_block_args() const { return _block_args; } + //! Return a reference to this block's subtree + uhd::property_tree::sptr& get_tree() const { return _tree; } + + //! Return a reference to this block's subtree (non-const version) + uhd::property_tree::sptr& get_tree() { return _tree; } + protected: noc_block_base(make_args_ptr make_args); @@ -192,6 +199,12 @@ private: //! Arguments that were passed into this block const uhd::device_addr_t _block_args; + //! Reference to this block's subtree + // + // It is mutable because _tree->access<>(..).get() is not const, but we + // need to do just that in some const contexts + mutable uhd::property_tree::sptr _tree; + }; // class noc_block_base }} /* namespace uhd::rfnoc */ diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp index f99d5aae7..6e72decfe 100644 --- a/host/lib/rfnoc/noc_block_base.cpp +++ b/host/lib/rfnoc/noc_block_base.cpp @@ -26,6 +26,7 @@ noc_block_base::noc_block_base(make_args_ptr make_args) , _clock_iface(make_args->clk_iface) , _mb_controller(std::move(make_args->mb_control)) , _block_args(make_args->args) + , _tree(make_args->tree) { // First, create one tick_rate property for every port _tick_rate_props.reserve(get_num_input_ports() + get_num_output_ports()); @@ -62,7 +63,9 @@ noc_block_base::noc_block_base(make_args_ptr make_args) noc_block_base::~noc_block_base() { - // nop + for (const auto& node : _tree->list("")) { + _tree->remove(node); + } } void noc_block_base::set_num_input_ports(const size_t num_ports) |