docs/api-2.1/buffer_8h.html

Sat, 19 Oct 2024 13:21:58 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 19 Oct 2024 13:21:58 +0200
changeset 931
be71809e69d1
parent 390
d345541018fa
permissions
-rw-r--r--

add test coverage for unlinking tree nodes w/o prev pointer

<!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.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ucx: /home/mike/workspace/c/ucx/src/ucx/buffer.h File 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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.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 id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ucx
   </div>
   <div id="projectbrief">UAP Common Extensions</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_69f4ea29401808fe6229564976cde3ce.html">ucx</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">buffer.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Advanced buffer implementation.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="ucx_8h_source.html">ucx.h</a>&quot;</code><br />
<code>#include &lt;sys/types.h&gt;</code><br />
<code>#include &lt;stdio.h&gt;</code><br />
</div>
<p><a href="buffer_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxBuffer.html">UcxBuffer</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">UCX Buffer.  <a href="structUcxBuffer.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:acc77c8ed7b26854f555d4a5d11e49ea2"><td class="memItemLeft" align="right" valign="top"><a id="acc77c8ed7b26854f555d4a5d11e49ea2"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#acc77c8ed7b26854f555d4a5d11e49ea2">UCX_BUFFER_DEFAULT</a>&#160;&#160;&#160;0x00</td></tr>
<tr class="memdesc:acc77c8ed7b26854f555d4a5d11e49ea2"><td class="mdescLeft">&#160;</td><td class="mdescRight">No buffer features enabled (all flags cleared). <br /></td></tr>
<tr class="separator:acc77c8ed7b26854f555d4a5d11e49ea2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bab11ad8a76719228b9ee91e2e45535"><td class="memItemLeft" align="right" valign="top"><a id="a8bab11ad8a76719228b9ee91e2e45535"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a8bab11ad8a76719228b9ee91e2e45535">UCX_BUFFER_AUTOFREE</a>&#160;&#160;&#160;0x01</td></tr>
<tr class="memdesc:a8bab11ad8a76719228b9ee91e2e45535"><td class="mdescLeft">&#160;</td><td class="mdescRight">If this flag is enabled, the buffer will automatically free its contents. <br /></td></tr>
<tr class="separator:a8bab11ad8a76719228b9ee91e2e45535"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a05f9565f2d04399168c3b1c152a632be"><td class="memItemLeft" align="right" valign="top"><a id="a05f9565f2d04399168c3b1c152a632be"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a05f9565f2d04399168c3b1c152a632be">UCX_BUFFER_AUTOEXTEND</a>&#160;&#160;&#160;0x02</td></tr>
<tr class="memdesc:a05f9565f2d04399168c3b1c152a632be"><td class="mdescLeft">&#160;</td><td class="mdescRight">If this flag is enabled, the buffer will automatically extends its capacity. <br /></td></tr>
<tr class="separator:a05f9565f2d04399168c3b1c152a632be"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a828353846428c2c2f695f9938f059e52"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a828353846428c2c2f695f9938f059e52">ucx_buffer_clone</a>(src,  flags)&#160;&#160;&#160;<a class="el" href="buffer_8h.html#a33fa7bb35fe08bbb3542f227514332ef">ucx_buffer_extract</a>(src, 0, (src)-&gt;capacity, flags)</td></tr>
<tr class="memdesc:a828353846428c2c2f695f9938f059e52"><td class="mdescLeft">&#160;</td><td class="mdescRight">A shorthand macro for the full extraction of the buffer.  <a href="#a828353846428c2c2f695f9938f059e52">More...</a><br /></td></tr>
<tr class="separator:a828353846428c2c2f695f9938f059e52"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a374abd5aabfcc3ee0777a79d5fe651ab"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a374abd5aabfcc3ee0777a79d5fe651ab">ucx_buffer_clear</a>(buffer)</td></tr>
<tr class="memdesc:a374abd5aabfcc3ee0777a79d5fe651ab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears the buffer by resetting the position and deleting the data.  <a href="#a374abd5aabfcc3ee0777a79d5fe651ab">More...</a><br /></td></tr>
<tr class="separator:a374abd5aabfcc3ee0777a79d5fe651ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f4b64f1b3a74c4f6c5d9409d6b6086a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a0f4b64f1b3a74c4f6c5d9409d6b6086a">ucx_buffer_to_sstr</a>(buffer)&#160;&#160;&#160;<a class="el" href="string_8h.html#a2744c38ac44abf3e01fa059056dcf36c">sstrn</a>((buffer)-&gt;space, (buffer)-&gt;size)</td></tr>
<tr class="memdesc:a0f4b64f1b3a74c4f6c5d9409d6b6086a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the complete buffer content as <a class="el" href="structsstr__t.html" title="The UCX string structure. ">sstr_t</a>.  <a href="#a0f4b64f1b3a74c4f6c5d9409d6b6086a">More...</a><br /></td></tr>
<tr class="separator:a0f4b64f1b3a74c4f6c5d9409d6b6086a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aacea876d692193ec6f859ce98da7351c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#aacea876d692193ec6f859ce98da7351c">ucx_buffer_new</a> (void *space, size_t capacity, int flags)</td></tr>
<tr class="memdesc:aacea876d692193ec6f859ce98da7351c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new buffer.  <a href="#aacea876d692193ec6f859ce98da7351c">More...</a><br /></td></tr>
<tr class="separator:aacea876d692193ec6f859ce98da7351c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2af8646d8905c22c7322e7540b0440af"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a2af8646d8905c22c7322e7540b0440af">ucx_buffer_free</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer)</td></tr>
<tr class="memdesc:a2af8646d8905c22c7322e7540b0440af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys a buffer.  <a href="#a2af8646d8905c22c7322e7540b0440af">More...</a><br /></td></tr>
<tr class="separator:a2af8646d8905c22c7322e7540b0440af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33fa7bb35fe08bbb3542f227514332ef"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a33fa7bb35fe08bbb3542f227514332ef">ucx_buffer_extract</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *src, size_t start, size_t length, int flags)</td></tr>
<tr class="memdesc:a33fa7bb35fe08bbb3542f227514332ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new buffer and fills it with extracted content from another buffer.  <a href="#a33fa7bb35fe08bbb3542f227514332ef">More...</a><br /></td></tr>
<tr class="separator:a33fa7bb35fe08bbb3542f227514332ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a12a0c6a2379ef080043e6286bb8bad69"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a12a0c6a2379ef080043e6286bb8bad69">ucx_buffer_shift</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer, off_t shift)</td></tr>
<tr class="memdesc:a12a0c6a2379ef080043e6286bb8bad69"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shifts the contents of the buffer by the given offset.  <a href="#a12a0c6a2379ef080043e6286bb8bad69">More...</a><br /></td></tr>
<tr class="separator:a12a0c6a2379ef080043e6286bb8bad69"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4fa10b6471495547eb981248fd4f1bc2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a4fa10b6471495547eb981248fd4f1bc2">ucx_buffer_shift_right</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer, size_t shift)</td></tr>
<tr class="memdesc:a4fa10b6471495547eb981248fd4f1bc2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shifts the buffer to the right.  <a href="#a4fa10b6471495547eb981248fd4f1bc2">More...</a><br /></td></tr>
<tr class="separator:a4fa10b6471495547eb981248fd4f1bc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a20431dd0ed6a6fe9f15333bd72afe4db"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a20431dd0ed6a6fe9f15333bd72afe4db">ucx_buffer_shift_left</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer, size_t shift)</td></tr>
<tr class="memdesc:a20431dd0ed6a6fe9f15333bd72afe4db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shifts the buffer to the left.  <a href="#a20431dd0ed6a6fe9f15333bd72afe4db">More...</a><br /></td></tr>
<tr class="separator:a20431dd0ed6a6fe9f15333bd72afe4db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a47d98482662073c74f35deb0957d15d1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a47d98482662073c74f35deb0957d15d1">ucx_buffer_seek</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer, off_t offset, int whence)</td></tr>
<tr class="memdesc:a47d98482662073c74f35deb0957d15d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Moves the position of the buffer.  <a href="#a47d98482662073c74f35deb0957d15d1">More...</a><br /></td></tr>
<tr class="separator:a47d98482662073c74f35deb0957d15d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abad7fd9ad5061224c780b8d1d4c55f09"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#abad7fd9ad5061224c780b8d1d4c55f09">ucx_buffer_eof</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer)</td></tr>
<tr class="memdesc:abad7fd9ad5061224c780b8d1d4c55f09"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tests, if the buffer position has exceeded the buffer capacity.  <a href="#abad7fd9ad5061224c780b8d1d4c55f09">More...</a><br /></td></tr>
<tr class="separator:abad7fd9ad5061224c780b8d1d4c55f09"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afaf97d2cd7e9faad79a9d35fe33e30c6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#afaf97d2cd7e9faad79a9d35fe33e30c6">ucx_buffer_extend</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer, size_t additional_bytes)</td></tr>
<tr class="memdesc:afaf97d2cd7e9faad79a9d35fe33e30c6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extends the capacity of the buffer.  <a href="#afaf97d2cd7e9faad79a9d35fe33e30c6">More...</a><br /></td></tr>
<tr class="separator:afaf97d2cd7e9faad79a9d35fe33e30c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8aacc7401814392b58c1b7b81bffc05"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#af8aacc7401814392b58c1b7b81bffc05">ucx_buffer_write</a> (const void *ptr, size_t size, size_t nitems, <a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer)</td></tr>
<tr class="memdesc:af8aacc7401814392b58c1b7b81bffc05"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes data to a <a class="el" href="structUcxBuffer.html" title="UCX Buffer. ">UcxBuffer</a>.  <a href="#af8aacc7401814392b58c1b7b81bffc05">More...</a><br /></td></tr>
<tr class="separator:af8aacc7401814392b58c1b7b81bffc05"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5c3430759f0059547b35d5a254d4da5"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#ae5c3430759f0059547b35d5a254d4da5">ucx_buffer_read</a> (void *ptr, size_t size, size_t nitems, <a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer)</td></tr>
<tr class="memdesc:ae5c3430759f0059547b35d5a254d4da5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads data from a <a class="el" href="structUcxBuffer.html" title="UCX Buffer. ">UcxBuffer</a>.  <a href="#ae5c3430759f0059547b35d5a254d4da5">More...</a><br /></td></tr>
<tr class="separator:ae5c3430759f0059547b35d5a254d4da5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d6f01b9d631b0123475dfb98fb849ac"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a7d6f01b9d631b0123475dfb98fb849ac">ucx_buffer_putc</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer, int c)</td></tr>
<tr class="memdesc:a7d6f01b9d631b0123475dfb98fb849ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes a character to a buffer.  <a href="#a7d6f01b9d631b0123475dfb98fb849ac">More...</a><br /></td></tr>
<tr class="separator:a7d6f01b9d631b0123475dfb98fb849ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a396339022159ce4ca6d069de9f9209b0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#a396339022159ce4ca6d069de9f9209b0">ucx_buffer_getc</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer)</td></tr>
<tr class="memdesc:a396339022159ce4ca6d069de9f9209b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets a character from a buffer.  <a href="#a396339022159ce4ca6d069de9f9209b0">More...</a><br /></td></tr>
<tr class="separator:a396339022159ce4ca6d069de9f9209b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af1d4b478e04b3ae0bf30e7c2ea964ea2"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="buffer_8h.html#af1d4b478e04b3ae0bf30e7c2ea964ea2">ucx_buffer_puts</a> (<a class="el" href="structUcxBuffer.html">UcxBuffer</a> *buffer, const char *str)</td></tr>
<tr class="memdesc:af1d4b478e04b3ae0bf30e7c2ea964ea2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes a string to a buffer.  <a href="#af1d4b478e04b3ae0bf30e7c2ea964ea2">More...</a><br /></td></tr>
<tr class="separator:af1d4b478e04b3ae0bf30e7c2ea964ea2"><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>Advanced buffer implementation. </p>
<p>Instances of <a class="el" href="structUcxBuffer.html" title="UCX Buffer. ">UcxBuffer</a> can be used to read from or to write to like one would do with a stream. This allows the use of <a class="el" href="utils_8h.html#a41ca1344f781c0d3bf7a414a6e811392" title="Shorthand for an unbounded ucx_stream_bncopy call using a default buffer. ">ucx_stream_copy()</a> to copy contents from one buffer to another.</p>
<p>Some features for convenient use of the buffer can be enabled. See the documentation of the macro constants for more information.</p>
<dl class="section author"><dt>Author</dt><dd>Mike Becker </dd>
<dd>
Olaf Wintermann </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a374abd5aabfcc3ee0777a79d5fe651ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a374abd5aabfcc3ee0777a79d5fe651ab">&#9670;&nbsp;</a></span>ucx_buffer_clear</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ucx_buffer_clear</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">buffer</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">memset((buffer)-&gt;space, 0, (buffer)-&gt;size); \</div><div class="line">        (buffer)-&gt;size = 0; (buffer)-&gt;pos = 0;</div></div><!-- fragment -->
<p>Clears the buffer by resetting the position and deleting the data. </p>
<p>The data is deleted by a zeroing it with call to <code>memset()</code>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer to be cleared </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a828353846428c2c2f695f9938f059e52"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a828353846428c2c2f695f9938f059e52">&#9670;&nbsp;</a></span>ucx_buffer_clone</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ucx_buffer_clone</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">src, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">flags&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;<a class="el" href="buffer_8h.html#a33fa7bb35fe08bbb3542f227514332ef">ucx_buffer_extract</a>(src, 0, (src)-&gt;capacity, flags)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>A shorthand macro for the full extraction of the buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>the source buffer </td></tr>
    <tr><td class="paramname">flags</td><td>feature mask for the new buffer </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a new buffer with the extracted content </dd></dl>

</div>
</div>
<a id="a0f4b64f1b3a74c4f6c5d9409d6b6086a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0f4b64f1b3a74c4f6c5d9409d6b6086a">&#9670;&nbsp;</a></span>ucx_buffer_to_sstr</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ucx_buffer_to_sstr</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">buffer</td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="string_8h.html#a2744c38ac44abf3e01fa059056dcf36c">sstrn</a>((buffer)-&gt;space, (buffer)-&gt;size)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the complete buffer content as <a class="el" href="structsstr__t.html" title="The UCX string structure. ">sstr_t</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the result of <code><a class="el" href="string_8h.html#a2744c38ac44abf3e01fa059056dcf36c" title="Creates a new sstr_t of the specified length based on a C string. ">sstrn()</a></code> with the buffer space and size as arguments </dd></dl>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="abad7fd9ad5061224c780b8d1d4c55f09"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abad7fd9ad5061224c780b8d1d4c55f09">&#9670;&nbsp;</a></span>ucx_buffer_eof()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_eof </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Tests, if the buffer position has exceeded the buffer capacity. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer to test </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>non-zero, if the current buffer position has exceeded the last available byte of the buffer. </dd></dl>

</div>
</div>
<a id="afaf97d2cd7e9faad79a9d35fe33e30c6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afaf97d2cd7e9faad79a9d35fe33e30c6">&#9670;&nbsp;</a></span>ucx_buffer_extend()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_extend </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>additional_bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Extends the capacity of the buffer. </p>
<p><b>Note:</b> The buffer capacity increased by a power of two. I.e. the buffer capacity is doubled, as long as it would not hold the current content plus the additional required bytes.</p>
<p><b>Attention:</b> the argument provided is the number of <em>additional</em> bytes the buffer shall hold. It is <b>NOT</b> the total number of bytes the buffer shall hold.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer to extend </td></tr>
    <tr><td class="paramname">additional_bytes</td><td>the number of additional bytes the buffer shall <em>at least</em> hold </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success or a non-zero value on failure </dd></dl>

</div>
</div>
<a id="a33fa7bb35fe08bbb3542f227514332ef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a33fa7bb35fe08bbb3542f227514332ef">&#9670;&nbsp;</a></span>ucx_buffer_extract()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structUcxBuffer.html">UcxBuffer</a>* ucx_buffer_extract </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>start</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new buffer and fills it with extracted content from another buffer. </p>
<p><b>Note:</b> the <a class="el" href="buffer_8h.html#a8bab11ad8a76719228b9ee91e2e45535" title="If this flag is enabled, the buffer will automatically free its contents. ">UCX_BUFFER_AUTOFREE</a> feature is enforced for the new buffer.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>the source buffer </td></tr>
    <tr><td class="paramname">start</td><td>the start position of extraction </td></tr>
    <tr><td class="paramname">length</td><td>the count of bytes to extract (must not be zero) </td></tr>
    <tr><td class="paramname">flags</td><td>feature mask for the new buffer </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a new buffer containing the extraction </dd></dl>

</div>
</div>
<a id="a2af8646d8905c22c7322e7540b0440af"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2af8646d8905c22c7322e7540b0440af">&#9670;&nbsp;</a></span>ucx_buffer_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ucx_buffer_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroys a buffer. </p>
<p>If the <a class="el" href="buffer_8h.html#a8bab11ad8a76719228b9ee91e2e45535" title="If this flag is enabled, the buffer will automatically free its contents. ">UCX_BUFFER_AUTOFREE</a> feature is enabled, the contents of the buffer are also freed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer to destroy </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a396339022159ce4ca6d069de9f9209b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a396339022159ce4ca6d069de9f9209b0">&#9670;&nbsp;</a></span>ucx_buffer_getc()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_getc </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets a character from a buffer. </p>
<p>The current position of the buffer is increased after a successful read.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer to read from </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the character as <code>int</code> value or <code>EOF</code>, if the end of the buffer is reached </dd></dl>

</div>
</div>
<a id="aacea876d692193ec6f859ce98da7351c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aacea876d692193ec6f859ce98da7351c">&#9670;&nbsp;</a></span>ucx_buffer_new()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structUcxBuffer.html">UcxBuffer</a>* ucx_buffer_new </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>space</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>capacity</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new buffer. </p>
<p><b>Note:</b> you may provide <code>NULL</code> as argument for <code>space</code>. Then this function will allocate the space and enforce the <a class="el" href="buffer_8h.html#a8bab11ad8a76719228b9ee91e2e45535" title="If this flag is enabled, the buffer will automatically free its contents. ">UCX_BUFFER_AUTOFREE</a> flag.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">space</td><td>pointer to the memory area, or <code>NULL</code> to allocate new memory </td></tr>
    <tr><td class="paramname">capacity</td><td>the capacity of the buffer </td></tr>
    <tr><td class="paramname">flags</td><td>buffer features (see <a class="el" href="structUcxBuffer.html#ac642e07b0a03be5aac48eb4aa5bec2f7" title="Flag register for buffer features. ">UcxBuffer.flags</a>) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new buffer </dd></dl>

</div>
</div>
<a id="a7d6f01b9d631b0123475dfb98fb849ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7d6f01b9d631b0123475dfb98fb849ac">&#9670;&nbsp;</a></span>ucx_buffer_putc()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_putc </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>c</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Writes a character to a buffer. </p>
<p>The least significant byte of the argument is written to the buffer. If the end of the buffer is reached and <a class="el" href="buffer_8h.html#a05f9565f2d04399168c3b1c152a632be" title="If this flag is enabled, the buffer will automatically extends its capacity. ">UCX_BUFFER_AUTOEXTEND</a> feature is enabled, the buffer capacity is extended by <a class="el" href="buffer_8h.html#afaf97d2cd7e9faad79a9d35fe33e30c6" title="Extends the capacity of the buffer. ">ucx_buffer_extend()</a>. If the feature is disabled or buffer extension fails, <code>EOF</code> is returned.</p>
<p>On successful write the position of the buffer is increased.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer to write to </td></tr>
    <tr><td class="paramname">c</td><td>the character to write as <code>int</code> value </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the byte that has bean written as <code>int</code> value or <code>EOF</code> when the end of the stream is reached and automatic extension is not enabled or not possible </dd></dl>

</div>
</div>
<a id="af1d4b478e04b3ae0bf30e7c2ea964ea2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af1d4b478e04b3ae0bf30e7c2ea964ea2">&#9670;&nbsp;</a></span>ucx_buffer_puts()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ucx_buffer_puts </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Writes a string to a buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer </td></tr>
    <tr><td class="paramname">str</td><td>the string </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the number of bytes written </dd></dl>

</div>
</div>
<a id="ae5c3430759f0059547b35d5a254d4da5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae5c3430759f0059547b35d5a254d4da5">&#9670;&nbsp;</a></span>ucx_buffer_read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ucx_buffer_read </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nitems</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads data from a <a class="el" href="structUcxBuffer.html" title="UCX Buffer. ">UcxBuffer</a>. </p>
<p>The position of the buffer is increased by the number of bytes read.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>a pointer to the memory area where to store the read data </td></tr>
    <tr><td class="paramname">size</td><td>the length of one element </td></tr>
    <tr><td class="paramname">nitems</td><td>the element count </td></tr>
    <tr><td class="paramname">buffer</td><td>the <a class="el" href="structUcxBuffer.html" title="UCX Buffer. ">UcxBuffer</a> to read from </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the total number of elements read </dd></dl>

</div>
</div>
<a id="a47d98482662073c74f35deb0957d15d1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a47d98482662073c74f35deb0957d15d1">&#9670;&nbsp;</a></span>ucx_buffer_seek()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_seek </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">off_t&#160;</td>
          <td class="paramname"><em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>whence</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Moves the position of the buffer. </p>
<p>The new position is relative to the <code>whence</code> argument.</p>
<p>SEEK_SET marks the start of the buffer. SEEK_CUR marks the current position. SEEK_END marks the end of the buffer.</p>
<p>With an offset of zero, this function sets the buffer position to zero (SEEK_SET), the buffer size (SEEK_END) or leaves the buffer position unchanged (SEEK_CUR).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td></td></tr>
    <tr><td class="paramname">offset</td><td>position offset relative to <code>whence</code> </td></tr>
    <tr><td class="paramname">whence</td><td>one of SEEK_SET, SEEK_CUR or SEEK_END </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, non-zero if the position is invalid </dd></dl>

</div>
</div>
<a id="a12a0c6a2379ef080043e6286bb8bad69"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a12a0c6a2379ef080043e6286bb8bad69">&#9670;&nbsp;</a></span>ucx_buffer_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_shift </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">off_t&#160;</td>
          <td class="paramname"><em>shift</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Shifts the contents of the buffer by the given offset. </p>
<p>If the offset is positive, the contents are shifted to the right. If auto extension is enabled, the buffer grows, if necessary. In case the auto extension fails, this function returns a non-zero value and no contents are changed. If auto extension is disabled, the contents that do not fit into the buffer are discarded.</p>
<p>If the offset is negative, the contents are shifted to the left where the first <code>shift</code> bytes are discarded. The new size of the buffer is the old size minus the absolute shift value. If this value is larger than the buffer size, the buffer is emptied (but not cleared, see the security note below).</p>
<p>The buffer position gets shifted alongside with the content but is kept within the boundaries of the buffer.</p>
<p><b>Security note:</b> the shifting operation does <em>not</em> erase the previously occupied memory cells. You can easily do that manually, e.g. by calling <code>memset(buffer-&gt;space, 0, shift)</code> for a right shift or <code>memset(buffer-&gt;size, 0, buffer-&gt;capacity-buffer-&gt;size)</code> for a left shift.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer </td></tr>
    <tr><td class="paramname">shift</td><td>the shift offset (negative means left shift) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, non-zero if a required auto-extension fails </dd></dl>

</div>
</div>
<a id="a20431dd0ed6a6fe9f15333bd72afe4db"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a20431dd0ed6a6fe9f15333bd72afe4db">&#9670;&nbsp;</a></span>ucx_buffer_shift_left()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_shift_left </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>shift</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Shifts the buffer to the left. </p>
<p>See <a class="el" href="buffer_8h.html#a12a0c6a2379ef080043e6286bb8bad69" title="Shifts the contents of the buffer by the given offset. ">ucx_buffer_shift()</a> for details. Note, however, that this method expects a positive shift offset.</p>
<p>Since a left shift cannot fail due to memory allocation problems, this function always returns zero.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer </td></tr>
    <tr><td class="paramname">shift</td><td>the shift offset </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>always zero </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="buffer_8h.html#a12a0c6a2379ef080043e6286bb8bad69" title="Shifts the contents of the buffer by the given offset. ">ucx_buffer_shift()</a> </dd></dl>

</div>
</div>
<a id="a4fa10b6471495547eb981248fd4f1bc2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4fa10b6471495547eb981248fd4f1bc2">&#9670;&nbsp;</a></span>ucx_buffer_shift_right()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucx_buffer_shift_right </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>shift</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Shifts the buffer to the right. </p>
<p>See <a class="el" href="buffer_8h.html#a12a0c6a2379ef080043e6286bb8bad69" title="Shifts the contents of the buffer by the given offset. ">ucx_buffer_shift()</a> for details.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer </td></tr>
    <tr><td class="paramname">shift</td><td>the shift offset </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, non-zero if a required auto-extension fails </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="buffer_8h.html#a12a0c6a2379ef080043e6286bb8bad69" title="Shifts the contents of the buffer by the given offset. ">ucx_buffer_shift()</a> </dd></dl>

</div>
</div>
<a id="af8aacc7401814392b58c1b7b81bffc05"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8aacc7401814392b58c1b7b81bffc05">&#9670;&nbsp;</a></span>ucx_buffer_write()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ucx_buffer_write </td>
          <td>(</td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nitems</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structUcxBuffer.html">UcxBuffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Writes data to a <a class="el" href="structUcxBuffer.html" title="UCX Buffer. ">UcxBuffer</a>. </p>
<p>The position of the buffer is increased by the number of bytes written.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>a pointer to the memory area containing the bytes to be written </td></tr>
    <tr><td class="paramname">size</td><td>the length of one element </td></tr>
    <tr><td class="paramname">nitems</td><td>the element count </td></tr>
    <tr><td class="paramname">buffer</td><td>the <a class="el" href="structUcxBuffer.html" title="UCX Buffer. ">UcxBuffer</a> to write to </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the total count of bytes written </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Dec 19 2019 19:58:24 for ucx by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

mercurial