GNU Radio C++ API Reference: gr::flowgraph Class Reference

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
gr::flowgraph Class Reference
Implementation Details

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

`#include <gnuradio/flowgraph.h>`

## Public Member Functions
virtual | ~flowgraph ()
| Destruct an arbitrary flowgraph.
void | connect (const endpoint &src, const endpoint &dst)
| Connect two endpoints.
void | disconnect (const endpoint &src, const endpoint &dst)
| Disconnect two endpoints.
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
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
void | connect (const msg_endpoint &src, const msg_endpoint &dst)
| Connect two message endpoints.
void | disconnect (const msg_endpoint &src, const msg_endpoint &dst)
| Disconnect two message endpoints.
void | validate ()
| Validate flow graph.
void | clear ()
| Clear existing flowgraph.
const edge_vector_t & | edges () const
| Get vector of edges.
const msg_edge_vector_t & | msg_edges () const
| Get vector of message edges.
basic_block_vector_t | calc_used_blocks ()
| calculates all used blocks in a flow graph
basic_block_vector_t | topological_sort (basic_block_vector_t &blocks)
| topologically sort blocks
std::vector< basic_block_vector_t > | partition ()
| Calculate vector of disjoint graph partitions.

## 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
gr::logger_ptr | d_logger
gr::logger_ptr | d_debug_logger

## Friends
GR_RUNTIME_API flowgraph_sptr | make_flowgraph ()

## Detailed Description

Class representing a directed, acyclic graph of basic blocks.

## Constructor & Destructor Documentation

## ◆ ~flowgraph()

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

Destruct an arbitrary flowgraph.

## ◆ flowgraph()

gr::flowgraph::flowgraph | ( |  | ) |
| protected

## Member Function Documentation

## ◆ calc_downstream_blocks()

basic_block_vector_t gr::flowgraph::calc_downstream_blocks | ( | basic_block_sptr | block,
|  | int | port )
| protected

Referenced by calc_upstream_edge().

## ◆ calc_upstream_edge()

edge gr::flowgraph::calc_upstream_edge | ( | basic_block_sptr | block,
|  | int | port )
| protected

References calc_downstream_blocks().

## ◆ calc_upstream_edges()

edge_vector_t gr::flowgraph::calc_upstream_edges | ( | basic_block_sptr | block | ) |
| protected

## ◆ calc_used_blocks()

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

## ◆ calc_used_ports()

std::vector< int > gr::flowgraph::calc_used_ports | ( | basic_block_sptr | block,
|  | bool | check_inputs )
| protected

## ◆ clear()

void gr::flowgraph::clear | ( |  | ) |

Clear existing flowgraph.

## ◆ connect() [1/3]

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(), and gr::endpoint::endpoint().

## ◆ connect() [2/3]

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(), and disconnect().

## ◆ connect() [3/3]

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.

## ◆ disconnect() [1/3]

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(), and gr::endpoint::endpoint().

## ◆ disconnect() [2/3]

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

Disconnect two endpoints.

References connect(), and disconnect().

Referenced by disconnect(), and disconnect().

## ◆ disconnect() [3/3]

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

Disconnect two message endpoints.

## ◆ edges()

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

Get vector of edges.

References d_edges.

## ◆ has_block_p()

bool gr::flowgraph::has_block_p | ( | basic_block_sptr | block | ) |
| protected

## ◆ msg_edges()

const msg_edge_vector_t & gr::flowgraph::msg_edges | ( |  | ) | const
| inline

Get vector of message edges.

References d_msg_edges.

## ◆ partition()

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

Calculate vector of disjoint graph partitions.

Returns
  vector of disjoint vectors of topologically sorted blocks

## ◆ topological_sort()

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.

## ◆ validate()

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 Symbol Documentation

## ◆ make_flowgraph

GR_RUNTIME_API flowgraph_sptr make_flowgraph | ( |  | ) |
| friend

References GR_RUNTIME_API.

## Member Data Documentation

## ◆ d_blocks

basic_block_vector_t gr::flowgraph::d_blocks
| protected

## ◆ d_debug_logger

gr::logger_ptr gr::flowgraph::d_debug_logger
| protected

## ◆ d_edges

edge_vector_t gr::flowgraph::d_edges
| protected

Referenced by edges().

## ◆ d_logger

gr::logger_ptr gr::flowgraph::d_logger
| protected

## ◆ d_msg_edges

msg_edge_vector_t gr::flowgraph::d_msg_edges
| protected

Referenced by msg_edges().

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

- flowgraph.h