16#include <unordered_map>
17#include <unordered_set>
18#include <boost/graph/adjacency_list.hpp>
26namespace uhd {
namespace rfnoc {
42 std::unordered_map<res_source_info, std::vector<res_source_info>>;
63 static const size_t ANY_PORT = size_t(~0);
126 template <
typename prop_data_t>
128 const std::string&
id,
const prop_data_t& val,
const size_t instance = 0);
181 template <
typename prop_data_t>
182 const prop_data_t& get_property(
183 const std::string&
id,
const size_t instance = 0) ;
341 template <
typename prop_data_t>
343 const std::string&
id,
const prop_data_t& val,
const res_source_info& src_info);
356 template <
typename prop_data_t>
357 const prop_data_t& get_property(
460 const std::vector<size_t>& connected_outputs);
476 friend class node_accessor_t;
497 template <
typename PredicateType>
498 prop_ptrs_t filter_props(PredicateType&& predicate)
501 for (
const auto& type_prop_pair : _props) {
502 for (
const auto& prop : type_prop_pair.second) {
503 if (predicate(prop)) {
504 filtered_props.insert(prop);
509 return filtered_props;
519 property_base_t* inject_edge_property(
520 property_base_t* blueprint, res_source_info new_src_info);
560 void resolve_props();
576 void set_resolve_all_callback(resolve_callback_t&& resolver)
578 _resolve_all_cb = resolver;
583 void clear_resolve_all_callback()
585 _resolve_all_cb = _default_resolve_all_cb;
622 void forward_edge_property(
623 property_base_t* incoming_prop,
const size_t incoming_port);
631 void set_post_action_callback(action_handler_t&& post_handler)
633 _post_action_cb = std::move(post_handler);
650 bool _has_port(
const res_source_info& port_info)
const;
656 mutable std::mutex _prop_mutex;
660 std::vector<property_base_t*>,
665 std::unordered_map<property_base_t*, resolve_callback_t> _clean_cb_registry;
667 using property_resolver_t = std::tuple<prop_ptrs_t, prop_ptrs_t, resolver_fn_t>;
669 std::vector<property_resolver_t> _prop_resolvers;
673 resolve_callback_t _resolve_all_cb;
677 const resolve_callback_t _default_resolve_all_cb = [
this]() {
688 std::unordered_set<std::unique_ptr<property_base_t>> _dynamic_props;
693 std::unordered_map<std::string, forwarding_policy_t> _prop_fwd_policies{
694 {
"", forwarding_policy_t::ONE_TO_ONE}};
697 forwarding_map_t _prop_fwd_map;
702 mutable std::mutex _action_mutex;
705 std::unordered_map<std::string, action_handler_t> _action_handlers;
708 std::unordered_map<std::string, forwarding_policy_t> _action_fwd_policies{
709 {
"", forwarding_policy_t::ONE_TO_ONE}};
714 action_handler_t _post_action_cb = [](
const res_source_info&,
718 forwarding_map_t _action_fwd_map;
723 std::vector<uhd::time_spec_t> _cmd_timespecs;
Definition: device_addr.hpp:38
Definition: dirtifier.hpp:19
virtual std::string get_unique_id() const
Return a unique identifier string for this node. In every RFNoC graph,.
std::vector< std::string > get_property_ids() const
void register_property(property_base_t *prop, resolve_callback_t &&clean_callback=nullptr)
std::unordered_map< res_source_info, std::vector< res_source_info > > forwarding_map_t
Definition: node.hpp:42
void set_action_forwarding_policy(forwarding_policy_t policy, const std::string &action_key="")
void set_prop_forwarding_map(const forwarding_map_t &map)
std::function< void(void)> resolver_fn_t
Definition: node.hpp:37
std::function< void(void)> resolve_callback_t
Definition: node.hpp:38
void register_action_handler(const std::string &id, action_handler_t &&handler)
virtual void set_command_time(uhd::time_spec_t time, const size_t instance)
void post_action(const res_source_info &edge_info, action_info::sptr action)
virtual bool check_topology(const std::vector< size_t > &connected_inputs, const std::vector< size_t > &connected_outputs)
virtual ~node_t()
Definition: node.hpp:70
void set_action_forwarding_map(const forwarding_map_t &map)
virtual size_t get_num_output_ports() const =0
std::unordered_set< property_base_t * > prop_ptrs_t
Definition: node.hpp:219
void set_properties(const uhd::device_addr_t &props, const size_t instance=0)
forwarding_policy_t
Types of property/action forwarding for those not defined by the block itself.
Definition: node.hpp:45
virtual size_t get_num_input_ports() const =0
void add_property_resolver(prop_ptrs_t &&inputs, prop_ptrs_t &&outputs, resolver_fn_t &&resolver_fn)
std::function< void(const res_source_info &, action_info::sptr)> action_handler_t
Definition: node.hpp:40
virtual void clear_command_time(const size_t instance)
static dirtifier_t ALWAYS_DIRTY
A dirtifyer object, useful for properties that always need updating.
Definition: node.hpp:473
virtual uhd::time_spec_t get_command_time(const size_t instance) const
void set_prop_forwarding_policy(forwarding_policy_t policy, const std::string &prop_id="")
Definition: property.hpp:26
access_t
Definition: property.hpp:28
Definition: time_spec.hpp:31
std::unique_ptr< scope_exit > uptr
Definition: scope_exit.hpp:25
#define UHD_API
Definition: config.h:87
Definition: build_info.hpp:12
std::shared_ptr< action_info > sptr
Definition: actions.hpp:32
Definition: res_source_info.hpp:18
source_t
Definition: res_source_info.hpp:21