16 #include <unordered_map> 17 #include <unordered_set> 18 #include <boost/graph/adjacency_list.hpp> 26 namespace uhd {
namespace rfnoc {
41 std::function<void(const res_source_info&, action_info::sptr)>;
43 std::unordered_map<res_source_info, std::vector<res_source_info>>;
64 static const size_t ANY_PORT = size_t(~0);
80 virtual std::string get_unique_id()
const;
88 virtual size_t get_num_input_ports()
const = 0;
96 virtual size_t get_num_output_ports()
const = 0;
110 std::vector<std::string> get_property_ids()
const;
127 template <
typename prop_data_t>
129 const std::string&
id,
const prop_data_t& val,
const size_t instance = 0);
182 template <
typename prop_data_t>
183 const prop_data_t& get_property(
184 const std::string&
id,
const size_t instance = 0) ;
201 virtual void set_command_time(
uhd::time_spec_t time,
const size_t instance);
214 virtual void clear_command_time(
const size_t instance);
242 void register_property(
279 void add_property_resolver(
305 void set_prop_forwarding_policy(
342 template <
typename prop_data_t>
344 const std::string&
id,
const prop_data_t& val,
const res_source_info& src_info);
357 template <
typename prop_data_t>
358 const prop_data_t& get_property(
377 void register_action_handler(
const std::string&
id,
action_handler_t&& handler);
397 void set_action_forwarding_policy(
460 virtual bool check_topology(
const std::vector<size_t>& connected_inputs,
461 const std::vector<size_t>& connected_outputs);
468 virtual void shutdown();
477 friend class node_accessor_t;
498 template <
typename PredicateType>
499 prop_ptrs_t filter_props(PredicateType&& predicate)
502 for (
const auto& type_prop_pair : _props) {
503 for (
const auto& prop : type_prop_pair.second) {
504 if (predicate(prop)) {
505 filtered_props.push_back(prop);
510 return filtered_props;
561 void resolve_props();
579 _resolve_all_cb = resolver;
584 void clear_resolve_all_callback()
586 _resolve_all_cb = _default_resolve_all_cb;
594 _graph_mutex_cb = mutex;
600 void clear_graph_mutex_callback()
602 _graph_mutex_cb = NULL;
639 void forward_edge_property(
650 _post_action_cb = std::move(post_handler);
670 template <
typename prop_data_t>
672 const std::string&
id,
const prop_data_t& val,
const res_source_info& src_info);
678 mutable std::mutex _prop_mutex;
682 std::vector<property_base_t*>,
687 std::unordered_map<property_base_t*, resolve_callback_t> _clean_cb_registry;
689 using property_resolver_t = std::tuple<prop_ptrs_t, prop_ptrs_t, resolver_fn_t>;
691 std::vector<property_resolver_t> _prop_resolvers;
716 std::unordered_set<std::unique_ptr<property_base_t>> _dynamic_props;
721 std::unordered_map<std::string, forwarding_policy_t> _prop_fwd_policies{
722 {
"", forwarding_policy_t::ONE_TO_ONE}};
730 mutable std::mutex _action_mutex;
733 std::unordered_map<std::string, action_handler_t> _action_handlers;
736 std::unordered_map<std::string, forwarding_policy_t> _action_fwd_policies{
737 {
"", forwarding_policy_t::ONE_TO_ONE}};
751 std::vector<uhd::time_spec_t> _cmd_timespecs;
std::function< void(const res_source_info &, action_info::sptr)> action_handler_t
Definition: node.hpp:41
std::vector< property_base_t * > prop_ptrs_t
Definition: node.hpp:220
static dirtifier_t ALWAYS_DIRTY
A dirtifyer object, useful for properties that always need updating.
Definition: node.hpp:474
Definition: time_spec.hpp:28
Definition: dirtifier.hpp:18
Definition: build_info.hpp:12
access_t
Definition: property.hpp:28
std::function< void(void)> resolve_callback_t
Definition: node.hpp:38
std::unordered_map< res_source_info, std::vector< res_source_info > > forwarding_map_t
Definition: node.hpp:43
std::shared_ptr< action_info > sptr
Definition: actions.hpp:32
forwarding_policy_t
Types of property/action forwarding for those not defined by the block itself.
Definition: node.hpp:46
source_t
Definition: res_source_info.hpp:21
std::function< std::recursive_mutex &(void)> graph_mutex_callback_t
Definition: node.hpp:39
Definition: res_source_info.hpp:17
std::unique_ptr< scope_exit > uptr
Definition: scope_exit.hpp:25
#define UHD_API
Definition: config.h:87
Definition: property.hpp:25
std::function< void(void)> resolver_fn_t
Definition: node.hpp:37
Definition: device_addr.hpp:37
virtual ~node_t()
Definition: node.hpp:71