11#ifndef INCLUDED_GR_RUNTIME_HIER_BLOCK2_H
12#define INCLUDED_GR_RUNTIME_HIER_BLOCK2_H
26class hier_block2_detail;
36 friend class hier_block2_detail;
37 template <
typename T,
typename... Args>
38 friend std::shared_ptr<T> gnuradio::make_block_sptr(Args&&... args);
46 std::unique_ptr<hier_block2_detail> d_detail;
93 void connect(basic_block_sptr src,
int src_port, basic_block_sptr dst,
int dst_port);
105 basic_block_sptr dst,
109 basic_block_sptr dst,
110 std::string dstport);
113 basic_block_sptr dst,
117 basic_block_sptr dst,
118 std::string dstport);
137 disconnect(basic_block_sptr src,
int src_port, basic_block_sptr dst,
int dst_port);
213 return message_port_is_hier_in(port_id) || message_port_is_hier_out(port_id);
232 throw std::invalid_argument(
233 "hier msg in port by this name already registered");
235 throw std::invalid_argument(
236 "block already has a primitive input port by this name");
237 hier_message_ports_in =
pmt::list_add(hier_message_ports_in, port_id);
243 throw std::invalid_argument(
244 "hier msg out port by this name already registered");
246 throw std::invalid_argument(
247 "block already has a primitive output port by this name");
248 hier_message_ports_out =
pmt::list_add(hier_message_ports_out, port_id);
321inline hier_block2_sptr cast_to_hier_block2_sptr(basic_block_sptr
block)
323 return std::dynamic_pointer_cast<hier_block2, basic_block>(
block);
The abstract base class for all signal processing blocks.
Definition: basic_block.h:63
virtual bool has_msg_port(pmt::pmt_t which_port)
Definition: basic_block.h:306
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Hierarchical container class for gr::block's and gr::hier_block2's.
Definition: hier_block2.h:34
std::vector< int > processor_affinity() override
Get the current processor affinity.
std::string log_level() override
Get the logger's output level.
void set_max_output_buffer(int max_output_buffer)
Sets max buffer size (itemcount) on all output ports.
void set_max_output_buffer(size_t port, int max_output_buffer)
Sets max buffer size (itemcount) on output port port.
void msg_disconnect(basic_block_sptr src, pmt::pmt_t srcport, basic_block_sptr dst, pmt::pmt_t dstport)
void disconnect_all()
Disconnect all connections in the internal flowgraph.
flat_flowgraph_sptr flatten() const
void msg_disconnect(basic_block_sptr src, std::string srcport, basic_block_sptr dst, std::string dstport)
pmt::pmt_t hier_message_ports_out
Definition: hier_block2.h:227
void disconnect(basic_block_sptr block)
Remove a gr-block or hierarchical block from the internal flowgraph.
opaque_self self()
Return an object, representing the current block, which can be passed to connect.
void set_min_output_buffer(int min_output_buffer)
Sets min buffer size (itemcount) on all output ports.
hier_block2(const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature)
bool message_port_is_hier_in(pmt::pmt_t port_id) override
Definition: hier_block2.h:216
int max_output_buffer(size_t port=0)
Returns max buffer size (itemcount) on output port i.
void msg_connect(basic_block_sptr src, pmt::pmt_t srcport, basic_block_sptr dst, pmt::pmt_t dstport)
Add gr-blocks or hierarchical blocks to internal graph and wire together.
void connect(basic_block_sptr src, int src_port, basic_block_sptr dst, int dst_port)
Add gr-blocks or hierarchical blocks to internal graph and wire together.
basic_block_sptr opaque_self
typedef for object returned from self().
Definition: hier_block2.h:64
void unset_processor_affinity() override
Remove processor affinity for all blocks in hier_block2.
void disconnect(basic_block_sptr src, int src_port, basic_block_sptr dst, int dst_port)
Disconnect a pair of gr-blocks or hierarchical blocks in internal flowgraph.
bool message_port_is_hier(pmt::pmt_t port_id) override
Definition: hier_block2.h:211
hier_block2_sptr to_hier_block2()
void set_processor_affinity(const std::vector< int > &mask) override
Set the affinity of all blocks in hier_block2 to processor core n.
void msg_connect(basic_block_sptr src, std::string srcport, basic_block_sptr dst, std::string dstport)
bool all_min_output_buffer_p(void)
Get if all block min buffers should be set.
void connect(basic_block_sptr block)
Add a stand-alone (possibly hierarchical) block to internal graph.
void message_port_register_hier_out(pmt::pmt_t port_id)
Definition: hier_block2.h:240
bool has_msg_port(pmt::pmt_t which_port) override
Definition: hier_block2.h:206
void set_min_output_buffer(size_t port, int min_output_buffer)
Sets min buffer size (itemcount) on output port port.
pmt::pmt_t hier_message_ports_in
Definition: hier_block2.h:226
bool message_port_is_hier_out(pmt::pmt_t port_id) override
Definition: hier_block2.h:221
bool all_max_output_buffer_p(void)
Get if all block max buffers should be set.
int min_output_buffer(size_t port=0)
Returns min buffer size (itemcount) on output port i.
void set_log_level(const std::string &level) override
Set the logger's output level.
void message_port_register_hier_in(pmt::pmt_t port_id)
Definition: hier_block2.h:229
std::shared_ptr< io_signature > sptr
Definition: io_signature.h:47
thread-safe message queue
Definition: msg_queue.h:25
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29
GR_RUNTIME_API hier_block2_sptr make_hier_block2(const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature)
public constructor for hier_block2
GR_RUNTIME_API std::string dot_graph(hier_block2_sptr hierblock2)
Return hierarchical block's flow graph represented in dot language.
PMT_API bool dict_has_key(const pmt_t &dict, const pmt_t &key)
Return true if key exists in dict.
PMT_API pmt_t list_add(pmt_t list, const pmt_t &item)
Return list with item added to it.
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83
PMT_API bool list_has(pmt_t list, const pmt_t &item)
Return bool of list contains item.