Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 2aa62c5bbb658df1fece777472a7bcf2 > files > 404

barry-devel-docs-0.17-0.3.20100730git.fc14.noarch.rpm

<!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>Barry: Barry::DataQueue Class 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.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceBarry.html">Barry</a>::<a class="el" href="classBarry_1_1DataQueue.html">DataQueue</a>
  </div>
</div>
<div class="contents">
<h1>Barry::DataQueue Class Reference</h1><!-- doxytag: class="Barry::DataQueue" -->
<p>This class provides a thread aware fifo queue for <a class="el" href="classBarry_1_1Data.html">Data</a> objects, providing memory management for all <a class="el" href="classBarry_1_1Data.html">Data</a> object pointers it contains.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="dataqueue_8h_source.html">dataqueue.h</a>&gt;</code></p>
<div class="dynheader">
Collaboration diagram for Barry::DataQueue:</div>
<div class="dynsection">
<div class="center"><img src="classBarry_1_1DataQueue__coll__graph.png" border="0" usemap="#Barry_1_1DataQueue_coll__map" alt="Collaboration graph"/></div>
<map name="Barry_1_1DataQueue_coll__map" id="Barry_1_1DataQueue_coll__map">
<area shape="rect" id="node4" href="classBarry_1_1Data.html" title="Barry::Data" alt="" coords="33,6,124,37"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classBarry_1_1DataQueue-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1DataQueue.html#aea470a11cbda20dd9af1a92148ecb223">push</a> (<a class="el" href="classBarry_1_1Data.html">Data</a> *data)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pushes data into the end of the queue.  <a href="#aea470a11cbda20dd9af1a92148ecb223"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Data.html">Data</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1DataQueue.html#ad1f454f70a9b6ec667e0e22a7ddd6eca">pop</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pops the next element off the front of the queue.  <a href="#ad1f454f70a9b6ec667e0e22a7ddd6eca"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Data.html">Data</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1DataQueue.html#a27d4830d37b0f7a1bee3a63b0f5a5b2b">wait_pop</a> (int timeout=-1)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pops the next element off the front of the queue, and waits until one exists if empty.  <a href="#a27d4830d37b0f7a1bee3a63b0f5a5b2b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1DataQueue.html#a12a7a82124799a6803b28efd89e1dd05">append_from</a> (<a class="el" href="classBarry_1_1DataQueue.html">DataQueue</a> &amp;other)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pops all data from other and appends it to this.  <a href="#a12a7a82124799a6803b28efd89e1dd05"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1DataQueue.html#a76cecba41e423f7d20df464cf7524e76">empty</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true if the queue is empty.  <a href="#a76cecba41e423f7d20df464cf7524e76"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1DataQueue.html#ada0c2fd55a8f221aadbf0b7165043e06">size</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns number of items in the queue.  <a href="#ada0c2fd55a8f221aadbf0b7165043e06"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>This class provides a thread aware fifo queue for <a class="el" href="classBarry_1_1Data.html">Data</a> objects, providing memory management for all <a class="el" href="classBarry_1_1Data.html">Data</a> object pointers it contains. </p>
<p>It uses similar member names as std::queue&lt;&gt;, for consistency. </p>

<p>Definition at line <a class="el" href="dataqueue_8h_source.html#l00040">40</a> of file <a class="el" href="dataqueue_8h_source.html">dataqueue.h</a>.</p>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a12a7a82124799a6803b28efd89e1dd05"></a><!-- doxytag: member="Barry::DataQueue::append_from" ref="a12a7a82124799a6803b28efd89e1dd05" args="(DataQueue &amp;other)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Barry::DataQueue::append_from </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classBarry_1_1DataQueue.html">DataQueue</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>other</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Pops all data from other and appends it to this. </p>
<p>After calling this function, other will be empty, and this will contain all its data.</p>
<p>In the case of an exception, any uncopied data will remain in other.</p>
<p>This is a locking optimization, so all copying can happen inside one lock, instead of locking for each copy. </p>

<p>Definition at line <a class="el" href="dataqueue_8cc_source.html#l00175">175</a> of file <a class="el" href="dataqueue_8cc_source.html">dataqueue.cc</a>.</p>

<p>Referenced by <a class="el" href="router_8cc_source.html#l00218">Barry::SocketRoutingQueue::UnregisterInterest()</a>.</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
<div class="center"><img src="classBarry_1_1DataQueue_a12a7a82124799a6803b28efd89e1dd05_icgraph.png" border="0" usemap="#classBarry_1_1DataQueue_a12a7a82124799a6803b28efd89e1dd05_icgraph_map" alt=""></div>
<map name="classBarry_1_1DataQueue_a12a7a82124799a6803b28efd89e1dd05_icgraph_map" id="classBarry_1_1DataQueue_a12a7a82124799a6803b28efd89e1dd05_icgraph">
<area shape="rect" id="node3" href="classBarry_1_1SocketRoutingQueue.html#aaa0f088f013150bc45ca47fabede9731" title="Unregisters interest in data from the given socket, and discards any existing data..." alt="" coords="272,5,573,35"/></map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a76cecba41e423f7d20df464cf7524e76"></a><!-- doxytag: member="Barry::DataQueue::empty" ref="a76cecba41e423f7d20df464cf7524e76" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Barry::DataQueue::empty </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns true if the queue is empty. </p>

<p>Definition at line <a class="el" href="dataqueue_8cc_source.html#l00194">194</a> of file <a class="el" href="dataqueue_8cc_source.html">dataqueue.cc</a>.</p>

</div>
</div>
<a class="anchor" id="ad1f454f70a9b6ec667e0e22a7ddd6eca"></a><!-- doxytag: member="Barry::DataQueue::pop" ref="ad1f454f70a9b6ec667e0e22a7ddd6eca" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classBarry_1_1Data.html">Data</a> * Barry::DataQueue::pop </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Pops the next element off the front of the queue. </p>
<p>Returns 0 if empty. The queue no longer owns this pointer upon return. </p>

<p>Definition at line <a class="el" href="dataqueue_8cc_source.html#l00085">85</a> of file <a class="el" href="dataqueue_8cc_source.html">dataqueue.cc</a>.</p>

<p>Referenced by <a class="el" href="router_8cc_source.html#l00336">Barry::SocketRoutingQueue::DoRead()</a>.</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
<div class="center"><img src="classBarry_1_1DataQueue_ad1f454f70a9b6ec667e0e22a7ddd6eca_icgraph.png" border="0" usemap="#classBarry_1_1DataQueue_ad1f454f70a9b6ec667e0e22a7ddd6eca_icgraph_map" alt=""></div>
<map name="classBarry_1_1DataQueue_ad1f454f70a9b6ec667e0e22a7ddd6eca_icgraph_map" id="classBarry_1_1DataQueue_ad1f454f70a9b6ec667e0e22a7ddd6eca_icgraph">
<area shape="rect" id="node3" href="classBarry_1_1SocketRoutingQueue.html#aa66c053840c931e3c6f1ed2293bd3736" title="Called by the application&#39;s &quot;read thread&quot; to read the next usb packet..." alt="" coords="216,5,464,35"/><area shape="rect" id="node5" href="classBarry_1_1SocketRoutingQueue.html#a43c1fc957e2da415290e86bc6e66aa25" title="Convenience thread to handle USB read activity." alt="" coords="513,5,828,35"/></map>
</div>
</p>

</div>
</div>
<a class="anchor" id="aea470a11cbda20dd9af1a92148ecb223"></a><!-- doxytag: member="Barry::DataQueue::push" ref="aea470a11cbda20dd9af1a92148ecb223" args="(Data *data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Barry::DataQueue::push </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classBarry_1_1Data.html">Data</a> *&nbsp;</td>
          <td class="paramname"> <em>data</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Pushes data into the end of the queue. </p>
<p>The queue owns this pointer as soon as the function is called. In the case of an exception, it will be freed. Performs a thread broadcast once new data has been added. </p>

<p>Definition at line <a class="el" href="dataqueue_8cc_source.html#l00058">58</a> of file <a class="el" href="dataqueue_8cc_source.html">dataqueue.cc</a>.</p>

<p>Referenced by <a class="el" href="router_8cc_source.html#l00136">Barry::SocketRoutingQueue::AllocateBuffers()</a>, <a class="el" href="router_8cc_source.html#l00336">Barry::SocketRoutingQueue::DoRead()</a>, and <a class="el" href="router_8cc_source.html#l00069">Barry::SocketRoutingQueue::ReturnBuffer()</a>.</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
<div class="center"><img src="classBarry_1_1DataQueue_aea470a11cbda20dd9af1a92148ecb223_icgraph.png" border="0" usemap="#classBarry_1_1DataQueue_aea470a11cbda20dd9af1a92148ecb223_icgraph_map" alt=""></div>
<map name="classBarry_1_1DataQueue_aea470a11cbda20dd9af1a92148ecb223_icgraph_map" id="classBarry_1_1DataQueue_aea470a11cbda20dd9af1a92148ecb223_icgraph">
<area shape="rect" id="node3" href="classBarry_1_1SocketRoutingQueue.html#a6b4f7e9653512bb6ad91d05894248517" title="This class starts out with no buffers, and will grow one buffer at a time if needed..." alt="" coords="223,5,508,35"/><area shape="rect" id="node5" href="classBarry_1_1SocketRoutingQueue.html#aa66c053840c931e3c6f1ed2293bd3736" title="Called by the application&#39;s &quot;read thread&quot; to read the next usb packet..." alt="" coords="241,58,489,89"/><area shape="rect" id="node9" href="classBarry_1_1SocketRoutingQueue.html#aa496dddb546fc96f337cf885dfdf219c" title="Provides a method of returning a buffer to the free queue after processing." alt="" coords="231,111,500,142"/><area shape="rect" id="node7" href="classBarry_1_1SocketRoutingQueue.html#a43c1fc957e2da415290e86bc6e66aa25" title="Convenience thread to handle USB read activity." alt="" coords="559,58,873,89"/></map>
</div>
</p>

</div>
</div>
<a class="anchor" id="ada0c2fd55a8f221aadbf0b7165043e06"></a><!-- doxytag: member="Barry::DataQueue::size" ref="ada0c2fd55a8f221aadbf0b7165043e06" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t Barry::DataQueue::size </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns number of items in the queue. </p>

<p>Definition at line <a class="el" href="dataqueue_8cc_source.html#l00205">205</a> of file <a class="el" href="dataqueue_8cc_source.html">dataqueue.cc</a>.</p>

<p>Referenced by <a class="el" href="router_8cc_source.html#l00136">Barry::SocketRoutingQueue::AllocateBuffers()</a>, and <a class="el" href="dataqueue_8cc_source.html#l00107">wait_pop()</a>.</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
<div class="center"><img src="classBarry_1_1DataQueue_ada0c2fd55a8f221aadbf0b7165043e06_icgraph.png" border="0" usemap="#classBarry_1_1DataQueue_ada0c2fd55a8f221aadbf0b7165043e06_icgraph_map" alt=""></div>
<map name="classBarry_1_1DataQueue_ada0c2fd55a8f221aadbf0b7165043e06_icgraph_map" id="classBarry_1_1DataQueue_ada0c2fd55a8f221aadbf0b7165043e06_icgraph">
<area shape="rect" id="node3" href="classBarry_1_1SocketRoutingQueue.html#a6b4f7e9653512bb6ad91d05894248517" title="This class starts out with no buffers, and will grow one buffer at a time if needed..." alt="" coords="220,5,505,35"/><area shape="rect" id="node5" href="classBarry_1_1DataQueue.html#a27d4830d37b0f7a1bee3a63b0f5a5b2b" title="Pops the next element off the front of the queue, and waits until one exists if empty..." alt="" coords="267,58,459,89"/><area shape="rect" id="node7" href="classBarry_1_1SocketRoutingQueue.html#ae9fac0a9073c44567987230843712e94" title="This version does not perform a copy." alt="" coords="555,31,827,62"/><area shape="rect" id="node9" href="classBarry_1_1SocketRoutingQueue.html#acbe8506c04cb6ff9942766a3ba39cbd4" title="Copying is not performed with this function." alt="" coords="555,85,827,115"/></map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a27d4830d37b0f7a1bee3a63b0f5a5b2b"></a><!-- doxytag: member="Barry::DataQueue::wait_pop" ref="a27d4830d37b0f7a1bee3a63b0f5a5b2b" args="(int timeout=&#45;1)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classBarry_1_1Data.html">Data</a> * Barry::DataQueue::wait_pop </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout</em> = <code>-1</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Pops the next element off the front of the queue, and waits until one exists if empty. </p>
<p>If still no data on timeout, returns null. (unlock the access mutex while waiting!)</p>
<p>Timeout specified in milliseconds. Default is wait forever. </p>

<p>Definition at line <a class="el" href="dataqueue_8cc_source.html#l00107">107</a> of file <a class="el" href="dataqueue_8cc_source.html">dataqueue.cc</a>.</p>

<p>References <a class="el" href="dataqueue_8cc_source.html#l00205">size()</a>, and <a class="el" href="namespaceBarry.html#a0e1dc80f82d25739631c39b545f812bb">Barry::ThreadTimeout()</a>.</p>

<p>Referenced by <a class="el" href="router_8cc_source.html#l00171">Barry::SocketRoutingQueue::DefaultRead()</a>, and <a class="el" href="router_8cc_source.html#l00271">Barry::SocketRoutingQueue::SocketRead()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
<div class="center"><img src="classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_cgraph.png" border="0" usemap="#classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_cgraph_map" alt=""></div>
<map name="classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_cgraph_map" id="classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_cgraph">
<area shape="rect" id="node3" href="classBarry_1_1DataQueue.html#ada0c2fd55a8f221aadbf0b7165043e06" title="Returns number of items in the queue." alt="" coords="247,5,409,35"/><area shape="rect" id="node5" href="namespaceBarry.html#a0e1dc80f82d25739631c39b545f812bb" title="Creates a pthread_cond_timedwait() compatible timespec struct, based on a given timeout..." alt="" coords="249,58,407,89"/></map>
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
<div class="center"><img src="classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_icgraph.png" border="0" usemap="#classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_icgraph_map" alt=""></div>
<map name="classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_icgraph_map" id="classBarry_1_1DataQueue_a27d4830d37b0f7a1bee3a63b0f5a5b2b_icgraph">
<area shape="rect" id="node3" href="classBarry_1_1SocketRoutingQueue.html#ae9fac0a9073c44567987230843712e94" title="This version does not perform a copy." alt="" coords="245,5,517,35"/><area shape="rect" id="node5" href="classBarry_1_1SocketRoutingQueue.html#acbe8506c04cb6ff9942766a3ba39cbd4" title="Copying is not performed with this function." alt="" coords="245,58,517,89"/></map>
</div>
</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="dataqueue_8h_source.html">dataqueue.h</a></li>
<li><a class="el" href="dataqueue_8cc_source.html">dataqueue.cc</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>