USRP Hardware Driver and Device Manual  Version: 4.11.0.0-0-g0d7ed3b1
UHD and USRP Manual
node_accessor.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2019 Ettus Research, a National Instruments Brand
3 //
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 //
6 
7 #pragma once
8 
9 #include <uhd/rfnoc/actions.hpp>
10 #include <uhd/rfnoc/node.hpp>
12 #include <functional>
13 
14 namespace uhd { namespace rfnoc {
15 
29 {
30 public:
32 
36  void init_props(node_t* node)
37  {
38  node->init_props();
39  }
40 
45  void resolve_props(node_t* node)
46  {
47  node->resolve_props();
48  }
49 
54  template <typename PredicateType>
55  node_t::prop_ptrs_t filter_props(node_t* node, PredicateType&& predicate)
56  {
57  return node->filter_props(std::forward<PredicateType>(predicate));
58  }
59 
64  void clean_props(node_t* node)
65  {
66  node->clean_props();
67  }
68 
74  {
75  node->set_resolve_all_callback(std::move(resolver));
76  }
77 
78  /* Restore the resolver callback to its default implementation
79  *
80  * See node_t::clear_resolve_all_callback() for details.
81  */
83  {
84  node->clear_resolve_all_callback();
85  }
86 
93  {
94  node->set_graph_mutex_callback(std::move(mutex));
95  }
96 
103  {
104  node->clear_graph_mutex_callback();
105  }
106 
112  node_t* dst_node, const size_t dst_port, property_base_t* incoming_prop)
113  {
114  dst_node->forward_edge_property(incoming_prop, dst_port);
115  }
116 
122  node_t* node, node_t::post_action_handler_t&& post_handler)
123  {
124  node->set_post_action_callback(std::move(post_handler));
125  }
126 
132  node_t* node, const res_source_info& port_info, action_info::sptr action)
133  {
134  node->receive_action(port_info, action);
135  }
136 
142  node_t* node, const res_source_info& edge_info, action_info::sptr action)
143  {
144  node->post_action(edge_info, action);
145  }
146 
151  bool check_topology(node_t* node,
152  const std::vector<size_t>& connected_inputs,
153  const std::vector<size_t>& connected_outputs)
154  {
155  return node->check_topology(connected_inputs, connected_outputs);
156  }
157 
162  void shutdown(node_t* node)
163  {
164  node->shutdown();
165  }
166 };
167 
168 
169 }} /* namespace uhd::rfnoc */
Special class which may access nodes.
Definition: node_accessor.hpp:29
void clear_graph_mutex_callback(node_t *node)
Definition: node_accessor.hpp:102
void resolve_props(node_t *node)
Definition: node_accessor.hpp:45
void send_action(node_t *node, const res_source_info &port_info, action_info::sptr action)
Definition: node_accessor.hpp:131
void set_post_action_callback(node_t *node, node_t::post_action_handler_t &&post_handler)
Definition: node_accessor.hpp:121
void init_props(node_t *node)
Definition: node_accessor.hpp:36
node_t::prop_ptrs_t prop_ptrs_t
Definition: node_accessor.hpp:31
node_t::prop_ptrs_t filter_props(node_t *node, PredicateType &&predicate)
Definition: node_accessor.hpp:55
void clean_props(node_t *node)
Definition: node_accessor.hpp:64
void set_resolve_all_callback(node_t *node, node_t::resolve_callback_t &&resolver)
Definition: node_accessor.hpp:73
void forward_edge_property(node_t *dst_node, const size_t dst_port, property_base_t *incoming_prop)
Definition: node_accessor.hpp:111
void shutdown(node_t *node)
Definition: node_accessor.hpp:162
void set_graph_mutex_callback(node_t *node, node_t::graph_mutex_callback_t &&mutex)
Definition: node_accessor.hpp:92
bool check_topology(node_t *node, const std::vector< size_t > &connected_inputs, const std::vector< size_t > &connected_outputs)
Definition: node_accessor.hpp:151
void clear_resolve_all_callback(node_t *node)
Definition: node_accessor.hpp:82
void post_action(node_t *node, const res_source_info &edge_info, action_info::sptr action)
Definition: node_accessor.hpp:141
Definition: node.hpp:35
std::vector< property_base_t * > prop_ptrs_t
Definition: node.hpp:231
std::function< void(void)> resolve_callback_t
Definition: node.hpp:44
virtual bool check_topology(const std::vector< size_t > &connected_inputs, const std::vector< size_t > &connected_outputs)
virtual void shutdown()
std::function< void(const res_source_info &, action_info::sptr, action_mode_t)> post_action_handler_t
Definition: node.hpp:49
std::function< std::recursive_mutex &(void)> graph_mutex_callback_t
Definition: node.hpp:45
void post_action(const res_source_info &edge_info, action_info::sptr action, action_mode_t mode=action_mode_t::SYNC)
Definition: property.hpp:26
Definition: build_info.hpp:12
std::shared_ptr< action_info > sptr
Definition: actions.hpp:39
Definition: res_source_info.hpp:18