Changeset 7806
- Timestamp:
- 02/24/08 11:17:17
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/runtime/gr_hier_block2.h
r7517 r7806 61 61 virtual ~gr_hier_block2(); 62 62 63 /*! 64 * \brief Add a stand-alone (possibly hierarchical) block to internal graph 65 * 66 * This adds a gr-block or hierarchical block to the internal graph 67 * without wiring it to anything else. 68 */ 63 69 void connect(gr_basic_block_sptr block); 64 70 71 /*! 72 * \brief Add gr-blocks or hierarchical blocks to internal graph and wire together 73 * 74 * This adds (if not done earlier by another connect) a pair of gr-blocks or 75 * hierarchical blocks to the internal flowgraph, and wires the specified output 76 * port to the specified input port. 77 */ 65 78 void connect(gr_basic_block_sptr src, int src_port, 66 79 gr_basic_block_sptr dst, int dst_port); 67 80 81 /*! 82 * \brief Remove a gr-block or hierarchical block from the internal flowgraph. 83 * 84 * This removes a gr-block or hierarchical block from the internal flowgraph, 85 * disconnecting it from other blocks as needed. 86 * 87 */ 68 88 void disconnect(gr_basic_block_sptr block); 69 89 90 /*! 91 * \brief Disconnect a pair of gr-blocks or hierarchical blocks in internal 92 * flowgraph. 93 * 94 * This disconnects the specified input port from the specified output port 95 * of a pair of gr-blocks or hierarchical blocks. 96 */ 70 97 void disconnect(gr_basic_block_sptr src, int src_port, 71 98 gr_basic_block_sptr dst, int dst_port); 72 99 100 /*! 101 * \brief Disconnect all connections in the internal flowgraph. 102 * 103 * This call removes all output port to input port connections in the internal 104 * flowgraph. 105 */ 73 106 void disconnect_all(); 107 108 /*! 109 * Lock a flowgraph in preparation for reconfiguration. When an equal 110 * number of calls to lock() and unlock() have occurred, the flowgraph 111 * will be restarted automatically. 112 * 113 * N.B. lock() and unlock() cannot be called from a flowgraph thread 114 * (E.g., gr_block::work method) or deadlock will occur when 115 * reconfiguration happens. 116 */ 74 117 virtual void lock(); 118 119 /*! 120 * Unlock a flowgraph in preparation for reconfiguration. When an equal 121 * number of calls to lock() and unlock() have occurred, the flowgraph 122 * will be restarted automatically. 123 * 124 * N.B. lock() and unlock() cannot be called from a flowgraph thread 125 * (E.g., gr_block::work method) or deadlock will occur when 126 * reconfiguration happens. 127 */ 75 128 virtual void unlock(); 76 129 130 // This is a public method for ease of code organization, but should be 131 // ignored by the user. 77 132 gr_flat_flowgraph_sptr flatten() const; 78 133 }; gnuradio/branches/releases/3.1/gnuradio-core/src/lib/runtime/gr_top_block.h
r7517 r7806 90 90 91 91 /*! 92 * Lock a flowgraph in preparation for reconfiguration. When an equal92 * Unlock a flowgraph in preparation for reconfiguration. When an equal 93 93 * number of calls to lock() and unlock() have occurred, the flowgraph 94 94 * will be restarted automatically. gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
r6466 r7806 31 31 # 32 32 class hier_block2(object): 33 """ 34 Python wrapper around the C++ hierarchical block implementation. 35 Provides convenience functions and allows proper Python subclassing. 36 """ 37 33 38 def __init__(self, name, input_signature, output_signature): 39 """ 40 Create a hierarchical block with a given name and I/O signatures. 41 """ 34 42 self._hb = hier_block2_swig(name, input_signature, output_signature) 35 43 36 44 def __getattr__(self, name): 45 """ 46 Pass-through member requests to the C++ object. 47 """ 37 48 return getattr(self._hb, name) 38 49 39 50 def connect(self, *points): 40 '''connect requires one or more arguments that can be coerced to endpoints. 41 If more than two arguments are provided, they are connected together successively. 42 ''' 51 """ 52 Connect two or more block endpoints. An endpoint is either a (block, port) 53 tuple, or just a block type. In the latter case, the port number is assumed 54 to be zero. 55 56 To connect the hierarchical block external inputs or outputs to internal block 57 inputs or outputs, use 'self' in the connect call. 58 59 If multiple arguments are provided, connect will attempt to wire them in series, 60 interpreting the endpoints as inputs or outputs as appropriate. 61 """ 62 43 63 if len (points) < 1: 44 64 raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),)) … … 66 86 67 87 def disconnect(self, *points): 68 '''connect requires one or more arguments that can be coerced to endpoints. 88 """ 89 Disconnect two endpoints in the flowgraph. 90 91 To disconnect the hierarchical block external inputs or outputs to internal block 92 inputs or outputs, use 'self' in the connect call. 93 69 94 If more than two arguments are provided, they are disconnected successively. 70 ''' 95 """ 96 71 97 if len (points) < 1: 72 98 raise ValueError, ("disconnect requires at least two endpoints; %d provided." % (len (points),))
