GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gr::flowgraph Class Reference

Class representing a directed, acyclic graph of basic blocks. More...

#include <gnuradio/flowgraph.h>

Public Member Functions

virtual ~flowgraph ()
 Destruct an arbitrary flowgraph. More...
 
void connect (const endpoint &src, const endpoint &dst)
 Connect two endpoints. More...
 
void disconnect (const endpoint &src, const endpoint &dst)
 Disconnect two endpoints. More...
 
void connect (basic_block_sptr src_block, int src_port, basic_block_sptr dst_block, int dst_port)
 convenience wrapper; used to connect two endpoints More...
 
void disconnect (basic_block_sptr src_block, int src_port, basic_block_sptr dst_block, int dst_port)
 convenience wrapper; used to disconnect two endpoints More...
 
void connect (const msg_endpoint &src, const msg_endpoint &dst)
 Connect two message endpoints. More...
 
void disconnect (const msg_endpoint &src, const msg_endpoint &dst)
 Disconnect two message endpoints. More...
 
void validate ()
 Validate flow graph. More...
 
void clear ()
 Clear existing flowgraph. More...
 
const edge_vector_tedges () const
 Get vector of edges. More...
 
const msg_edge_vector_tmsg_edges () const
 Get vector of message edges. More...
 
basic_block_vector_t calc_used_blocks ()
 calculates all used blocks in a flow graph More...
 
basic_block_vector_t topological_sort (basic_block_vector_t &blocks)
 topologically sort blocks More...
 
std::vector< basic_block_vector_tpartition ()
 Calculate vector of disjoint graph partions. More...
 

Protected Member Functions

 flowgraph ()
 
std::vector< int > calc_used_ports (basic_block_sptr block, bool check_inputs)
 
basic_block_vector_t calc_downstream_blocks (basic_block_sptr block, int port)
 
edge_vector_t calc_upstream_edges (basic_block_sptr block)
 
bool has_block_p (basic_block_sptr block)
 
edge calc_upstream_edge (basic_block_sptr block, int port)
 

Protected Attributes

basic_block_vector_t d_blocks
 
edge_vector_t d_edges
 
msg_edge_vector_t d_msg_edges
 

Friends

GR_RUNTIME_API flowgraph_sptr make_flowgraph ()
 

Detailed Description

Class representing a directed, acyclic graph of basic blocks.

Constructor & Destructor Documentation

virtual gr::flowgraph::~flowgraph ( )
virtual

Destruct an arbitrary flowgraph.

gr::flowgraph::flowgraph ( )
protected

Member Function Documentation

basic_block_vector_t gr::flowgraph::calc_downstream_blocks ( basic_block_sptr  block,
int  port 
)
protected
edge gr::flowgraph::calc_upstream_edge ( basic_block_sptr  block,
int  port 
)
protected
edge_vector_t gr::flowgraph::calc_upstream_edges ( basic_block_sptr  block)
protected
basic_block_vector_t gr::flowgraph::calc_used_blocks ( )

calculates all used blocks in a flow graph

Iterates over all message edges and stream edges, noting both endpoints in a vector.

Returns
a unique vector of used blocks
std::vector<int> gr::flowgraph::calc_used_ports ( basic_block_sptr  block,
bool  check_inputs 
)
protected
void gr::flowgraph::clear ( )

Clear existing flowgraph.

void gr::flowgraph::connect ( const endpoint src,
const endpoint dst 
)

Connect two endpoints.

Checks the validity of both endpoints, and whether the destination is unused so far, then adds the edge to the internal list of edges.

Referenced by connect().

void gr::flowgraph::connect ( basic_block_sptr  src_block,
int  src_port,
basic_block_sptr  dst_block,
int  dst_port 
)
inline

convenience wrapper; used to connect two endpoints

References connect().

void gr::flowgraph::connect ( const msg_endpoint src,
const msg_endpoint dst 
)

Connect two message endpoints.

Checks the validity of both endpoints, then adds the edge to the internal list of edges.

void gr::flowgraph::disconnect ( const endpoint src,
const endpoint dst 
)

Disconnect two endpoints.

Referenced by disconnect().

void gr::flowgraph::disconnect ( basic_block_sptr  src_block,
int  src_port,
basic_block_sptr  dst_block,
int  dst_port 
)
inline

convenience wrapper; used to disconnect two endpoints

References disconnect().

void gr::flowgraph::disconnect ( const msg_endpoint src,
const msg_endpoint dst 
)

Disconnect two message endpoints.

const edge_vector_t& gr::flowgraph::edges ( ) const
inline

Get vector of edges.

bool gr::flowgraph::has_block_p ( basic_block_sptr  block)
protected
const msg_edge_vector_t& gr::flowgraph::msg_edges ( ) const
inline

Get vector of message edges.

std::vector<basic_block_vector_t> gr::flowgraph::partition ( )

Calculate vector of disjoint graph partions.

Returns
vector of disjoint vectors of topologically sorted blocks
basic_block_vector_t gr::flowgraph::topological_sort ( basic_block_vector_t blocks)

topologically sort blocks

Uses depth-first search to return a sorted vector of blocks

Returns
toplogically sorted vector of blocks. All the sources come first.
void gr::flowgraph::validate ( )

Validate flow graph.

Gathers all used blocks, checks the contiguity of all connected in- and outputs, and calls the check_topology method of each block.

Friends And Related Function Documentation

GR_RUNTIME_API flowgraph_sptr make_flowgraph ( )
friend

Member Data Documentation

basic_block_vector_t gr::flowgraph::d_blocks
protected
edge_vector_t gr::flowgraph::d_edges
protected
msg_edge_vector_t gr::flowgraph::d_msg_edges
protected

The documentation for this class was generated from the following file: