docs/api-2.1/ucx_8h_source.html

Mon, 31 Jan 2022 17:15:59 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 31 Jan 2022 17:15:59 +0100
changeset 501
9a08f5e515cc
parent 390
d345541018fa
permissions
-rw-r--r--

add allocator support to CxBuffer

Also change how the buffer itself is allocated and destroyed.

<!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/ucx.h Source File</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="headertitle">
<div class="title">ucx.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="ucx_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Copyright 2017 Mike Becker, Olaf Wintermann All rights reserved.</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Redistribution and use in source and binary forms, with or without</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * modification, are permitted provided that the following conditions are met:</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *   1. Redistributions of source code must retain the above copyright</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *      notice, this list of conditions and the following disclaimer.</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> *   2. Redistributions in binary form must reproduce the above copyright</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *      notice, this list of conditions and the following disclaimer in the</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> *      documentation and/or other materials provided with the distribution.</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"> * POSSIBILITY OF SUCH DAMAGE.</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#ifndef UCX_H</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#define UCX_H</span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="ucx_8h.html#aa57e5dd22d42387d748cc16777df1383">   40</a></span>&#160;<span class="preprocessor">#define UCX_VERSION_MAJOR   2</span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="ucx_8h.html#a9ac10d6353e23d4615a87fc737c65eb0">   43</a></span>&#160;<span class="preprocessor">#define UCX_VERSION_MINOR   1</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="ucx_8h.html#af12001920ca2fc1405615684e4dea284">   46</a></span>&#160;<span class="preprocessor">#define UCX_VERSION (((UCX_VERSION_MAJOR)&lt;&lt;16)|UCX_VERSION_MINOR)</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">#ifdef _WIN32</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">#if !(defined __ssize_t_defined || defined _SSIZE_T_)</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor">#include &lt;BaseTsd.h&gt;</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keyword">typedef</span> SSIZE_T ssize_t;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="preprocessor">#define __ssize_t_defined</span></div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="preprocessor">#define _SSIZE_T_</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* __ssize_t_defined and _SSIZE_T */</span><span class="preprocessor"></span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#else </span><span class="comment">/* !_WIN32 */</span><span class="preprocessor"></span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="preprocessor">#include &lt;sys/types.h&gt;</span></div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* _WIN32 */</span><span class="preprocessor"></span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#ifdef  __cplusplus</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    </div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">   72</a></span>&#160;<span class="keyword">typedef</span> void(*<a class="code" href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a>)(<span class="keywordtype">void</span>*);</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">   84</a></span>&#160;<span class="keyword">typedef</span> int(*<a class="code" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a>)(<span class="keyword">const</span> <span class="keywordtype">void</span>*,<span class="keyword">const</span> <span class="keywordtype">void</span>*,<span class="keywordtype">void</span>*);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">   93</a></span>&#160;<span class="keyword">typedef</span> intmax_t(*<a class="code" href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">distance_func</a>)(<span class="keyword">const</span> <span class="keywordtype">void</span>*,<span class="keyword">const</span> <span class="keywordtype">void</span>*,<span class="keywordtype">void</span>*);</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="ucx_8h.html#aab917a5fe0965673c73e8ebd0a1fc967">  106</a></span>&#160;<span class="keyword">typedef</span> <span class="keywordtype">void</span>*(*copy_func)(<span class="keyword">const</span> <span class="keywordtype">void</span>*,<span class="keywordtype">void</span>*);</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno"><a class="line" href="ucx_8h.html#a989b3f0fa4d307d278378fde435641ed">  119</a></span>&#160;<span class="keyword">typedef</span> size_t(*<a class="code" href="ucx_8h.html#a989b3f0fa4d307d278378fde435641ed">write_func</a>)(<span class="keyword">const</span> <span class="keywordtype">void</span>*, size_t, size_t, <span class="keywordtype">void</span>*);</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="ucx_8h.html#a6a67e255e460acb58f802067b3ff5fd5">  132</a></span>&#160;<span class="keyword">typedef</span> size_t(*<a class="code" href="ucx_8h.html#a6a67e255e460acb58f802067b3ff5fd5">read_func</a>)(<span class="keywordtype">void</span>*, size_t, size_t, <span class="keywordtype">void</span>*);</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="preprocessor">#if __GNUC__ &gt;= 5 || defined(__clang__)</span></div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="preprocessor">#define UCX_MUL_BUILTIN</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;<span class="preprocessor">#if __WORDSIZE == 32</span></div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;<span class="preprocessor">#define ucx_szmul(a, b, result) __builtin_umul_overflow(a, b, result)</span></div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="preprocessor">#else </span><span class="comment">/* __WORDSIZE != 32 */</span><span class="preprocessor"></span></div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;<span class="preprocessor">#define ucx_szmul(a, b, result) __builtin_umull_overflow(a, b, result)</span></div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* __WORDSIZE */</span><span class="preprocessor"></span></div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="preprocessor">#else </span><span class="comment">/* no GNUC or clang bultin */</span><span class="preprocessor"></span></div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div><div class="line"><a name="l00181"></a><span class="lineno"><a class="line" href="ucx_8h.html#a0b5ed6c1a0b15356f4f948acfd32a4cc">  181</a></span>&#160;<span class="preprocessor">#define ucx_szmul(a, b, result) ucx_szmul_impl(a, b, result)</span></div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;<span class="keywordtype">int</span> <a class="code" href="ucx_8h.html#a6637171cc0ec097b297f731a3036dd3b">ucx_szmul_impl</a>(<span class="keywordtype">size_t</span> a, <span class="keywordtype">size_t</span> b, <span class="keywordtype">size_t</span> *result);</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;<span class="preprocessor">#ifdef  __cplusplus</span></div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;}</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;<span class="preprocessor">#endif  </span><span class="comment">/* UCX_H */</span><span class="preprocessor"></span></div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;</div><div class="ttc" id="ucx_8h_html_afe5e2d5dbf34778e0e97852051570791"><div class="ttname"><a href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a></div><div class="ttdeci">int(* cmp_func)(const void *, const void *, void *)</div><div class="ttdoc">Function pointer to a compare function. </div><div class="ttdef"><b>Definition:</b> ucx.h:84</div></div>
<div class="ttc" id="ucx_8h_html_a6a67e255e460acb58f802067b3ff5fd5"><div class="ttname"><a href="ucx_8h.html#a6a67e255e460acb58f802067b3ff5fd5">read_func</a></div><div class="ttdeci">size_t(* read_func)(void *, size_t, size_t, void *)</div><div class="ttdoc">Function pointer to a read function. </div><div class="ttdef"><b>Definition:</b> ucx.h:132</div></div>
<div class="ttc" id="ucx_8h_html_a0bc5bf89e556c1d45d10863d52728ac9"><div class="ttname"><a href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">distance_func</a></div><div class="ttdeci">intmax_t(* distance_func)(const void *, const void *, void *)</div><div class="ttdoc">Function pointer to a distance function. </div><div class="ttdef"><b>Definition:</b> ucx.h:93</div></div>
<div class="ttc" id="ucx_8h_html_a6637171cc0ec097b297f731a3036dd3b"><div class="ttname"><a href="ucx_8h.html#a6637171cc0ec097b297f731a3036dd3b">ucx_szmul_impl</a></div><div class="ttdeci">int ucx_szmul_impl(size_t a, size_t b, size_t *result)</div><div class="ttdoc">Performs a multiplication of size_t values and checks for overflow. </div><div class="ttdef"><b>Definition:</b> ucx.c:48</div></div>
<div class="ttc" id="ucx_8h_html_a989b3f0fa4d307d278378fde435641ed"><div class="ttname"><a href="ucx_8h.html#a989b3f0fa4d307d278378fde435641ed">write_func</a></div><div class="ttdeci">size_t(* write_func)(const void *, size_t, size_t, void *)</div><div class="ttdoc">Function pointer to a write function. </div><div class="ttdef"><b>Definition:</b> ucx.h:119</div></div>
<div class="ttc" id="ucx_8h_html_ad2b370c2809914c8b7fedab163c266b3"><div class="ttname"><a href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a></div><div class="ttdeci">void(* ucx_destructor)(void *)</div><div class="ttdoc">A function pointer to a destructor function. </div><div class="ttdef"><b>Definition:</b> ucx.h:72</div></div>
</div><!-- fragment --></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