Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > 4f5f2dc0f55b453456458df885792b0b > files > 477

ucommon-doc-5.0.4-1mdv2010.2.i586.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>ucommon: ucommon/buffer.h Source File</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="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>ucommon/buffer.h</h1><a href="a00180.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2006-2010 David Sugar, Tycho Softworks.</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// This file is part of GNU uCommon C++.</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// GNU uCommon C++ is free software: you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment">// it under the terms of the GNU Lesser General Public License as published</span>
<a name="l00007"></a>00007 <span class="comment">// by the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// GNU uCommon C++ is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00013"></a>00013 <span class="comment">// GNU Lesser General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU Lesser General Public License</span>
<a name="l00016"></a>00016 <span class="comment">// along with GNU uCommon C++.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00017"></a>00017 
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef _UCOMMON_BUFFER_H_</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define _UCOMMON_BUFFER_H_</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#ifndef _UCOMMON_CONFIG_H_</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00194.html" title="Various miscellaneous platform specific headers and defines.">ucommon/platform.h</a>&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#endif</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00030"></a>00030 <span class="preprocessor">#ifndef _UCOMMON_PROTOCOLS_H_</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00195.html" title="Abstract interfaces and support.">ucommon/protocols.h</a>&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#endif</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#ifndef _UCOMMON_SOCKET_H_</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00198.html" title="Common socket class and address manipulation.">ucommon/socket.h</a>&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#endif</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="preprocessor">#ifndef _UCOMMON_STRING_H_</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00201.html" title="A common string class and character string support functions.">ucommon/string.h</a>&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span>
<a name="l00042"></a>00042 <span class="preprocessor">#ifndef _UCOMMON_FSYS_H_</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00185.html" title="Thread-aware file system manipulation class.">ucommon/fsys.h</a>&gt;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#endif</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046 NAMESPACE_UCOMMON
<a name="l00047"></a>00047 
<a name="l00054"></a><a class="code" href="a00050.html">00054</a> <span class="keyword">class </span><a class="code" href="a00050.html" title="A generic file streaming class built from the buffer protocol.">fbuf</a> : <span class="keyword">public</span> <a class="code" href="a00028.html" title="Common buffer protocol class.">BufferProtocol</a>, <span class="keyword">private</span> <a class="code" href="a00052.html" title="A container for generic and o/s portable threadsafe file system functions.">fsys</a>
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056 <span class="keyword">private</span>:
<a name="l00057"></a>00057     offset_t    inpos, outpos;
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 <span class="keyword">protected</span>:
<a name="l00060"></a>00060     <span class="keywordtype">size_t</span> _push(<span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keywordtype">size_t</span> size);
<a name="l00061"></a>00061     <span class="keywordtype">size_t</span> _pull(<span class="keywordtype">char</span> *address, <span class="keywordtype">size_t</span> size);
<a name="l00062"></a>00062     <span class="keywordtype">int</span> _err(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00063"></a>00063     <span class="keywordtype">void</span> _clear(<span class="keywordtype">void</span>);
<a name="l00064"></a>00064 
<a name="l00065"></a>00065     <span class="keyword">inline</span> fd_t getfile(<span class="keywordtype">void</span>)
<a name="l00066"></a>00066         {<span class="keywordflow">return</span> fd;};
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="keyword">public</span>:
<a name="l00072"></a>00072     <a class="code" href="a00050.html" title="A generic file streaming class built from the buffer protocol.">fbuf</a>();
<a name="l00073"></a>00073 
<a name="l00077"></a>00077     ~<a class="code" href="a00050.html" title="A generic file streaming class built from the buffer protocol.">fbuf</a>();
<a name="l00078"></a>00078 
<a name="l00086"></a>00086     <a class="code" href="a00050.html" title="A generic file streaming class built from the buffer protocol.">fbuf</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *path, <a class="code" href="a00052.html#a8077a56ced2b26f2bcefa74dbacb4e90" title="Enumerated file access modes.">fsys::access_t</a> <a class="code" href="a00208.html#a5422fe5f7269f2606c8317e29e4147bf" title="Convenience function to access (lock) shared object through it&amp;#39;s protocol.">access</a>, <span class="keywordtype">unsigned</span> permissions, <span class="keywordtype">size_t</span> size);
<a name="l00087"></a>00087 
<a name="l00094"></a>00094     <a class="code" href="a00050.html" title="A generic file streaming class built from the buffer protocol.">fbuf</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *path, <a class="code" href="a00052.html#a8077a56ced2b26f2bcefa74dbacb4e90" title="Enumerated file access modes.">fsys::access_t</a> access, <span class="keywordtype">size_t</span> size);
<a name="l00095"></a>00095 
<a name="l00104"></a>00104     <span class="keywordtype">void</span> create(<span class="keyword">const</span> <span class="keywordtype">char</span> *path, <a class="code" href="a00052.html#a8077a56ced2b26f2bcefa74dbacb4e90" title="Enumerated file access modes.">fsys::access_t</a> access = fsys::ACCESS_APPEND, <span class="keywordtype">unsigned</span> permissions = 0640, <span class="keywordtype">size_t</span> size = 512);
<a name="l00105"></a>00105 
<a name="l00112"></a>00112     <span class="keywordtype">void</span> open(<span class="keyword">const</span> <span class="keywordtype">char</span> *path, <a class="code" href="a00052.html#a8077a56ced2b26f2bcefa74dbacb4e90" title="Enumerated file access modes.">fsys::access_t</a> access = fsys::ACCESS_RDWR, <span class="keywordtype">size_t</span> size = 512);
<a name="l00113"></a>00113 
<a name="l00117"></a>00117     <span class="keywordtype">void</span> close(<span class="keywordtype">void</span>);
<a name="l00118"></a>00118 
<a name="l00126"></a>00126     <span class="keywordtype">bool</span> seek(offset_t offset);
<a name="l00127"></a>00127 
<a name="l00134"></a>00134     <span class="keywordtype">bool</span> trunc(offset_t offset);
<a name="l00135"></a>00135 
<a name="l00142"></a>00142     offset_t tell(<span class="keywordtype">void</span>);
<a name="l00143"></a>00143 };
<a name="l00144"></a>00144 
<a name="l00151"></a><a class="code" href="a00151.html">00151</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00151.html" title="A generic tcp socket class that offers i/o buffering.">TCPBuffer</a> : <span class="keyword">public</span> <a class="code" href="a00028.html" title="Common buffer protocol class.">BufferProtocol</a>, <span class="keyword">protected</span> <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>
<a name="l00152"></a>00152 {
<a name="l00153"></a>00153 <span class="keyword">protected</span>:
<a name="l00154"></a>00154     <span class="keywordtype">void</span> _buffer(<span class="keywordtype">size_t</span> size);
<a name="l00155"></a>00155 
<a name="l00156"></a>00156     <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> <a class="code" href="a00028.html#a5329c45421a6d759d8a786c06edadb41" title="Method to push buffer into physical i/o (write).">_push</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>, <span class="keywordtype">size_t</span> size);
<a name="l00157"></a>00157     <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> <a class="code" href="a00028.html#ad9add3680f74ccacc47283a1b2a18b2f" title="Method to pull buffer from physical i/o (read).">_pull</a>(<span class="keywordtype">char</span> *address, <span class="keywordtype">size_t</span> size);
<a name="l00158"></a>00158     <span class="keywordtype">int</span> <a class="code" href="a00028.html#a5f0923302702e561a3c615873ba1fe89" title="Method to get low level i/o error.">_err</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00159"></a>00159     <span class="keywordtype">void</span> <a class="code" href="a00028.html#a821c8d2b7023cc5eeb60261e3905e3ee" title="Method to clear low level i/o error.">_clear</a>(<span class="keywordtype">void</span>);
<a name="l00160"></a>00160     <span class="keywordtype">bool</span> <a class="code" href="a00028.html#a0850660fb7ed4b7449eba443a7cf461c" title="Return true if blocking.">_blocking</a>(<span class="keywordtype">void</span>);
<a name="l00161"></a>00161 
<a name="l00166"></a><a class="code" href="a00151.html#a951a962fea0f2a09ad9236b9c43a67f9">00166</a>     <span class="keyword">inline</span> socket_t getsocket(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00167"></a>00167 <span class="keyword">        </span>{<span class="keywordflow">return</span> so;};
<a name="l00168"></a>00168 
<a name="l00169"></a>00169 <span class="keyword">public</span>:
<a name="l00173"></a>00173     <a class="code" href="a00151.html" title="A generic tcp socket class that offers i/o buffering.">TCPBuffer</a>();
<a name="l00174"></a>00174 
<a name="l00180"></a>00180     <a class="code" href="a00151.html" title="A generic tcp socket class that offers i/o buffering.">TCPBuffer</a>(<span class="keyword">const</span> <a class="code" href="a00152.html" title="A generic tcp server class.">TCPServer</a> *server, <span class="keywordtype">size_t</span> size = 536);
<a name="l00181"></a>00181 
<a name="l00188"></a>00188     <a class="code" href="a00151.html" title="A generic tcp socket class that offers i/o buffering.">TCPBuffer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *host, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">size_t</span> size = 536);
<a name="l00189"></a>00189 
<a name="l00193"></a>00193     <span class="keyword">virtual</span> ~<a class="code" href="a00151.html" title="A generic tcp socket class that offers i/o buffering.">TCPBuffer</a>();
<a name="l00194"></a>00194 
<a name="l00201"></a>00201     <span class="keywordtype">void</span> open(<span class="keyword">const</span> <a class="code" href="a00152.html" title="A generic tcp server class.">TCPServer</a> *server, <span class="keywordtype">size_t</span> size = 536);
<a name="l00202"></a>00202 
<a name="l00210"></a>00210     <span class="keywordtype">void</span> open(<span class="keyword">const</span> <span class="keywordtype">char</span> *host, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">size_t</span> size = 536);
<a name="l00211"></a>00211 
<a name="l00215"></a>00215     <span class="keywordtype">void</span> close(<span class="keywordtype">void</span>);
<a name="l00216"></a>00216 
<a name="l00217"></a>00217 <span class="keyword">protected</span>:
<a name="l00222"></a>00222     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="a00028.html#a0bff400bc09929b1c771bf962c91b7af" title="Check if data is pending.">_pending</a>(<span class="keywordtype">void</span>);
<a name="l00223"></a>00223 };
<a name="l00224"></a>00224 
<a name="l00228"></a><a class="code" href="a00208.html#ae9f2c533c197705facf6f65b0e8bbca1">00228</a> <span class="keyword">typedef</span> <a class="code" href="a00050.html" title="A generic file streaming class built from the buffer protocol.">fbuf</a> <a class="code" href="a00050.html" title="A generic file streaming class built from the buffer protocol.">file_t</a>;
<a name="l00229"></a>00229 
<a name="l00233"></a><a class="code" href="a00208.html#a7295ce3a67171b9146b00cd7d2e8d63c">00233</a> <span class="keyword">typedef</span> <a class="code" href="a00151.html" title="A generic tcp socket class that offers i/o buffering.">TCPBuffer</a> <a class="code" href="a00151.html" title="A generic tcp socket class that offers i/o buffering.">tcp_t</a>;
<a name="l00234"></a>00234 
<a name="l00235"></a>00235 END_NAMESPACE
<a name="l00236"></a>00236 
<a name="l00237"></a>00237 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Jul 14 16:38:56 2011 for ucommon by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>