GNU Radio 3.5.3.1 C++ API

Top-level hierarchical block representing a flowgraph. More...

#include <gr_top_block.h>

Inheritance diagram for gr_top_block:

List of all members.

Public Member Functions

 ~gr_top_block ()
void run (int max_noutput_items=100000)
 The simple interface to running a flowgraph.
void start (int max_noutput_items=100000)
void stop ()
void wait ()
virtual void lock ()
virtual void unlock ()
void dump ()
int max_noutput_items ()
 Get the number of max noutput_items in the flowgraph.
void set_max_noutput_items (int nmax)
 Set the maximum number of noutput_items in the flowgraph.
gr_top_block_sptr to_top_block ()
- Public Member Functions inherited from gr_hier_block2
virtual ~gr_hier_block2 ()
opaque_self self ()
 Return an object, representing the current block, which can be passed to connect.
void connect (gr_basic_block_sptr block)
 Add a stand-alone (possibly hierarchical) block to internal graph.
void connect (gr_basic_block_sptr src, int src_port, gr_basic_block_sptr dst, int dst_port)
 Add gr-blocks or hierarchical blocks to internal graph and wire together.
void disconnect (gr_basic_block_sptr block)
 Remove a gr-block or hierarchical block from the internal flowgraph.
void disconnect (gr_basic_block_sptr src, int src_port, gr_basic_block_sptr dst, int dst_port)
 Disconnect a pair of gr-blocks or hierarchical blocks in internal flowgraph.
void disconnect_all ()
 Disconnect all connections in the internal flowgraph.
gr_flat_flowgraph_sptr flatten () const
gr_hier_block2_sptr to_hier_block2 ()
- Public Member Functions inherited from gr_basic_block
virtual ~gr_basic_block ()
long unique_id () const
std::string name () const
gr_io_signature_sptr input_signature () const
gr_io_signature_sptr output_signature () const
gr_basic_block_sptr to_basic_block ()
virtual bool check_topology (int ninputs, int noutputs)
 Confirm that ninputs and noutputs is an acceptable combination.
template<typename T >
void set_msg_handler (T msg_handler)
 Set the callback that is fired when messages are available.
- Public Member Functions inherited from gr_msg_accepter
 gr_msg_accepter ()
 ~gr_msg_accepter ()
void post (pmt::pmt_t msg)
 send msg to msg_accepter
- Public Member Functions inherited from gruel::msg_accepter
 msg_accepter ()
virtual ~msg_accepter ()

Protected Member Functions

 gr_top_block (const std::string &name)
- Protected Member Functions inherited from gr_hier_block2
 gr_hier_block2 (void)
 gr_hier_block2 (const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature)
- Protected Member Functions inherited from gr_basic_block
 gr_basic_block (void)
 gr_basic_block (const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature)
 Protected constructor prevents instantiation by non-derived classes.
void set_input_signature (gr_io_signature_sptr iosig)
 may only be called during constructor
void set_output_signature (gr_io_signature_sptr iosig)
 may only be called during constructor
void set_color (vcolor color)
 Allow the flowgraph to set for sorting and partitioning.
vcolor color () const

Friends

GR_CORE_API gr_top_block_sptr gr_make_top_block (const std::string &name)

Additional Inherited Members

- Public Types inherited from gr_hier_block2
typedef gr_basic_block_sptr opaque_self
 typedef for object returned from self().

Detailed Description

Top-level hierarchical block representing a flowgraph.


Constructor & Destructor Documentation

gr_top_block::gr_top_block ( const std::string &  name)
protected
gr_top_block::~gr_top_block ( )

Member Function Documentation

void gr_top_block::dump ( )

Displays flattened flowgraph edges and block connectivity

virtual void gr_top_block::lock ( )
virtual

Lock a flowgraph in preparation for reconfiguration. When an equal number of calls to lock() and unlock() have occurred, the flowgraph will be reconfigured.

N.B. lock() and unlock() may not be called from a flowgraph thread (E.g., gr_block::work method) or deadlock will occur when reconfiguration happens.

Reimplemented from gr_hier_block2.

int gr_top_block::max_noutput_items ( )

Get the number of max noutput_items in the flowgraph.

void gr_top_block::run ( int  max_noutput_items = 100000)

The simple interface to running a flowgraph.

Calls start() then wait(). Used to run a flowgraph that will stop on its own, or when another thread will call stop().

Parameters:
max_noutput_itemsthe maximum number of output items allowed for any block in the flowgraph. This passes through to the start function; see that function for more details.
void gr_top_block::set_max_noutput_items ( int  nmax)

Set the maximum number of noutput_items in the flowgraph.

void gr_top_block::start ( int  max_noutput_items = 100000)

Start the contained flowgraph. Creates one or more threads to execute the flow graph. Returns to the caller once the threads are created. Calling start() on a top_block that is already started IS an error.

Parameters:
max_noutput_itemsthe maximum number of output items allowed for any block in the flowgraph; the noutput_items can always be less than this, but this will cap it as a maximum. Use this to adjust the maximum latency a flowgraph can exhibit.
void gr_top_block::stop ( )

Stop the running flowgraph. Notifies each thread created by the scheduler to shutdown, then returns to caller. Calling stop() on a top_block that is already stopped IS NOT an error.

gr_top_block_sptr gr_top_block::to_top_block ( )
virtual void gr_top_block::unlock ( )
virtual

Unlock a flowgraph in preparation for reconfiguration. When an equal number of calls to lock() and unlock() have occurred, the flowgraph will be reconfigured.

N.B. lock() and unlock() may not be called from a flowgraph thread (E.g., gr_block::work method) or deadlock will occur when reconfiguration happens.

Reimplemented from gr_hier_block2.

void gr_top_block::wait ( )

Wait for a flowgraph to complete. Flowgraphs complete when either (1) all blocks indicate that they are done (typically only when using gr.file_source, or gr.head, or (2) after stop() has been called to request shutdown. Calling wait on a top_block that is not running IS NOT an error (wait returns w/o blocking).


Friends And Related Function Documentation

GR_CORE_API gr_top_block_sptr gr_make_top_block ( const std::string &  name)
friend

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