9#ifndef INCLUDED_UHD_RFNOC_BLOCK_H
10#define INCLUDED_UHD_RFNOC_BLOCK_H
14#include <uhd/rfnoc/noc_block_base.hpp>
34 using sptr = std::shared_ptr<rfnoc_block>;
45 static ::uhd::rfnoc::noc_block_base::sptr
47 const ::uhd::device_addr_t& block_args,
48 const std::string& block_name,
49 const int device_select = -1,
50 const int block_select = -1,
51 const size_t max_ref_count = 1);
56 template <
typename block_type>
59 auto cast_block_ref = std::dynamic_pointer_cast<block_type>(d_block_ref);
60 if (!cast_block_ref) {
61 throw std::runtime_error(
63 "Unable to cast the following block into its desired type: ") +
64 d_block_ref->get_unique_id());
66 return cast_block_ref;
112 void set_properties(const ::uhd::device_addr_t& props,
const size_t instance = 0)
114 d_block_ref->set_properties(props, instance);
127 template <
typename T>
128 void set_property(
const std::string& name,
const T& value,
const size_t port = 0)
130 d_block_ref->set_property<T>(name, value, port);
144 template <
typename T>
147 return d_block_ref->get_property<T>(name, port);
154 ::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:26
std::shared_ptr< block_type > get_block_ref()
Return a type-cast block reference, or throw if the cast failed.
Definition: rfnoc_block.h:57
::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.
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:128
void set_properties(const ::uhd::device_addr_t &props, const size_t instance=0)
Definition: rfnoc_block.h:112
std::vector< std::string > get_property_ids()
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
This method should never be called by RFNoC blocks, they do the work.
std::string get_unique_id() const
std::shared_ptr< rfnoc_block > sptr
Definition: rfnoc_block.h:34
const T get_property(const std::string &name, const size_t port=0)
Definition: rfnoc_block.h:145
rfnoc_block()
Definition: rfnoc_block.h:31
std::shared_ptr< rfnoc_graph > sptr
Definition: rfnoc_graph.h:32
#define GR_UHD_API
Definition: gr-uhd/include/gnuradio/uhd/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29
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