9 #ifndef INCLUDED_UHD_RFNOC_BLOCK_H
10 #define INCLUDED_UHD_RFNOC_BLOCK_H
15 #include <uhd/rfnoc/noc_block_base.hpp>
16 #include <unordered_map>
37 using sptr = std::shared_ptr<rfnoc_block>;
48 static ::uhd::rfnoc::noc_block_base::sptr
50 const ::uhd::device_addr_t& block_args,
51 const std::string& block_name,
52 const int device_select = -1,
53 const int block_select = -1,
54 const size_t max_ref_count = 1);
59 template <
typename block_type>
62 auto cast_block_ref = std::dynamic_pointer_cast<block_type>(d_block_ref);
63 if (!cast_block_ref) {
64 throw std::runtime_error(
66 "Unable to cast the following block into its desired type: ") +
67 d_block_ref->get_unique_id());
69 return cast_block_ref;
115 void set_properties(const ::uhd::device_addr_t& props,
const size_t instance = 0)
117 d_block_ref->set_properties(props, instance);
130 template <
typename T>
131 void set_property(
const std::string& name,
const T& value,
const size_t port = 0)
133 d_block_ref->set_property<T>(name, value, port);
147 template <
typename T>
150 return d_block_ref->get_property<T>(name, port);
171 void _dispatch_msg_cmd_handler(
const std::string& cmd,
177 std::unordered_map<std::string, cmd_handler_t> _msg_cmd_handlers;
180 ::uhd::rfnoc::noc_block_base::sptr d_block_ref;
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Definition: rfnoc_block.h:29
::uhd::rfnoc::noc_block_base::sptr make_block_ref(rfnoc_graph::sptr graph, const ::uhd::device_addr_t &block_args, const std::string &block_name, const int device_select=-1, const int block_select=-1, const size_t max_ref_count=1)
Factory function to create a UHD block controller reference.
std::vector< std::string > get_property_ids()
rfnoc_block(::uhd::rfnoc::noc_block_base::sptr block_ref)
void set_property(const std::string &name, const T &value, const size_t port=0)
Definition: rfnoc_block.h:131
void set_properties(const ::uhd::device_addr_t &props, const size_t instance=0)
Definition: rfnoc_block.h:115
std::string get_unique_id() const
void register_msg_cmd_handler(const std::string &cmd, cmd_handler_t handler)
Register a new handler for command key cmd.
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) final
This method should never be called by RFNoC blocks, they do the work.
std::function< void(const pmt::pmt_t &, int, const pmt::pmt_t &)> cmd_handler_t
Definition: rfnoc_block.h:157
std::shared_ptr< rfnoc_block > sptr
Definition: rfnoc_block.h:37
const T get_property(const std::string &name, const size_t port=0)
Definition: rfnoc_block.h:148
rfnoc_block()
Definition: rfnoc_block.h:34
std::shared_ptr< block_type > get_block_ref()
Return a type-cast block reference, or throw if the cast failed.
Definition: rfnoc_block.h:60
std::shared_ptr< rfnoc_graph > sptr
Definition: rfnoc_graph.h:32
#define GR_UHD_API
Definition: gr-uhd/include/gnuradio/uhd/api.h:18
GR_RUNTIME_API const pmt::pmt_t msg()
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83
std::vector< const void * > gr_vector_const_void_star
Definition: types.h:28
std::vector< void * > gr_vector_void_star
Definition: types.h:27
std::vector< int > gr_vector_int
Definition: types.h:23