11 #ifndef INCLUDED_GR_RUNTIME_FLOWGRAPH_H
12 #define INCLUDED_GR_RUNTIME_FLOWGRAPH_H
27 basic_block_sptr d_basic_block;
34 d_basic_block =
block;
37 basic_block_sptr
block()
const {
return d_basic_block; }
38 int port()
const {
return d_port; }
41 return d_basic_block->alias() +
":" + std::to_string(d_port);
49 return (d_basic_block == other.d_basic_block && d_port == other.d_port);
55 basic_block_sptr d_basic_block;
63 d_basic_block =
block;
67 basic_block_sptr
block()
const {
return d_basic_block; }
69 bool is_hier()
const {
return d_is_hier; }
81 return (d_basic_block == other.d_basic_block &&
pmt::equal(d_port, other.d_port));
94 edge() : d_src(), d_dst(){};
102 return d_src.identifier() +
"->" + d_dst.identifier();
129 return d_src.identifier() +
"->" + d_dst.identifier();
176 void connect(basic_block_sptr src_block,
178 basic_block_sptr dst_block,
184 void disconnect(basic_block_sptr src_block,
186 basic_block_sptr dst_block,
267 void check_dst_not_used(
const endpoint& dst);
271 void check_contiguity(basic_block_sptr
block,
272 const std::vector<int>& used_ports,
282 bool source_p(basic_block_sptr
block);
289 basic_block_sptr dst_block,
297 basic_block_sptr dst_block,
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Class representing a connection between to graph endpoints.
Definition: flowgraph.h:92
const endpoint & src() const
Definition: flowgraph.h:98
const endpoint & dst() const
Definition: flowgraph.h:99
std::string identifier() const
Definition: flowgraph.h:100
edge(const endpoint &src, const endpoint &dst)
Definition: flowgraph.h:95
edge()
Definition: flowgraph.h:94
Class representing a specific input or output graph endpoint.
Definition: flowgraph.h:25
std::string identifier() const
Definition: flowgraph.h:39
endpoint(basic_block_sptr block, int port)
Definition: flowgraph.h:32
bool operator==(const endpoint &other) const
Definition: flowgraph.h:47
int port() const
Definition: flowgraph.h:38
endpoint()
Definition: flowgraph.h:31
basic_block_sptr block() const
Definition: flowgraph.h:37
Class representing a directed, acyclic graph of basic blocks.
Definition: flowgraph.h:150
gr::logger_ptr d_debug_logger
Definition: flowgraph.h:255
basic_block_vector_t d_blocks
Definition: flowgraph.h:251
basic_block_vector_t calc_used_blocks()
calculates all used blocks in a flow graph
basic_block_vector_t calc_downstream_blocks(basic_block_sptr block, int port)
void connect(const msg_endpoint &src, const msg_endpoint &dst)
Connect two message endpoints.
basic_block_vector_t topological_sort(basic_block_vector_t &blocks)
topologically sort blocks
edge_vector_t calc_upstream_edges(basic_block_sptr block)
edge_vector_t d_edges
Definition: flowgraph.h:252
edge calc_upstream_edge(basic_block_sptr block, int port)
const edge_vector_t & edges() const
Get vector of edges.
Definition: flowgraph.h:218
void disconnect(const msg_endpoint &src, const msg_endpoint &dst)
Disconnect two message endpoints.
std::vector< int > calc_used_ports(basic_block_sptr block, bool check_inputs)
void validate()
Validate flow graph.
void disconnect(const endpoint &src, const endpoint &dst)
Disconnect two endpoints.
std::vector< basic_block_vector_t > partition()
Calculate vector of disjoint graph partitions.
msg_edge_vector_t d_msg_edges
Definition: flowgraph.h:253
bool has_block_p(basic_block_sptr block)
const msg_edge_vector_t & msg_edges() const
Get vector of message edges.
Definition: flowgraph.h:223
void clear()
Clear existing flowgraph.
friend GR_RUNTIME_API flowgraph_sptr make_flowgraph()
gr::logger_ptr d_logger
Definition: flowgraph.h:254
virtual ~flowgraph()
Destruct an arbitrary flowgraph.
void connect(const endpoint &src, const endpoint &dst)
Connect two endpoints.
std::shared_ptr< io_signature > sptr
Definition: io_signature.h:52
Class representing a msg connection between to graph msg endpoints.
Definition: flowgraph.h:119
~msg_edge()
Definition: flowgraph.h:123
std::string identifier() const
Definition: flowgraph.h:127
const msg_endpoint & src() const
Definition: flowgraph.h:125
const msg_endpoint & dst() const
Definition: flowgraph.h:126
msg_edge(const msg_endpoint &src, const msg_endpoint &dst)
Definition: flowgraph.h:122
msg_edge()
Definition: flowgraph.h:121
Definition: flowgraph.h:53
bool is_hier() const
Definition: flowgraph.h:69
void set_hier(bool h)
Definition: flowgraph.h:70
basic_block_sptr block() const
Definition: flowgraph.h:67
bool operator==(const msg_endpoint &other) const
Definition: flowgraph.h:79
pmt::pmt_t port() const
Definition: flowgraph.h:68
msg_endpoint(basic_block_sptr block, pmt::pmt_t port, bool is_hier=false)
Definition: flowgraph.h:61
msg_endpoint()
Definition: flowgraph.h:60
std::string identifier() const
Definition: flowgraph.h:71
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::vector< msg_edge >::iterator msg_edge_viter_t
Definition: flowgraph.h:139
std::vector< edge >::iterator edge_viter_t
Definition: flowgraph.h:112
std::shared_ptr< logger > logger_ptr
Definition: logger.h:250
std::string dot_graph_fg(flowgraph_sptr fg)
std::vector< basic_block_sptr > basic_block_vector_t
Definition: basic_block.h:431
std::vector< msg_edge > msg_edge_vector_t
Definition: flowgraph.h:138
bool operator==(const io_signature &lhs, const io_signature &rhs)
std::vector< edge > edge_vector_t
Definition: flowgraph.h:111
std::vector< endpoint > endpoint_vector_t
Definition: flowgraph.h:85
std::vector< endpoint >::iterator endpoint_viter_t
Definition: flowgraph.h:86
GR_RUNTIME_API flowgraph_sptr make_flowgraph()
std::ostream & operator<<(std::ostream &os, basic_block_sptr basic_block)
Definition: basic_block.h:436
PMT_API bool equal(const pmt_t &x, const pmt_t &y)
PMT_API const std::string symbol_to_string(const pmt_t &sym)
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83
#define PMT_NIL
Definition: pmt.h:121