Wed, 25 Dec 2024 19:33:04 +0100
add implementation for creating new json values
relates to #527
<!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/array.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">array.h</div> </div> </div><!--header--> <div class="contents"> <a href="array_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> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <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> <span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Copyright 2019 Mike Becker, Olaf Wintermann All rights reserved.</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <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> <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> <span class="comment"> *</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <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> <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> <span class="comment"> *</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <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> <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> <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> <span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <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> <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> <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> <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> <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> <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> <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> <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> <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> <span class="comment"> * POSSIBILITY OF SUCH DAMAGE.</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"> */</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#ifndef UCX_ARRAY_H</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="preprocessor">#define UCX_ARRAY_H</span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#include "<a class="code" href="ucx_8h.html">ucx.h</a>"</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor">#include "<a class="code" href="allocator_8h.html">allocator.h</a>"</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structUcxArray.html"> 49</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>{</div><div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="structUcxArray.html#a7ed074887908e45bde7e1fbc67b31c18"> 53</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structUcxArray.html#a7ed074887908e45bde7e1fbc67b31c18">capacity</a>;</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structUcxArray.html#a20c11f2c9048cda80062842b7c094e20"> 57</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structUcxArray.html#a20c11f2c9048cda80062842b7c094e20">size</a>;</div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="structUcxArray.html#ac4e9ecdf8a8d010644f6e44dfef8190f"> 61</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structUcxArray.html#ac4e9ecdf8a8d010644f6e44dfef8190f">elemsize</a>;</div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="structUcxArray.html#a04d2b03d0a45af1fab19b4216602075a"> 65</a></span>  <span class="keywordtype">void</span>* <a class="code" href="structUcxArray.html#a04d2b03d0a45af1fab19b4216602075a">data</a>;</div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="structUcxArray.html#a2ef31303b7548b9aa8e2b9187e295212"> 69</a></span>  <a class="code" href="structUcxAllocator.html">UcxAllocator</a>* <a class="code" href="structUcxArray.html#a2ef31303b7548b9aa8e2b9187e295212">allocator</a>;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> } <a class="code" href="structUcxArray.html">UcxArray</a>;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="array_8h.html#a1d959c29af3125bdd37cde3a554e729c"> 89</a></span> <span class="preprocessor">#define ucx_array_util_set(array, capacity, elmsize, idx, data) \</span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="preprocessor"> ucx_array_util_set_a(ucx_default_allocator(), (void**)(array), capacity, \</span></div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="preprocessor"> elmsize, idx, data)</span></div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> </div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#ad0a8d76980cf1c1910e64a245803fb9a">ucx_array_util_set_a</a>(<a class="code" href="structUcxAllocator.html">UcxAllocator</a>* alloc, <span class="keywordtype">void</span>** array, <span class="keywordtype">size_t</span>* capacity,</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordtype">size_t</span> elmsize, <span class="keywordtype">size_t</span> idx, <span class="keywordtype">void</span>* data);</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> </div><div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="array_8h.html#a59a5b342965e790945f9c7a3f86b99f9"> 131</a></span> <span class="preprocessor">#define ucx_array_util_setptr(array, capacity, idx, ptr) \</span></div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="preprocessor"> ucx_array_util_setptr_a(ucx_default_allocator(), (void**)(array), \</span></div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="preprocessor"> capacity, idx, ptr)</span></div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#ad708b333c0c1b02c998309a58ea65e31">ucx_array_util_setptr_a</a>(<a class="code" href="structUcxAllocator.html">UcxAllocator</a>* alloc, <span class="keywordtype">void</span>** array, <span class="keywordtype">size_t</span>* capacity,</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordtype">size_t</span> idx, <span class="keywordtype">void</span>* ptr);</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> </div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> </div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <a class="code" href="structUcxArray.html">UcxArray</a>* <a class="code" href="array_8h.html#a994a2fbf1c33a3833e2a70cd9a4352b7">ucx_array_new</a>(<span class="keywordtype">size_t</span> capacity, <span class="keywordtype">size_t</span> elemsize);</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> </div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span> <a class="code" href="structUcxArray.html">UcxArray</a>* <a class="code" href="array_8h.html#a177170258c215eb2e4f5a32e59f0cb1b">ucx_array_new_a</a>(<span class="keywordtype">size_t</span> capacity, <span class="keywordtype">size_t</span> elemsize,</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <a class="code" href="structUcxAllocator.html">UcxAllocator</a>* allocator);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span> </div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span> <span class="keywordtype">void</span> <a class="code" href="array_8h.html#ad921e85c28ffae32230777a53c5037e5">ucx_array_init</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* array, <span class="keywordtype">size_t</span> capacity, <span class="keywordtype">size_t</span> elemsize);</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span> </div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span> <span class="keywordtype">void</span> <a class="code" href="array_8h.html#a2451e61ebb15a7ba1c1319267ba75b8c">ucx_array_init_a</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* array, <span class="keywordtype">size_t</span> capacity, <span class="keywordtype">size_t</span> elemsize,</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <a class="code" href="structUcxAllocator.html">UcxAllocator</a>* allocator);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span> </div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a4a8c273370e4a3a3e2624e364f5ab410">ucx_array_clone</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* dest, <a class="code" href="structUcxArray.html">UcxArray</a> <span class="keyword">const</span>* src);</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span> </div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span> </div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a43292b448adb1741677aa8c578bcc201">ucx_array_equals</a>(<a class="code" href="structUcxArray.html">UcxArray</a> <span class="keyword">const</span> *array1, <a class="code" href="structUcxArray.html">UcxArray</a> <span class="keyword">const</span> *array2,</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <a class="code" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, <span class="keywordtype">void</span>* data);</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span> </div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> <span class="keywordtype">void</span> <a class="code" href="array_8h.html#a8e83681d8d5d8cddbf10f63ce5be4c10">ucx_array_destroy</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array);</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span> </div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="keywordtype">void</span> <a class="code" href="array_8h.html#ac01ee914468a16f470bf3071fffbe438">ucx_array_free</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array);</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span> </div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#aea01731ad94ea73c0c8fb1d1b7a35fcf">ucx_array_append_from</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array, <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> count);</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span> </div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> </div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a95b52acc2193b5c33cf0eaa4f2082477">ucx_array_prepend_from</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array, <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> count);</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span> </div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span> </div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a1bb545d065358d265d80d815ba382a28">ucx_array_set_from</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array, <span class="keywordtype">size_t</span> index, <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> count);</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> </div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#aa5a0bf3d3f0df6406beb0e569021cc28">ucx_array_concat</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array1, <span class="keyword">const</span> <a class="code" href="structUcxArray.html">UcxArray</a> *array2);</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span> </div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span> <span class="keywordtype">void</span> *<a class="code" href="array_8h.html#aa698085fd1a8b70d6b709999c51b49e8">ucx_array_at</a>(<a class="code" href="structUcxArray.html">UcxArray</a> <span class="keyword">const</span>* array, <span class="keywordtype">size_t</span> index);</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> </div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span> <span class="keywordtype">size_t</span> <a class="code" href="array_8h.html#ae7bdbed94afee9b20b38b95e3ab470f0">ucx_array_find</a>(<a class="code" href="structUcxArray.html">UcxArray</a> <span class="keyword">const</span> *array, <span class="keywordtype">void</span> *elem,</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <a class="code" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, <span class="keywordtype">void</span> *data);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span> </div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a5241058cd2329147bc5b1593ae7e51dc">ucx_array_contains</a>(<a class="code" href="structUcxArray.html">UcxArray</a> <span class="keyword">const</span> *array, <span class="keywordtype">void</span> *elem,</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <a class="code" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, <span class="keywordtype">void</span> *data);</div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span> </div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span> <span class="keywordtype">void</span> <a class="code" href="array_8h.html#add773514569b872a6624381b4b6af52c">ucx_array_sort</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* array, <a class="code" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, <span class="keywordtype">void</span> *data);</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span> </div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span> <span class="keywordtype">void</span> <a class="code" href="array_8h.html#aa45eac6b697f83adac81c0860cf306b8">ucx_array_remove</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array, <span class="keywordtype">size_t</span> index);</div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span> </div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span> <span class="keywordtype">void</span> <a class="code" href="array_8h.html#a548d81b07612bae3ba8c4c4b49104b8e">ucx_array_remove_fast</a>(<a class="code" href="structUcxArray.html">UcxArray</a> *array, <span class="keywordtype">size_t</span> index);</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span> </div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a2daf50e80aee9bccebee876a7efd2dfc">ucx_array_shrink</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* array);</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span> </div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a27762e7c06a6c781015e3c8ceeee0ce3">ucx_array_resize</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* array, <span class="keywordtype">size_t</span> capacity);</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span> </div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#a1c3bf8433c1de3c933f3854ab297fe1d">ucx_array_reserve</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* array, <span class="keywordtype">size_t</span> capacity);</div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span> </div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span> <span class="keywordtype">int</span> <a class="code" href="array_8h.html#ab0cbf243824aaebee48277315e03afce">ucx_array_grow</a>(<a class="code" href="structUcxArray.html">UcxArray</a>* array, <span class="keywordtype">size_t</span> count);</div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span> </div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span> </div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00456"></a><span class="lineno"> 456</span> }</div><div class="line"><a name="l00457"></a><span class="lineno"> 457</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00458"></a><span class="lineno"> 458</span> </div><div class="line"><a name="l00459"></a><span class="lineno"> 459</span> <span class="preprocessor">#endif </span><span class="comment">/* UCX_ARRAY_H */</span><span class="preprocessor"></span></div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span> </div><div class="ttc" id="array_8h_html_aea01731ad94ea73c0c8fb1d1b7a35fcf"><div class="ttname"><a href="array_8h.html#aea01731ad94ea73c0c8fb1d1b7a35fcf">ucx_array_append_from</a></div><div class="ttdeci">int ucx_array_append_from(UcxArray *array, void *data, size_t count)</div><div class="ttdoc">Inserts elements at the end of the array. </div><div class="ttdef"><b>Definition:</b> array.c:206</div></div> <div class="ttc" id="array_8h_html_a95b52acc2193b5c33cf0eaa4f2082477"><div class="ttname"><a href="array_8h.html#a95b52acc2193b5c33cf0eaa4f2082477">ucx_array_prepend_from</a></div><div class="ttdeci">int ucx_array_prepend_from(UcxArray *array, void *data, size_t count)</div><div class="ttdoc">Inserts elements at the beginning of the array. </div><div class="ttdef"><b>Definition:</b> array.c:221</div></div> <div class="ttc" id="array_8h_html_ab0cbf243824aaebee48277315e03afce"><div class="ttname"><a href="array_8h.html#ab0cbf243824aaebee48277315e03afce">ucx_array_grow</a></div><div class="ttdeci">int ucx_array_grow(UcxArray *array, size_t count)</div><div class="ttdoc">Resizes the capacity, if the specified number of elements would not fit. </div><div class="ttdef"><b>Definition:</b> array.c:465</div></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="array_8h_html_a2daf50e80aee9bccebee876a7efd2dfc"><div class="ttname"><a href="array_8h.html#a2daf50e80aee9bccebee876a7efd2dfc">ucx_array_shrink</a></div><div class="ttdeci">int ucx_array_shrink(UcxArray *array)</div><div class="ttdoc">Shrinks the memory to exactly fit the contents. </div><div class="ttdef"><b>Definition:</b> array.c:418</div></div> <div class="ttc" id="array_8h_html_aa5a0bf3d3f0df6406beb0e569021cc28"><div class="ttname"><a href="array_8h.html#aa5a0bf3d3f0df6406beb0e569021cc28">ucx_array_concat</a></div><div class="ttdeci">int ucx_array_concat(UcxArray *array1, const UcxArray *array2)</div><div class="ttdoc">Concatenates two arrays. </div><div class="ttdef"><b>Definition:</b> array.c:259</div></div> <div class="ttc" id="ucx_8h_html"><div class="ttname"><a href="ucx_8h.html">ucx.h</a></div><div class="ttdoc">Main UCX Header providing most common definitions. </div></div> <div class="ttc" id="structUcxArray_html_a7ed074887908e45bde7e1fbc67b31c18"><div class="ttname"><a href="structUcxArray.html#a7ed074887908e45bde7e1fbc67b31c18">UcxArray::capacity</a></div><div class="ttdeci">size_t capacity</div><div class="ttdoc">The current capacity of the array. </div><div class="ttdef"><b>Definition:</b> array.h:53</div></div> <div class="ttc" id="array_8h_html_ad0a8d76980cf1c1910e64a245803fb9a"><div class="ttname"><a href="array_8h.html#ad0a8d76980cf1c1910e64a245803fb9a">ucx_array_util_set_a</a></div><div class="ttdeci">int ucx_array_util_set_a(UcxAllocator *alloc, void **array, size_t *capacity, size_t elmsize, size_t idx, void *data)</div><div class="ttdoc">Sets an element in an arbitrary user defined array. </div><div class="ttdef"><b>Definition:</b> array.c:72</div></div> <div class="ttc" id="array_8h_html_a43292b448adb1741677aa8c578bcc201"><div class="ttname"><a href="array_8h.html#a43292b448adb1741677aa8c578bcc201">ucx_array_equals</a></div><div class="ttdeci">int ucx_array_equals(UcxArray const *array1, UcxArray const *array2, cmp_func cmpfnc, void *data)</div><div class="ttdoc">Compares two UCX arrays element-wise by using a compare function. </div><div class="ttdef"><b>Definition:</b> array.c:166</div></div> <div class="ttc" id="array_8h_html_a2451e61ebb15a7ba1c1319267ba75b8c"><div class="ttname"><a href="array_8h.html#a2451e61ebb15a7ba1c1319267ba75b8c">ucx_array_init_a</a></div><div class="ttdeci">void ucx_array_init_a(UcxArray *array, size_t capacity, size_t elemsize, UcxAllocator *allocator)</div><div class="ttdoc">Initializes a UCX array structure using the specified allocator. </div><div class="ttdef"><b>Definition:</b> array.c:136</div></div> <div class="ttc" id="array_8h_html_add773514569b872a6624381b4b6af52c"><div class="ttname"><a href="array_8h.html#add773514569b872a6624381b4b6af52c">ucx_array_sort</a></div><div class="ttdeci">void ucx_array_sort(UcxArray *array, cmp_func cmpfnc, void *data)</div><div class="ttdoc">Sorts a UcxArray with the best available sort algorithm. </div><div class="ttdef"><b>Definition:</b> array.c:395</div></div> <div class="ttc" id="structUcxArray_html_a04d2b03d0a45af1fab19b4216602075a"><div class="ttname"><a href="structUcxArray.html#a04d2b03d0a45af1fab19b4216602075a">UcxArray::data</a></div><div class="ttdeci">void * data</div><div class="ttdoc">A pointer to the data. </div><div class="ttdef"><b>Definition:</b> array.h:65</div></div> <div class="ttc" id="array_8h_html_a994a2fbf1c33a3833e2a70cd9a4352b7"><div class="ttname"><a href="array_8h.html#a994a2fbf1c33a3833e2a70cd9a4352b7">ucx_array_new</a></div><div class="ttdeci">UcxArray * ucx_array_new(size_t capacity, size_t elemsize)</div><div class="ttdoc">Creates a new UCX array with the given capacity and element size. </div><div class="ttdef"><b>Definition:</b> array.c:119</div></div> <div class="ttc" id="array_8h_html_aa45eac6b697f83adac81c0860cf306b8"><div class="ttname"><a href="array_8h.html#aa45eac6b697f83adac81c0860cf306b8">ucx_array_remove</a></div><div class="ttdeci">void ucx_array_remove(UcxArray *array, size_t index)</div><div class="ttdoc">Removes an element from the array. </div><div class="ttdef"><b>Definition:</b> array.c:400</div></div> <div class="ttc" id="structUcxArray_html_a2ef31303b7548b9aa8e2b9187e295212"><div class="ttname"><a href="structUcxArray.html#a2ef31303b7548b9aa8e2b9187e295212">UcxArray::allocator</a></div><div class="ttdeci">UcxAllocator * allocator</div><div class="ttdoc">The allocator used for the data. </div><div class="ttdef"><b>Definition:</b> array.h:69</div></div> <div class="ttc" id="array_8h_html_a1bb545d065358d265d80d815ba382a28"><div class="ttname"><a href="array_8h.html#a1bb545d065358d265d80d815ba382a28">ucx_array_set_from</a></div><div class="ttdeci">int ucx_array_set_from(UcxArray *array, size_t index, void *data, size_t count)</div><div class="ttdoc">Sets elements starting at the specified index. </div><div class="ttdef"><b>Definition:</b> array.c:240</div></div> <div class="ttc" id="array_8h_html_a548d81b07612bae3ba8c4c4b49104b8e"><div class="ttname"><a href="array_8h.html#a548d81b07612bae3ba8c4c4b49104b8e">ucx_array_remove_fast</a></div><div class="ttdeci">void ucx_array_remove_fast(UcxArray *array, size_t index)</div><div class="ttdoc">Removes an element from the array. </div><div class="ttdef"><b>Definition:</b> array.c:409</div></div> <div class="ttc" id="structUcxAllocator_html"><div class="ttname"><a href="structUcxAllocator.html">UcxAllocator</a></div><div class="ttdoc">UCX allocator data structure containing memory management functions. </div><div class="ttdef"><b>Definition:</b> allocator.h:88</div></div> <div class="ttc" id="array_8h_html_a5241058cd2329147bc5b1593ae7e51dc"><div class="ttname"><a href="array_8h.html#a5241058cd2329147bc5b1593ae7e51dc">ucx_array_contains</a></div><div class="ttdeci">int ucx_array_contains(UcxArray const *array, void *elem, cmp_func cmpfnc, void *data)</div><div class="ttdoc">Checks, if an array contains a specific element. </div><div class="ttdef"><b>Definition:</b> array.c:309</div></div> <div class="ttc" id="array_8h_html_ae7bdbed94afee9b20b38b95e3ab470f0"><div class="ttname"><a href="array_8h.html#ae7bdbed94afee9b20b38b95e3ab470f0">ucx_array_find</a></div><div class="ttdeci">size_t ucx_array_find(UcxArray const *array, void *elem, cmp_func cmpfnc, void *data)</div><div class="ttdoc">Returns the index of an element containing the specified data. </div><div class="ttdef"><b>Definition:</b> array.c:286</div></div> <div class="ttc" id="structUcxArray_html"><div class="ttname"><a href="structUcxArray.html">UcxArray</a></div><div class="ttdoc">UCX array type. </div><div class="ttdef"><b>Definition:</b> array.h:49</div></div> <div class="ttc" id="structUcxArray_html_a20c11f2c9048cda80062842b7c094e20"><div class="ttname"><a href="structUcxArray.html#a20c11f2c9048cda80062842b7c094e20">UcxArray::size</a></div><div class="ttdeci">size_t size</div><div class="ttdoc">The actual number of elements in the array. </div><div class="ttdef"><b>Definition:</b> array.h:57</div></div> <div class="ttc" id="array_8h_html_a8e83681d8d5d8cddbf10f63ce5be4c10"><div class="ttname"><a href="array_8h.html#a8e83681d8d5d8cddbf10f63ce5be4c10">ucx_array_destroy</a></div><div class="ttdeci">void ucx_array_destroy(UcxArray *array)</div><div class="ttdoc">Destroys the array. </div><div class="ttdef"><b>Definition:</b> array.c:194</div></div> <div class="ttc" id="array_8h_html_ad708b333c0c1b02c998309a58ea65e31"><div class="ttname"><a href="array_8h.html#ad708b333c0c1b02c998309a58ea65e31">ucx_array_util_setptr_a</a></div><div class="ttdeci">int ucx_array_util_setptr_a(UcxAllocator *alloc, void **array, size_t *capacity, size_t idx, void *ptr)</div><div class="ttdoc">Stores a pointer in an arbitrary user defined array. </div><div class="ttdef"><b>Definition:</b> array.c:112</div></div> <div class="ttc" id="allocator_8h_html"><div class="ttname"><a href="allocator_8h.html">allocator.h</a></div><div class="ttdoc">Allocator for custom memory management. </div></div> <div class="ttc" id="array_8h_html_ac01ee914468a16f470bf3071fffbe438"><div class="ttname"><a href="array_8h.html#ac01ee914468a16f470bf3071fffbe438">ucx_array_free</a></div><div class="ttdeci">void ucx_array_free(UcxArray *array)</div><div class="ttdoc">Destroys and frees the array. </div><div class="ttdef"><b>Definition:</b> array.c:201</div></div> <div class="ttc" id="array_8h_html_a4a8c273370e4a3a3e2624e364f5ab410"><div class="ttname"><a href="array_8h.html#a4a8c273370e4a3a3e2624e364f5ab410">ucx_array_clone</a></div><div class="ttdeci">int ucx_array_clone(UcxArray *dest, UcxArray const *src)</div><div class="ttdoc">Creates an shallow copy of an array. </div><div class="ttdef"><b>Definition:</b> array.c:151</div></div> <div class="ttc" id="array_8h_html_aa698085fd1a8b70d6b709999c51b49e8"><div class="ttname"><a href="array_8h.html#aa698085fd1a8b70d6b709999c51b49e8">ucx_array_at</a></div><div class="ttdeci">void * ucx_array_at(UcxArray const *array, size_t index)</div><div class="ttdoc">Returns a pointer to the array element at the specified index. </div><div class="ttdef"><b>Definition:</b> array.c:280</div></div> <div class="ttc" id="array_8h_html_a27762e7c06a6c781015e3c8ceeee0ce3"><div class="ttname"><a href="array_8h.html#a27762e7c06a6c781015e3c8ceeee0ce3">ucx_array_resize</a></div><div class="ttdeci">int ucx_array_resize(UcxArray *array, size_t capacity)</div><div class="ttdoc">Sets the capacity of the array. </div><div class="ttdef"><b>Definition:</b> array.c:430</div></div> <div class="ttc" id="array_8h_html_ad921e85c28ffae32230777a53c5037e5"><div class="ttname"><a href="array_8h.html#ad921e85c28ffae32230777a53c5037e5">ucx_array_init</a></div><div class="ttdeci">void ucx_array_init(UcxArray *array, size_t capacity, size_t elemsize)</div><div class="ttdoc">Initializes a UCX array structure with the given capacity and element size. </div><div class="ttdef"><b>Definition:</b> array.c:132</div></div> <div class="ttc" id="structUcxArray_html_ac4e9ecdf8a8d010644f6e44dfef8190f"><div class="ttname"><a href="structUcxArray.html#ac4e9ecdf8a8d010644f6e44dfef8190f">UcxArray::elemsize</a></div><div class="ttdeci">size_t elemsize</div><div class="ttdoc">The size of an individual element in bytes. </div><div class="ttdef"><b>Definition:</b> array.h:61</div></div> <div class="ttc" id="array_8h_html_a1c3bf8433c1de3c933f3854ab297fe1d"><div class="ttname"><a href="array_8h.html#a1c3bf8433c1de3c933f3854ab297fe1d">ucx_array_reserve</a></div><div class="ttdeci">int ucx_array_reserve(UcxArray *array, size_t capacity)</div><div class="ttdoc">Resizes the array only, if the capacity is insufficient. </div><div class="ttdef"><b>Definition:</b> array.c:449</div></div> <div class="ttc" id="array_8h_html_a177170258c215eb2e4f5a32e59f0cb1b"><div class="ttname"><a href="array_8h.html#a177170258c215eb2e4f5a32e59f0cb1b">ucx_array_new_a</a></div><div class="ttdeci">UcxArray * ucx_array_new_a(size_t capacity, size_t elemsize, UcxAllocator *allocator)</div><div class="ttdoc">Creates a new UCX array using the specified allocator. </div><div class="ttdef"><b>Definition:</b> array.c:123</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  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>