diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-03-24 16:54:11 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:13 -0800 |
commit | efb1d5a4729ea892ea03b8d0265aae9e8fadfff1 (patch) | |
tree | 23cd4dbf85c635d381aaf7b0f6e9bd15eeca08fc /host/lib/include/uhdlib/rfnoc/node_accessor.hpp | |
parent | 44f9bca2c5b561fa3f5f08d0d616c91d2142cbf9 (diff) | |
download | uhd-efb1d5a4729ea892ea03b8d0265aae9e8fadfff1.tar.gz uhd-efb1d5a4729ea892ea03b8d0265aae9e8fadfff1.tar.bz2 uhd-efb1d5a4729ea892ea03b8d0265aae9e8fadfff1.zip |
rfnoc: Add properties, nodes, and accessors
Adds the following classes:
- uhd::rfnoc::node_t, the base class for RFNoC nodes
- uhd::rfnoc::node_accessor_t, a class to access private properties
- uhd::rfnoc::res_source_info, a struct that identifies where properties
come from
- uhd::rfnoc::property_t, and property_base_t (its parent)
- uhd::rfnoc::prop_accessor_t, a class to access properties
Add always dirty property (dirtifier).
Also adds unit tests for properties.
Diffstat (limited to 'host/lib/include/uhdlib/rfnoc/node_accessor.hpp')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/node_accessor.hpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/node_accessor.hpp b/host/lib/include/uhdlib/rfnoc/node_accessor.hpp new file mode 100644 index 000000000..26e6a5607 --- /dev/null +++ b/host/lib/include/uhdlib/rfnoc/node_accessor.hpp @@ -0,0 +1,84 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_LIBUHD_NODE_ACCESSOR_HPP +#define INCLUDED_LIBUHD_NODE_ACCESSOR_HPP + +#include <uhd/rfnoc/node.hpp> +#include <functional> + +namespace uhd { namespace rfnoc { + +//! Special class which may access nodes +// +// For the sake of property resolution, we require access to certain private +// members of nodes. Instead of giving the entire graph +// access to everything, we create this accessor class which is not available +// in the public API. +class node_accessor_t +{ +public: + using prop_ptrs_t = node_t::prop_ptrs_t; + + /*! Initializes the properties of a node. See node_t::init_props() for + * details. + */ + void init_props(node_t* node) + { + node->init_props(); + } + + /*! Does a local resolution of properties on \p node. + * + * See node_t::resolve_props for details. + */ + void resolve_props(node_t* node) + { + node->resolve_props(); + } + + /*! Returns a filtered list of properties. + * + * The return list contains all properties that match a given predicate. + */ + template <typename PredicateType> + node_t::prop_ptrs_t filter_props(node_t* node, PredicateType&& predicate) + { + return node->filter_props(std::forward<PredicateType>(predicate)); + } + + /*! Mark all properties on this node as clean + * + * See node_t::clean_props() for details. + */ + void clean_props(node_t* node) + { + node->clean_props(); + } + + /*! Set a resolver callback for the node + * + * See node_t::set_resolve_all_callback() for details. + */ + void set_resolve_all_callback(node_t* node, node_t::resolve_callback_t&& resolver) + { + node->set_resolve_all_callback(std::move(resolver)); + } + + /*! Forward an edge property to \p dst_node + * + * See node_t::forward_edge_property() for details. + */ + void forward_edge_property(node_t* dst_node, property_base_t* incoming_prop) + { + dst_node->forward_edge_property(incoming_prop); + } +}; + + +}} /* namespace uhd::rfnoc */ + +#endif /* INCLUDED_LIBUHD_NODE_ACCESSOR_HPP */ |