<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>GNU Radio 3.3.0 C++ API: gr_buffer.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="contents"> <h1>gr_buffer.h File Reference</h1><code>#include <<a class="el" href="gr__runtime__types_8h_source.html">gr_runtime_types.h</a>></code><br/> <code>#include <boost/weak_ptr.hpp></code><br/> <code>#include <<a class="el" href="thread_8h_source.html">gruel/thread.h</a>></code><br/> <div class="dynheader"> Include dependency graph for gr_buffer.h:</div> <div class="dynsection"> <div class="center"><img src="gr__buffer_8h__incl.png" border="0" usemap="#gr__buffer_8h_map" alt=""/></div> <map name="gr__buffer_8h_map" id="gr__buffer_8h"> <area shape="rect" id="node3" href="gr__runtime__types_8h.html" title="gr_runtime_types.h" alt="" coords="180,83,313,112"/><area shape="rect" id="node19" href="thread_8h.html" title="gruel/thread.h" alt="" coords="497,83,599,112"/><area shape="rect" id="node5" href="gr__types_8h.html" title="gr_types.h" alt="" coords="205,160,288,189"/><area shape="rect" id="node13" href="gr__complex_8h.html" title="gr_complex.h" alt="" coords="349,237,448,267"/></map> </div> <div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dynsection"> <div class="center"><img src="gr__buffer_8h__dep__incl.png" border="0" usemap="#gr__buffer_8hdep_map" alt=""/></div> <map name="gr__buffer_8hdep_map" id="gr__buffer_8hdep"> <area shape="rect" id="node3" href="audio__portaudio__sink_8h.html" title="audio_portaudio_sink.h" alt="" coords="5,83,160,112"/><area shape="rect" id="node5" href="audio__portaudio__source_8h.html" title="audio_portaudio_source.h" alt="" coords="184,83,355,112"/></map> </div> <p><a href="gr__buffer_8h_source.html">Go to the source code of this file.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__buffer.html">gr_buffer</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Single writer, multiple reader fifo. <a href="classgr__buffer.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__buffer__reader.html">gr_buffer_reader</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">How we keep track of the readers of a <a class="el" href="classgr__buffer.html" title="Single writer, multiple reader fifo.">gr_buffer</a>. <a href="classgr__buffer__reader.html#_details">More...</a><br/></td></tr> <tr><td colspan="2"><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classboost_1_1shared__ptr.html">gr_buffer_sptr</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="gr__buffer_8h.html#aebc8f592465e520011dc5eb872b1a5e7">gr_make_buffer</a> (int nitems, size_t sizeof_item, <a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a> link=<a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a>())</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a buffer that holds at least <code>nitems</code> of size <code>sizeof_item</code>. <a href="#aebc8f592465e520011dc5eb872b1a5e7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classboost_1_1shared__ptr.html">gr_buffer_reader_sptr</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="gr__buffer_8h.html#aa5e3f8c5b81a3b5395efb545e5b56613">gr_buffer_add_reader</a> (<a class="el" href="classboost_1_1shared__ptr.html">gr_buffer_sptr</a> buf, int nzero_preload, <a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a> link=<a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a>())</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create a new <a class="el" href="classgr__buffer__reader.html" title="How we keep track of the readers of a gr_buffer.">gr_buffer_reader</a> and attach it to buffer <code>buf</code>. <a href="#aa5e3f8c5b81a3b5395efb545e5b56613"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="gr__buffer_8h.html#aa863a94ed8f87b2603df59e7b0eeed37">gr_buffer_ncurrently_allocated</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns # of gr_buffers currently allocated <a href="#aa863a94ed8f87b2603df59e7b0eeed37"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="gr__buffer_8h.html#a229e8245902aa53c7fe9644c2fc6f3a9">gr_buffer_reader_ncurrently_allocated</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns # of gr_buffer_readers currently allocated <a href="#a229e8245902aa53c7fe9644c2fc6f3a9"></a><br/></td></tr> </table> <hr/><h2>Function Documentation</h2> <a class="anchor" id="aa5e3f8c5b81a3b5395efb545e5b56613"></a><!-- doxytag: member="gr_buffer.h::gr_buffer_add_reader" ref="aa5e3f8c5b81a3b5395efb545e5b56613" args="(gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link=gr_block_sptr())" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classboost_1_1shared__ptr.html">gr_buffer_reader_sptr</a> gr_buffer_add_reader </td> <td>(</td> <td class="paramtype"><a class="el" href="classboost_1_1shared__ptr.html">gr_buffer_sptr</a> </td> <td class="paramname"> <em>buf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>nzero_preload</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a> </td> <td class="paramname"> <em>link</em> = <code><a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a>()</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Create a new <a class="el" href="classgr__buffer__reader.html" title="How we keep track of the readers of a gr_buffer.">gr_buffer_reader</a> and attach it to buffer <code>buf</code>. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>buf</em> </td><td>is the buffer the <code><a class="el" href="classgr__buffer__reader.html" title="How we keep track of the readers of a gr_buffer.">gr_buffer_reader</a></code> reads from. </td></tr> <tr><td valign="top"></td><td valign="top"><em>nzero_preload</em> </td><td>-- number of zero items to "preload" into buffer. </td></tr> <tr><td valign="top"></td><td valign="top"><em>link</em> </td><td>is the block that reads from the buffer using this <a class="el" href="classgr__buffer__reader.html" title="How we keep track of the readers of a gr_buffer.">gr_buffer_reader</a>. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="aa863a94ed8f87b2603df59e7b0eeed37"></a><!-- doxytag: member="gr_buffer.h::gr_buffer_ncurrently_allocated" ref="aa863a94ed8f87b2603df59e7b0eeed37" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">long gr_buffer_ncurrently_allocated </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>returns # of gr_buffers currently allocated </p> </div> </div> <a class="anchor" id="a229e8245902aa53c7fe9644c2fc6f3a9"></a><!-- doxytag: member="gr_buffer.h::gr_buffer_reader_ncurrently_allocated" ref="a229e8245902aa53c7fe9644c2fc6f3a9" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">long gr_buffer_reader_ncurrently_allocated </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>returns # of gr_buffer_readers currently allocated </p> </div> </div> <a class="anchor" id="aebc8f592465e520011dc5eb872b1a5e7"></a><!-- doxytag: member="gr_buffer.h::gr_make_buffer" ref="aebc8f592465e520011dc5eb872b1a5e7" args="(int nitems, size_t sizeof_item, gr_block_sptr link=gr_block_sptr())" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classboost_1_1shared__ptr.html">gr_buffer_sptr</a> gr_make_buffer </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>nitems</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>sizeof_item</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a> </td> <td class="paramname"> <em>link</em> = <code><a class="el" href="classboost_1_1shared__ptr.html">gr_block_sptr</a>()</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Allocate a buffer that holds at least <code>nitems</code> of size <code>sizeof_item</code>. </p> <p>The total size of the buffer will be rounded up to a system dependent boundary. This is typically the system page size, but under MS windows is 64KB.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>nitems</em> </td><td>is the minimum number of items the buffer will hold. </td></tr> <tr><td valign="top"></td><td valign="top"><em>sizeof_item</em> </td><td>is the size of an item in bytes. </td></tr> <tr><td valign="top"></td><td valign="top"><em>link</em> </td><td>is the block that writes to this buffer. </td></tr> </table> </dd> </dl> </div> </div> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Dec 29 19:51:20 2010 for GNU Radio 3.3.0 C++ API by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>