Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b293cf61b174f6cb974e48c9096dc9b3 > files > 85

lib64commoncpp-devel-1.8.1-7.mga4.x86_64.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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>GNU CommonC++: ost::Buffer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">GNU CommonC++
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</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="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceost.html">ost</a></li><li class="navelem"><a class="el" href="classost_1_1_buffer.html">Buffer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#related">Related Functions</a> &#124;
<a href="classost_1_1_buffer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ost::Buffer Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>The buffer class represents an IPC service that is built upon a buffer of fixed capacity that can be used to transfer objects between one or more producer and consumer threads.  
 <a href="classost_1_1_buffer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="buffer_8h_source.html">buffer.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ost::Buffer:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classost_1_1_buffer.png" usemap="#ost::Buffer_map" alt=""/>
  <map id="ost::Buffer_map" name="ost::Buffer_map">
<area href="classost_1_1_conditional.html" title="A conditional variable synchcronization object for one to one and one to many signal and control even..." alt="ost::Conditional" shape="rect" coords="0,0,100,24"/>
<area href="classost_1_1_fixed_buffer.html" title="A buffer class that holds a known capacity of fixed sized objects defined during creation. " alt="ost::FixedBuffer" shape="rect" coords="0,112,100,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:afacde25a803bcf18ed0fc2791fca525d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#afacde25a803bcf18ed0fc2791fca525d">Buffer</a> (size_t capacity)</td></tr>
<tr class="memdesc:afacde25a803bcf18ed0fc2791fca525d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a buffer object of known capacity.  <a href="#afacde25a803bcf18ed0fc2791fca525d">More...</a><br/></td></tr>
<tr class="separator:afacde25a803bcf18ed0fc2791fca525d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef3a7f472cebcdeca059e2618bf1879c"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#aef3a7f472cebcdeca059e2618bf1879c">~Buffer</a> ()</td></tr>
<tr class="memdesc:aef3a7f472cebcdeca059e2618bf1879c"><td class="mdescLeft">&#160;</td><td class="mdescRight">In derived functions, may be used to free the actual memory used to hold buffered data.  <a href="#aef3a7f472cebcdeca059e2618bf1879c">More...</a><br/></td></tr>
<tr class="separator:aef3a7f472cebcdeca059e2618bf1879c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aedd8b294e02c08a60bde023bd2c1ff47"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#aedd8b294e02c08a60bde023bd2c1ff47">getSize</a> (void)</td></tr>
<tr class="memdesc:aedd8b294e02c08a60bde023bd2c1ff47"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the capacity of the buffer as specified at creation.  <a href="#aedd8b294e02c08a60bde023bd2c1ff47">More...</a><br/></td></tr>
<tr class="separator:aedd8b294e02c08a60bde023bd2c1ff47"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a462525b42df6660894ccf8141d73071e"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a462525b42df6660894ccf8141d73071e">getUsed</a> (void)</td></tr>
<tr class="memdesc:a462525b42df6660894ccf8141d73071e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current capacity in use for the buffer.  <a href="#a462525b42df6660894ccf8141d73071e">More...</a><br/></td></tr>
<tr class="separator:a462525b42df6660894ccf8141d73071e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f67183f492fe6600456d919ed811fac"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a5f67183f492fe6600456d919ed811fac">wait</a> (void *buf, <a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> <a class="el" href="classost_1_1_buffer.html#ae416c78e4d5dc50bfa3c4e0b98fd7a98">timeout</a>=0)</td></tr>
<tr class="memdesc:a5f67183f492fe6600456d919ed811fac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Let one or more threads wait for an object to become available in the buffer.  <a href="#a5f67183f492fe6600456d919ed811fac">More...</a><br/></td></tr>
<tr class="separator:a5f67183f492fe6600456d919ed811fac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d106bd44d9bee8d9ef049cfa264e5b7"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a9d106bd44d9bee8d9ef049cfa264e5b7">post</a> (void *buf, <a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> <a class="el" href="classost_1_1_buffer.html#ae416c78e4d5dc50bfa3c4e0b98fd7a98">timeout</a>=0)</td></tr>
<tr class="memdesc:a9d106bd44d9bee8d9ef049cfa264e5b7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Post an object into the buffer and enable a waiting thread to receive it.  <a href="#a9d106bd44d9bee8d9ef049cfa264e5b7">More...</a><br/></td></tr>
<tr class="separator:a9d106bd44d9bee8d9ef049cfa264e5b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae613b6a13146b782ce5749b810cceba8"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#ae613b6a13146b782ce5749b810cceba8">peek</a> (void *buf)</td></tr>
<tr class="memdesc:ae613b6a13146b782ce5749b810cceba8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Peek at the current content (first object) in the buffer.  <a href="#ae613b6a13146b782ce5749b810cceba8">More...</a><br/></td></tr>
<tr class="separator:ae613b6a13146b782ce5749b810cceba8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a255237cf9eebf6010546e884933ff8ba"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a255237cf9eebf6010546e884933ff8ba">isValid</a> (void)</td></tr>
<tr class="memdesc:a255237cf9eebf6010546e884933ff8ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">New virtual to test if buffer is a valid object.  <a href="#a255237cf9eebf6010546e884933ff8ba">More...</a><br/></td></tr>
<tr class="separator:a255237cf9eebf6010546e884933ff8ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classost_1_1_conditional"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classost_1_1_conditional')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classost_1_1_conditional.html">ost::Conditional</a></td></tr>
<tr class="memitem:a7d7009cab2b814c82b41d8682a6ebff0 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a7d7009cab2b814c82b41d8682a6ebff0">Conditional</a> (const char *id=NULL)</td></tr>
<tr class="memdesc:a7d7009cab2b814c82b41d8682a6ebff0 inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create an instance of a conditional.  <a href="#a7d7009cab2b814c82b41d8682a6ebff0">More...</a><br/></td></tr>
<tr class="separator:a7d7009cab2b814c82b41d8682a6ebff0 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9772a4c8e522a010a37c63c5ee078384 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a9772a4c8e522a010a37c63c5ee078384">~Conditional</a> ()</td></tr>
<tr class="memdesc:a9772a4c8e522a010a37c63c5ee078384 inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy the conditional.  <a href="#a9772a4c8e522a010a37c63c5ee078384">More...</a><br/></td></tr>
<tr class="separator:a9772a4c8e522a010a37c63c5ee078384 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80822e8493bafb68bac637bbf5fe772d inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a80822e8493bafb68bac637bbf5fe772d">signal</a> (bool broadcast)</td></tr>
<tr class="memdesc:a80822e8493bafb68bac637bbf5fe772d inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">Signal a conditional object and a waiting threads.  <a href="#a80822e8493bafb68bac637bbf5fe772d">More...</a><br/></td></tr>
<tr class="separator:a80822e8493bafb68bac637bbf5fe772d inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2cac07a385596391b0fc8c15b8a598e5 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a2cac07a385596391b0fc8c15b8a598e5">wait</a> (<a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timer=0, bool locked=false)</td></tr>
<tr class="memdesc:a2cac07a385596391b0fc8c15b8a598e5 inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait to be signaled from another thread.  <a href="#a2cac07a385596391b0fc8c15b8a598e5">More...</a><br/></td></tr>
<tr class="separator:a2cac07a385596391b0fc8c15b8a598e5 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3fd225eeae79c24eb7f521f285e8289 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#ae3fd225eeae79c24eb7f521f285e8289">enterMutex</a> (void)</td></tr>
<tr class="memdesc:ae3fd225eeae79c24eb7f521f285e8289 inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">Locks the conditional's mutex for this thread.  <a href="#ae3fd225eeae79c24eb7f521f285e8289">More...</a><br/></td></tr>
<tr class="separator:ae3fd225eeae79c24eb7f521f285e8289 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2a3bf89c582dad8ba7e81370fd361668 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a2a3bf89c582dad8ba7e81370fd361668">lock</a> (void)</td></tr>
<tr class="memdesc:a2a3bf89c582dad8ba7e81370fd361668 inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">In the future we will use lock in place of enterMutex since the conditional composite is not a recursive mutex, and hence using enterMutex may cause confusion in expectation with the behavior of the <a class="el" href="classost_1_1_mutex.html" title="The Mutex class is used to protect a section of code so that at any given time only a single thread c...">Mutex</a> class.  <a href="#a2a3bf89c582dad8ba7e81370fd361668">More...</a><br/></td></tr>
<tr class="separator:a2a3bf89c582dad8ba7e81370fd361668 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adcd3f704ef27fff5501a42185a09471f inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#adcd3f704ef27fff5501a42185a09471f">tryEnterMutex</a> (void)</td></tr>
<tr class="memdesc:adcd3f704ef27fff5501a42185a09471f inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tries to lock the conditional for the current thread.  <a href="#adcd3f704ef27fff5501a42185a09471f">More...</a><br/></td></tr>
<tr class="separator:adcd3f704ef27fff5501a42185a09471f inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a507839fac82a32f946fa5f87d41bef28 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a507839fac82a32f946fa5f87d41bef28">test</a> (void)</td></tr>
<tr class="separator:a507839fac82a32f946fa5f87d41bef28 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc29112f68c34a9844b3c3dad0d03603 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#acc29112f68c34a9844b3c3dad0d03603">leaveMutex</a> (void)</td></tr>
<tr class="memdesc:acc29112f68c34a9844b3c3dad0d03603 inherit pub_methods_classost_1_1_conditional"><td class="mdescLeft">&#160;</td><td class="mdescRight">Leaving a mutex frees that mutex for use by another thread.  <a href="#acc29112f68c34a9844b3c3dad0d03603">More...</a><br/></td></tr>
<tr class="separator:acc29112f68c34a9844b3c3dad0d03603 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b6126bbb6e58c1b8ef937bebf4af222 inherit pub_methods_classost_1_1_conditional"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a8b6126bbb6e58c1b8ef937bebf4af222">unlock</a> (void)</td></tr>
<tr class="separator:a8b6126bbb6e58c1b8ef937bebf4af222 inherit pub_methods_classost_1_1_conditional"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:ae416c78e4d5dc50bfa3c4e0b98fd7a98"><td class="memItemLeft" align="right" valign="top">static const size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#ae416c78e4d5dc50bfa3c4e0b98fd7a98">timeout</a></td></tr>
<tr class="memdesc:ae416c78e4d5dc50bfa3c4e0b98fd7a98"><td class="mdescLeft">&#160;</td><td class="mdescRight">value to return when a timed operation returned with a timeout.  <a href="#ae416c78e4d5dc50bfa3c4e0b98fd7a98">More...</a><br/></td></tr>
<tr class="separator:ae416c78e4d5dc50bfa3c4e0b98fd7a98"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a5879caf00bd75cd972d84b822cb77ef0"><td class="memItemLeft" align="right" valign="top">virtual size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a5879caf00bd75cd972d84b822cb77ef0">onPeek</a> (void *buf)=0</td></tr>
<tr class="memdesc:a5879caf00bd75cd972d84b822cb77ef0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Invoke derived class buffer peeking method.  <a href="#a5879caf00bd75cd972d84b822cb77ef0">More...</a><br/></td></tr>
<tr class="separator:a5879caf00bd75cd972d84b822cb77ef0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9662e8def92667057121de0847dcabf0"><td class="memItemLeft" align="right" valign="top">virtual size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a9662e8def92667057121de0847dcabf0">onWait</a> (void *buf)=0</td></tr>
<tr class="memdesc:a9662e8def92667057121de0847dcabf0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Invoke derived class object request from buffer.  <a href="#a9662e8def92667057121de0847dcabf0">More...</a><br/></td></tr>
<tr class="separator:a9662e8def92667057121de0847dcabf0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ee3158e74f0e50e91f14bf370feb1fa"><td class="memItemLeft" align="right" valign="top">virtual size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a7ee3158e74f0e50e91f14bf370feb1fa">onPost</a> (void *buf)=0</td></tr>
<tr class="memdesc:a7ee3158e74f0e50e91f14bf370feb1fa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Invoke derived class posting of object to buffer.  <a href="#a7ee3158e74f0e50e91f14bf370feb1fa">More...</a><br/></td></tr>
<tr class="separator:a7ee3158e74f0e50e91f14bf370feb1fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
Related Functions</h2></td></tr>
<tr><td class="ititle" colspan="2"><p>(Note that these are not member functions.) </p>
</td></tr>
<tr class="memitem:abe2397b9087bd1651ee67ed5702c01dd"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#abe2397b9087bd1651ee67ed5702c01dd">get</a> (<a class="el" href="classost_1_1_buffer.html">Buffer</a> &amp;b, void *o, <a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> t=0)</td></tr>
<tr class="separator:abe2397b9087bd1651ee67ed5702c01dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1dc4ad52b6f17817e4afa981d1db6fae"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a1dc4ad52b6f17817e4afa981d1db6fae">put</a> (<a class="el" href="classost_1_1_buffer.html">Buffer</a> &amp;b, void *o, <a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> t=0)</td></tr>
<tr class="separator:a1dc4ad52b6f17817e4afa981d1db6fae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2066fdf67ab3b6727be90a51fc5c4d64"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_buffer.html#a2066fdf67ab3b6727be90a51fc5c4d64">peek</a> (<a class="el" href="classost_1_1_buffer.html">Buffer</a> &amp;b, void *o)</td></tr>
<tr class="separator:a2066fdf67ab3b6727be90a51fc5c4d64"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The buffer class represents an IPC service that is built upon a buffer of fixed capacity that can be used to transfer objects between one or more producer and consumer threads. </p>
<p>Producer threads post objects into the buffer, and consumer threads wait for and receive objects from the buffer. Semaphores are used to to block the buffer from overflowing and indicate when there is data available, and mutexes are used to protect multiple consumers and producer threads from stepping over each other.</p>
<p>The buffer class is an abstract class in that the actual data being buffered is not directly specified within the buffer class itself. The buffer class should be used as a base class for a class that actually impliments buffering and which may be aware of the data types actually are being buffered. A template class could be created based on buffer for this purpose. Another possibility is to create a class derived from both <a class="el" href="classost_1_1_thread.html" title="Every thread of execution in an application is created by instantiating an object of a class derived ...">Thread</a> and <a class="el" href="classost_1_1_buffer.html" title="The buffer class represents an IPC service that is built upon a buffer of fixed capacity that can be ...">Buffer</a> which can be used to implement message passing threads.</p>
<dl class="section author"><dt>Author</dt><dd>David Sugar <a href="#" onclick="location.href='mai'+'lto:'+'dyf'+'et'+'@os'+'te'+'l.c'+'om'; return false;">dyfet<span style="display: none;">.nosp@m.</span>@ost<span style="display: none;">.nosp@m.</span>el.co<span style="display: none;">.nosp@m.</span>m</a> Producer/Consumer buffer for use between threads. </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="afacde25a803bcf18ed0fc2791fca525d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ost::Buffer::Buffer </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>capacity</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a buffer object of known capacity. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">capacity</td><td>is the integer capacity of the buffer. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aef3a7f472cebcdeca059e2618bf1879c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual ost::Buffer::~Buffer </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>In derived functions, may be used to free the actual memory used to hold buffered data. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aedd8b294e02c08a60bde023bd2c1ff47"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t ost::Buffer::getSize </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the capacity of the buffer as specified at creation. </p>
<dl class="section return"><dt>Returns</dt><dd>size of buffer. </dd></dl>

</div>
</div>
<a class="anchor" id="a462525b42df6660894ccf8141d73071e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t ost::Buffer::getUsed </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the current capacity in use for the buffer. </p>
<p>Free space is technically <a class="el" href="classost_1_1_buffer.html#aedd8b294e02c08a60bde023bd2c1ff47" title="Return the capacity of the buffer as specified at creation. ">getSize()</a> - <a class="el" href="classost_1_1_buffer.html#a462525b42df6660894ccf8141d73071e" title="Return the current capacity in use for the buffer. ">getUsed()</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>integer used capacity of the buffer. </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classost_1_1_buffer.html#aedd8b294e02c08a60bde023bd2c1ff47" title="Return the capacity of the buffer as specified at creation. ">getSize</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a255237cf9eebf6010546e884933ff8ba"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ost::Buffer::isValid </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>New virtual to test if buffer is a valid object. </p>
<dl class="section return"><dt>Returns</dt><dd>true if object is valid. </dd></dl>

<p>Reimplemented in <a class="el" href="classost_1_1_fixed_buffer.html#a0a374a1a50ae78ce64db9e4ab25991d2">ost::FixedBuffer</a>.</p>

</div>
</div>
<a class="anchor" id="a5879caf00bd75cd972d84b822cb77ef0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual size_t ost::Buffer::onPeek </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Invoke derived class buffer peeking method. </p>
<dl class="section return"><dt>Returns</dt><dd>size of object found. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to copy contents of head of buffer to. </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="classost_1_1_fixed_buffer.html#ae0a0b8dcb25e97313de5b998e1f22bfd">ost::FixedBuffer</a>.</p>

</div>
</div>
<a class="anchor" id="a7ee3158e74f0e50e91f14bf370feb1fa"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual size_t ost::Buffer::onPost </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Invoke derived class posting of object to buffer. </p>
<dl class="section return"><dt>Returns</dt><dd>size of object posted. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to object being posted to the buffer. </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="classost_1_1_fixed_buffer.html#a5d39b3282dd4a18d79456f7f16962b35">ost::FixedBuffer</a>.</p>

</div>
</div>
<a class="anchor" id="a9662e8def92667057121de0847dcabf0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual size_t ost::Buffer::onWait </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Invoke derived class object request from buffer. </p>
<dl class="section return"><dt>Returns</dt><dd>size of object returned. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to hold object returned from the buffer. </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="classost_1_1_fixed_buffer.html#a8364661c1b2d2114d87be12479b04a47">ost::FixedBuffer</a>.</p>

</div>
</div>
<a class="anchor" id="ae613b6a13146b782ce5749b810cceba8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ost::Buffer::peek </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Peek at the current content (first object) in the buffer. </p>
<dl class="section return"><dt>Returns</dt><dd>size of object in the buffer. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to store object found in the buffer. </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="classost_1_1_buffer.html#a2066fdf67ab3b6727be90a51fc5c4d64">peek()</a>.</p>

</div>
</div>
<a class="anchor" id="a9d106bd44d9bee8d9ef049cfa264e5b7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ost::Buffer::post </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&#160;</td>
          <td class="paramname"><em>timeout</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Post an object into the buffer and enable a waiting thread to receive it. </p>
<dl class="section return"><dt>Returns</dt><dd>size of object posted in bytes. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to object to store in the buffer. </td></tr>
    <tr><td class="paramname">timeout</td><td>time to wait. </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="classost_1_1_buffer.html#a1dc4ad52b6f17817e4afa981d1db6fae">put()</a>.</p>

</div>
</div>
<a class="anchor" id="a5f67183f492fe6600456d919ed811fac"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ost::Buffer::wait </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&#160;</td>
          <td class="paramname"><em>timeout</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Let one or more threads wait for an object to become available in the buffer. </p>
<p>The waiting thread(s) will wait forever if no object is ever placed into the buffer.</p>
<dl class="section return"><dt>Returns</dt><dd>size of object passed by buffer in bytes. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to store object retrieved from the buffer. </td></tr>
    <tr><td class="paramname">timeout</td><td>time to wait. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Friends And Related Function Documentation</h2>
<a class="anchor" id="abe2397b9087bd1651ee67ed5702c01dd"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t get </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classost_1_1_buffer.html">Buffer</a> &amp;&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>o</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&#160;</td>
          <td class="paramname"><em>t</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a2066fdf67ab3b6727be90a51fc5c4d64"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t peek </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classost_1_1_buffer.html">Buffer</a> &amp;&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>o</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="_sample_socket_port_8cpp-example.html#a4">SampleSocketPort.cpp</a>.</dd>
</dl>
<p>References <a class="el" href="classost_1_1_buffer.html#ae613b6a13146b782ce5749b810cceba8">peek()</a>.</p>

</div>
</div>
<a class="anchor" id="a1dc4ad52b6f17817e4afa981d1db6fae"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t put </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classost_1_1_buffer.html">Buffer</a> &amp;&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>o</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&#160;</td>
          <td class="paramname"><em>t</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>References <a class="el" href="classost_1_1_buffer.html#a9d106bd44d9bee8d9ef049cfa264e5b7">post()</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="ae416c78e4d5dc50bfa3c4e0b98fd7a98"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const size_t ost::Buffer::timeout</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>value to return when a timed operation returned with a timeout. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="buffer_8h_source.html">buffer.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 17 2013 23:24:57 for GNU CommonC++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>