18 #ifndef INCLUDED_LIBUHD_NODE_CTRL_BASE_HPP 19 #define INCLUDED_LIBUHD_NODE_CTRL_BASE_HPP 23 #include <boost/cstdint.hpp> 24 #include <boost/shared_ptr.hpp> 25 #include <boost/utility.hpp> 26 #include <boost/enable_shared_from_this.hpp> 27 #include <boost/function.hpp> 34 #define UHD_RFNOC_BLOCK_TRACE() UHD_MSG(status) << "[" << unique_id() << "] " 40 class node_ctrl_base : boost::noncopyable,
public boost::enable_shared_from_this<node_ctrl_base>
46 typedef boost::shared_ptr<node_ctrl_base>
sptr;
47 typedef boost::weak_ptr<node_ctrl_base>
wptr;
108 template <
typename T>
111 return _find_child_node<T, true>();
116 template <
typename T>
119 return _find_child_node<T, false>();
134 template <
typename T,
typename value_type>
136 boost::function<value_type(boost::shared_ptr<T> node,
size_t port)> get_property,
137 value_type null_value,
138 const std::set< boost::shared_ptr<T> > &exclude_nodes=std::set< boost::shared_ptr<T> >()
140 return _find_unique_property<T, value_type, true>(get_property, null_value, exclude_nodes);
145 template <
typename T,
typename value_type>
147 boost::function<value_type(boost::shared_ptr<T> node,
size_t port)> get_property,
148 value_type null_value,
149 const std::set< boost::shared_ptr<T> > &exclude_nodes=std::set< boost::shared_ptr<T> >()
151 return _find_unique_property<T, value_type, false>(get_property, null_value, exclude_nodes);
210 template <
typename T,
bool downstream>
211 std::vector< boost::shared_ptr<T> > _find_child_node();
221 template <
typename T,
typename value_type,
bool downstream>
222 value_type _find_unique_property(
223 boost::function<value_type(boost::shared_ptr<T>,
size_t)> get_property,
224 value_type NULL_VALUE,
225 const std::set< boost::shared_ptr<T> > &exclude_nodes
230 std::map<size_t, size_t> _upstream_ports;
234 std::map<size_t, size_t> _downstream_ports;
UHD_INLINE value_type find_upstream_unique_property(boost::function< value_type(boost::shared_ptr< T > node, size_t port)> get_property, value_type null_value, const std::set< boost::shared_ptr< T > > &exclude_nodes=std::set< boost::shared_ptr< T > >())
Definition: node_ctrl_base.hpp:146
node_map_t list_upstream_nodes()
Definition: node_ctrl_base.hpp:65
virtual void _register_upstream_node(node_ctrl_base::sptr upstream_node, size_t port)
std::map< size_t, wptr > node_map_t
Definition: node_ctrl_base.hpp:48
virtual ~node_ctrl_base()
Definition: node_ctrl_base.hpp:159
void set_downstream_port(const size_t this_port, const size_t remote_port)
virtual void _register_downstream_node(node_ctrl_base::sptr downstream_node, size_t port)
node_map_t list_downstream_nodes()
Definition: node_ctrl_base.hpp:64
node_ctrl_base(void)
Definition: node_ctrl_base.hpp:158
std::pair< size_t, wptr > node_map_pair_t
Definition: node_ctrl_base.hpp:49
Definition: build_info.hpp:25
uhd::device_addr_t _args
Stores default arguments.
Definition: node_ctrl_base.hpp:159
boost::shared_ptr< node_ctrl_base > sptr
Definition: node_ctrl_base.hpp:46
#define UHD_RFNOC_API
Definition: config.hpp:103
size_t get_downstream_port(const size_t this_port)
size_t get_upstream_port(const size_t this_port)
#define UHD_INLINE
Definition: config.h:63
node_map_t _downstream_nodes
List of downstream nodes.
Definition: node_ctrl_base.hpp:174
UHD_INLINE std::vector< boost::shared_ptr< T > > find_upstream_node()
Definition: node_ctrl_base.hpp:117
void set_upstream_port(const size_t this_port, const size_t remote_port)
virtual std::string unique_id() const
Returns a unique string that identifies this block.
UHD_INLINE value_type find_downstream_unique_property(boost::function< value_type(boost::shared_ptr< T > node, size_t port)> get_property, value_type null_value, const std::set< boost::shared_ptr< T > > &exclude_nodes=std::set< boost::shared_ptr< T > >())
Definition: node_ctrl_base.hpp:135
UHD_INLINE std::vector< boost::shared_ptr< T > > find_downstream_node()
Definition: node_ctrl_base.hpp:109
boost::weak_ptr< node_ctrl_base > wptr
Definition: node_ctrl_base.hpp:47
node_map_t _upstream_nodes
List of upstream nodes.
Definition: node_ctrl_base.hpp:171
Definition: device_addr.hpp:47
Definition: node_ctrl_base.hpp:40