Wed, 27 Dec 2023 17:19:54 +0100
add make target to automatically gather coverage info
<!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 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> | <a href="#define-members">Macros</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">array.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>Dynamically allocated array implementation. <a href="#details">More...</a></p> <div class="textblock"><code>#include "<a class="el" href="ucx_8h_source.html">ucx.h</a>"</code><br /> <code>#include "<a class="el" href="allocator_8h_source.html">allocator.h</a>"</code><br /> </div> <p><a href="array_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  </td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxArray.html">UcxArray</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">UCX array type. <a href="structUcxArray.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </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:a1d959c29af3125bdd37cde3a554e729c"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a1d959c29af3125bdd37cde3a554e729c">ucx_array_util_set</a>(array, capacity, elmsize, idx, data)</td></tr> <tr class="memdesc:a1d959c29af3125bdd37cde3a554e729c"><td class="mdescLeft"> </td><td class="mdescRight">Sets an element in an arbitrary user defined array. <a href="#a1d959c29af3125bdd37cde3a554e729c">More...</a><br /></td></tr> <tr class="separator:a1d959c29af3125bdd37cde3a554e729c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a59a5b342965e790945f9c7a3f86b99f9"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a59a5b342965e790945f9c7a3f86b99f9">ucx_array_util_setptr</a>(array, capacity, idx, ptr)</td></tr> <tr class="memdesc:a59a5b342965e790945f9c7a3f86b99f9"><td class="mdescLeft"> </td><td class="mdescRight">Stores a pointer in an arbitrary user defined array. <a href="#a59a5b342965e790945f9c7a3f86b99f9">More...</a><br /></td></tr> <tr class="separator:a59a5b342965e790945f9c7a3f86b99f9"><td class="memSeparator" colspan="2"> </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:ad0a8d76980cf1c1910e64a245803fb9a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#ad0a8d76980cf1c1910e64a245803fb9a">ucx_array_util_set_a</a> (<a class="el" href="structUcxAllocator.html">UcxAllocator</a> *alloc, void **array, size_t *capacity, size_t elmsize, size_t idx, void *data)</td></tr> <tr class="memdesc:ad0a8d76980cf1c1910e64a245803fb9a"><td class="mdescLeft"> </td><td class="mdescRight">Sets an element in an arbitrary user defined array. <a href="#ad0a8d76980cf1c1910e64a245803fb9a">More...</a><br /></td></tr> <tr class="separator:ad0a8d76980cf1c1910e64a245803fb9a"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ad708b333c0c1b02c998309a58ea65e31"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#ad708b333c0c1b02c998309a58ea65e31">ucx_array_util_setptr_a</a> (<a class="el" href="structUcxAllocator.html">UcxAllocator</a> *alloc, void **array, size_t *capacity, size_t idx, void *ptr)</td></tr> <tr class="memdesc:ad708b333c0c1b02c998309a58ea65e31"><td class="mdescLeft"> </td><td class="mdescRight">Stores a pointer in an arbitrary user defined array. <a href="#ad708b333c0c1b02c998309a58ea65e31">More...</a><br /></td></tr> <tr class="separator:ad708b333c0c1b02c998309a58ea65e31"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a994a2fbf1c33a3833e2a70cd9a4352b7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxArray.html">UcxArray</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a994a2fbf1c33a3833e2a70cd9a4352b7">ucx_array_new</a> (size_t capacity, size_t elemsize)</td></tr> <tr class="memdesc:a994a2fbf1c33a3833e2a70cd9a4352b7"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new UCX array with the given capacity and element size. <a href="#a994a2fbf1c33a3833e2a70cd9a4352b7">More...</a><br /></td></tr> <tr class="separator:a994a2fbf1c33a3833e2a70cd9a4352b7"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a177170258c215eb2e4f5a32e59f0cb1b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxArray.html">UcxArray</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a177170258c215eb2e4f5a32e59f0cb1b">ucx_array_new_a</a> (size_t capacity, size_t elemsize, <a class="el" href="structUcxAllocator.html">UcxAllocator</a> *allocator)</td></tr> <tr class="memdesc:a177170258c215eb2e4f5a32e59f0cb1b"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new UCX array using the specified allocator. <a href="#a177170258c215eb2e4f5a32e59f0cb1b">More...</a><br /></td></tr> <tr class="separator:a177170258c215eb2e4f5a32e59f0cb1b"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ad921e85c28ffae32230777a53c5037e5"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#ad921e85c28ffae32230777a53c5037e5">ucx_array_init</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t capacity, size_t elemsize)</td></tr> <tr class="memdesc:ad921e85c28ffae32230777a53c5037e5"><td class="mdescLeft"> </td><td class="mdescRight">Initializes a UCX array structure with the given capacity and element size. <a href="#ad921e85c28ffae32230777a53c5037e5">More...</a><br /></td></tr> <tr class="separator:ad921e85c28ffae32230777a53c5037e5"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a2451e61ebb15a7ba1c1319267ba75b8c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a2451e61ebb15a7ba1c1319267ba75b8c">ucx_array_init_a</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t capacity, size_t elemsize, <a class="el" href="structUcxAllocator.html">UcxAllocator</a> *allocator)</td></tr> <tr class="memdesc:a2451e61ebb15a7ba1c1319267ba75b8c"><td class="mdescLeft"> </td><td class="mdescRight">Initializes a UCX array structure using the specified allocator. <a href="#a2451e61ebb15a7ba1c1319267ba75b8c">More...</a><br /></td></tr> <tr class="separator:a2451e61ebb15a7ba1c1319267ba75b8c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a4a8c273370e4a3a3e2624e364f5ab410"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a4a8c273370e4a3a3e2624e364f5ab410">ucx_array_clone</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *dest, <a class="el" href="structUcxArray.html">UcxArray</a> const *src)</td></tr> <tr class="memdesc:a4a8c273370e4a3a3e2624e364f5ab410"><td class="mdescLeft"> </td><td class="mdescRight">Creates an shallow copy of an array. <a href="#a4a8c273370e4a3a3e2624e364f5ab410">More...</a><br /></td></tr> <tr class="separator:a4a8c273370e4a3a3e2624e364f5ab410"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a43292b448adb1741677aa8c578bcc201"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a43292b448adb1741677aa8c578bcc201">ucx_array_equals</a> (<a class="el" href="structUcxArray.html">UcxArray</a> const *array1, <a class="el" href="structUcxArray.html">UcxArray</a> const *array2, <a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, void *data)</td></tr> <tr class="memdesc:a43292b448adb1741677aa8c578bcc201"><td class="mdescLeft"> </td><td class="mdescRight">Compares two UCX arrays element-wise by using a compare function. <a href="#a43292b448adb1741677aa8c578bcc201">More...</a><br /></td></tr> <tr class="separator:a43292b448adb1741677aa8c578bcc201"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8e83681d8d5d8cddbf10f63ce5be4c10"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a8e83681d8d5d8cddbf10f63ce5be4c10">ucx_array_destroy</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array)</td></tr> <tr class="memdesc:a8e83681d8d5d8cddbf10f63ce5be4c10"><td class="mdescLeft"> </td><td class="mdescRight">Destroys the array. <a href="#a8e83681d8d5d8cddbf10f63ce5be4c10">More...</a><br /></td></tr> <tr class="separator:a8e83681d8d5d8cddbf10f63ce5be4c10"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ac01ee914468a16f470bf3071fffbe438"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#ac01ee914468a16f470bf3071fffbe438">ucx_array_free</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array)</td></tr> <tr class="memdesc:ac01ee914468a16f470bf3071fffbe438"><td class="mdescLeft"> </td><td class="mdescRight">Destroys and frees the array. <a href="#ac01ee914468a16f470bf3071fffbe438">More...</a><br /></td></tr> <tr class="separator:ac01ee914468a16f470bf3071fffbe438"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aea01731ad94ea73c0c8fb1d1b7a35fcf"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#aea01731ad94ea73c0c8fb1d1b7a35fcf">ucx_array_append_from</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, void *data, size_t count)</td></tr> <tr class="memdesc:aea01731ad94ea73c0c8fb1d1b7a35fcf"><td class="mdescLeft"> </td><td class="mdescRight">Inserts elements at the end of the array. <a href="#aea01731ad94ea73c0c8fb1d1b7a35fcf">More...</a><br /></td></tr> <tr class="separator:aea01731ad94ea73c0c8fb1d1b7a35fcf"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a95b52acc2193b5c33cf0eaa4f2082477"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a95b52acc2193b5c33cf0eaa4f2082477">ucx_array_prepend_from</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, void *data, size_t count)</td></tr> <tr class="memdesc:a95b52acc2193b5c33cf0eaa4f2082477"><td class="mdescLeft"> </td><td class="mdescRight">Inserts elements at the beginning of the array. <a href="#a95b52acc2193b5c33cf0eaa4f2082477">More...</a><br /></td></tr> <tr class="separator:a95b52acc2193b5c33cf0eaa4f2082477"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1bb545d065358d265d80d815ba382a28"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a1bb545d065358d265d80d815ba382a28">ucx_array_set_from</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t index, void *data, size_t count)</td></tr> <tr class="memdesc:a1bb545d065358d265d80d815ba382a28"><td class="mdescLeft"> </td><td class="mdescRight">Sets elements starting at the specified index. <a href="#a1bb545d065358d265d80d815ba382a28">More...</a><br /></td></tr> <tr class="separator:a1bb545d065358d265d80d815ba382a28"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aa5a0bf3d3f0df6406beb0e569021cc28"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#aa5a0bf3d3f0df6406beb0e569021cc28">ucx_array_concat</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array1, const <a class="el" href="structUcxArray.html">UcxArray</a> *array2)</td></tr> <tr class="memdesc:aa5a0bf3d3f0df6406beb0e569021cc28"><td class="mdescLeft"> </td><td class="mdescRight">Concatenates two arrays. <a href="#aa5a0bf3d3f0df6406beb0e569021cc28">More...</a><br /></td></tr> <tr class="separator:aa5a0bf3d3f0df6406beb0e569021cc28"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aa698085fd1a8b70d6b709999c51b49e8"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#aa698085fd1a8b70d6b709999c51b49e8">ucx_array_at</a> (<a class="el" href="structUcxArray.html">UcxArray</a> const *array, size_t index)</td></tr> <tr class="memdesc:aa698085fd1a8b70d6b709999c51b49e8"><td class="mdescLeft"> </td><td class="mdescRight">Returns a pointer to the array element at the specified index. <a href="#aa698085fd1a8b70d6b709999c51b49e8">More...</a><br /></td></tr> <tr class="separator:aa698085fd1a8b70d6b709999c51b49e8"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ae7bdbed94afee9b20b38b95e3ab470f0"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#ae7bdbed94afee9b20b38b95e3ab470f0">ucx_array_find</a> (<a class="el" href="structUcxArray.html">UcxArray</a> const *array, void *elem, <a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, void *data)</td></tr> <tr class="memdesc:ae7bdbed94afee9b20b38b95e3ab470f0"><td class="mdescLeft"> </td><td class="mdescRight">Returns the index of an element containing the specified data. <a href="#ae7bdbed94afee9b20b38b95e3ab470f0">More...</a><br /></td></tr> <tr class="separator:ae7bdbed94afee9b20b38b95e3ab470f0"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a5241058cd2329147bc5b1593ae7e51dc"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a5241058cd2329147bc5b1593ae7e51dc">ucx_array_contains</a> (<a class="el" href="structUcxArray.html">UcxArray</a> const *array, void *elem, <a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, void *data)</td></tr> <tr class="memdesc:a5241058cd2329147bc5b1593ae7e51dc"><td class="mdescLeft"> </td><td class="mdescRight">Checks, if an array contains a specific element. <a href="#a5241058cd2329147bc5b1593ae7e51dc">More...</a><br /></td></tr> <tr class="separator:a5241058cd2329147bc5b1593ae7e51dc"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:add773514569b872a6624381b4b6af52c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#add773514569b872a6624381b4b6af52c">ucx_array_sort</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, <a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfnc, void *data)</td></tr> <tr class="memdesc:add773514569b872a6624381b4b6af52c"><td class="mdescLeft"> </td><td class="mdescRight">Sorts a <a class="el" href="structUcxArray.html" title="UCX array type. ">UcxArray</a> with the best available sort algorithm. <a href="#add773514569b872a6624381b4b6af52c">More...</a><br /></td></tr> <tr class="separator:add773514569b872a6624381b4b6af52c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aa45eac6b697f83adac81c0860cf306b8"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#aa45eac6b697f83adac81c0860cf306b8">ucx_array_remove</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t index)</td></tr> <tr class="memdesc:aa45eac6b697f83adac81c0860cf306b8"><td class="mdescLeft"> </td><td class="mdescRight">Removes an element from the array. <a href="#aa45eac6b697f83adac81c0860cf306b8">More...</a><br /></td></tr> <tr class="separator:aa45eac6b697f83adac81c0860cf306b8"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a548d81b07612bae3ba8c4c4b49104b8e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a548d81b07612bae3ba8c4c4b49104b8e">ucx_array_remove_fast</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t index)</td></tr> <tr class="memdesc:a548d81b07612bae3ba8c4c4b49104b8e"><td class="mdescLeft"> </td><td class="mdescRight">Removes an element from the array. <a href="#a548d81b07612bae3ba8c4c4b49104b8e">More...</a><br /></td></tr> <tr class="separator:a548d81b07612bae3ba8c4c4b49104b8e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a2daf50e80aee9bccebee876a7efd2dfc"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a2daf50e80aee9bccebee876a7efd2dfc">ucx_array_shrink</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array)</td></tr> <tr class="memdesc:a2daf50e80aee9bccebee876a7efd2dfc"><td class="mdescLeft"> </td><td class="mdescRight">Shrinks the memory to exactly fit the contents. <a href="#a2daf50e80aee9bccebee876a7efd2dfc">More...</a><br /></td></tr> <tr class="separator:a2daf50e80aee9bccebee876a7efd2dfc"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a27762e7c06a6c781015e3c8ceeee0ce3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a27762e7c06a6c781015e3c8ceeee0ce3">ucx_array_resize</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t capacity)</td></tr> <tr class="memdesc:a27762e7c06a6c781015e3c8ceeee0ce3"><td class="mdescLeft"> </td><td class="mdescRight">Sets the capacity of the array. <a href="#a27762e7c06a6c781015e3c8ceeee0ce3">More...</a><br /></td></tr> <tr class="separator:a27762e7c06a6c781015e3c8ceeee0ce3"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1c3bf8433c1de3c933f3854ab297fe1d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#a1c3bf8433c1de3c933f3854ab297fe1d">ucx_array_reserve</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t capacity)</td></tr> <tr class="memdesc:a1c3bf8433c1de3c933f3854ab297fe1d"><td class="mdescLeft"> </td><td class="mdescRight">Resizes the array only, if the capacity is insufficient. <a href="#a1c3bf8433c1de3c933f3854ab297fe1d">More...</a><br /></td></tr> <tr class="separator:a1c3bf8433c1de3c933f3854ab297fe1d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ab0cbf243824aaebee48277315e03afce"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="array_8h.html#ab0cbf243824aaebee48277315e03afce">ucx_array_grow</a> (<a class="el" href="structUcxArray.html">UcxArray</a> *array, size_t count)</td></tr> <tr class="memdesc:ab0cbf243824aaebee48277315e03afce"><td class="mdescLeft"> </td><td class="mdescRight">Resizes the capacity, if the specified number of elements would not fit. <a href="#ab0cbf243824aaebee48277315e03afce">More...</a><br /></td></tr> <tr class="separator:ab0cbf243824aaebee48277315e03afce"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Dynamically allocated array implementation. </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="a1d959c29af3125bdd37cde3a554e729c"></a> <h2 class="memtitle"><span class="permalink"><a href="#a1d959c29af3125bdd37cde3a554e729c">◆ </a></span>ucx_array_util_set</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define ucx_array_util_set</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">array, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">capacity, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">elmsize, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">idx, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">data </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <b>Value:</b><div class="fragment"><div class="line"><a class="code" href="array_8h.html#ad0a8d76980cf1c1910e64a245803fb9a">ucx_array_util_set_a</a>(<a class="code" href="allocator_8h.html#a98d2f1b341118b7a0e341fda5d8b2ebf">ucx_default_allocator</a>(), (<span class="keywordtype">void</span>**)(array), capacity, \</div><div class="line"> elmsize, idx, data)</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="allocator_8h_html_a98d2f1b341118b7a0e341fda5d8b2ebf"><div class="ttname"><a href="allocator_8h.html#a98d2f1b341118b7a0e341fda5d8b2ebf">ucx_default_allocator</a></div><div class="ttdeci">UcxAllocator * ucx_default_allocator()</div><div class="ttdoc">Returns a pointer to the default allocator. </div><div class="ttdef"><b>Definition:</b> allocator.c:41</div></div> </div><!-- fragment --> <p>Sets an element in an arbitrary user defined array. </p> <p>The data is copied from the specified data location.</p> <p>If the capacity is insufficient, the array is automatically reallocated and the possibly new pointer is stored in the <code>array</code> argument.</p> <p>On reallocation the capacity of the array is doubled until it is sufficient. The new capacity is stored back to <code>capacity</code>.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer to location of the array pointer </td></tr> <tr><td class="paramname">capacity</td><td>a pointer to the capacity </td></tr> <tr><td class="paramname">elmsize</td><td>the size of each element </td></tr> <tr><td class="paramname">idx</td><td>the index of the element to set </td></tr> <tr><td class="paramname">data</td><td>a pointer to the element data </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success or non-zero on error (errno will be set) </dd></dl> </div> </div> <a id="a59a5b342965e790945f9c7a3f86b99f9"></a> <h2 class="memtitle"><span class="permalink"><a href="#a59a5b342965e790945f9c7a3f86b99f9">◆ </a></span>ucx_array_util_setptr</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define ucx_array_util_setptr</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">array, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">capacity, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">idx, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">ptr </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <b>Value:</b><div class="fragment"><div class="line"><a class="code" href="array_8h.html#ad708b333c0c1b02c998309a58ea65e31">ucx_array_util_setptr_a</a>(<a class="code" href="allocator_8h.html#a98d2f1b341118b7a0e341fda5d8b2ebf">ucx_default_allocator</a>(), (<span class="keywordtype">void</span>**)(array), \</div><div class="line"> capacity, idx, ptr)</div><div class="ttc" id="allocator_8h_html_a98d2f1b341118b7a0e341fda5d8b2ebf"><div class="ttname"><a href="allocator_8h.html#a98d2f1b341118b7a0e341fda5d8b2ebf">ucx_default_allocator</a></div><div class="ttdeci">UcxAllocator * ucx_default_allocator()</div><div class="ttdoc">Returns a pointer to the default allocator. </div><div class="ttdef"><b>Definition:</b> allocator.c:41</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><!-- fragment --> <p>Stores a pointer in an arbitrary user defined array. </p> <p>The element size of the array must be sizeof(void*).</p> <p>If the capacity is insufficient, the array is automatically reallocated and the possibly new pointer is stored in the <code>array</code> argument.</p> <p>On reallocation the capacity of the array is doubled until it is sufficient. The new capacity is stored back to <code>capacity</code>.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer to location of the array pointer </td></tr> <tr><td class="paramname">capacity</td><td>a pointer to the capacity </td></tr> <tr><td class="paramname">idx</td><td>the index of the element to set </td></tr> <tr><td class="paramname">ptr</td><td>the pointer to store </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success or non-zero on error (errno will be set) </dd></dl> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a id="aea01731ad94ea73c0c8fb1d1b7a35fcf"></a> <h2 class="memtitle"><span class="permalink"><a href="#aea01731ad94ea73c0c8fb1d1b7a35fcf">◆ </a></span>ucx_array_append_from()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_append_from </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>count</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Inserts elements at the end of the array. </p> <p>This is an O(1) operation. The array will automatically grow, if the capacity is exceeded. If a pointer to data is provided, the data is copied into the array with memcpy(). Otherwise the new elements are completely zeroed.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer the array where to append the data </td></tr> <tr><td class="paramname">data</td><td>a pointer to the data to insert (may be <code>NULL</code>) </td></tr> <tr><td class="paramname">count</td><td>number of elements to copy from data (if data is <code>NULL</code>, zeroed elements are appended) </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if a reallocation was necessary but failed </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="array_8h.html#a1bb545d065358d265d80d815ba382a28" title="Sets elements starting at the specified index. ">ucx_array_set_from()</a> </dd> <dd> ucx_array_append() </dd></dl> </div> </div> <a id="aa698085fd1a8b70d6b709999c51b49e8"></a> <h2 class="memtitle"><span class="permalink"><a href="#aa698085fd1a8b70d6b709999c51b49e8">◆ </a></span>ucx_array_at()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* ucx_array_at </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> const * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>index</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Returns a pointer to the array element at the specified index. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the array to retrieve the element from </td></tr> <tr><td class="paramname">index</td><td>index of the element to return </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to the element at the specified index or <code>NULL</code>, if the index is greater than the array size </dd></dl> </div> </div> <a id="a4a8c273370e4a3a3e2624e364f5ab410"></a> <h2 class="memtitle"><span class="permalink"><a href="#a4a8c273370e4a3a3e2624e364f5ab410">◆ </a></span>ucx_array_clone()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_clone </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> const * </td> <td class="paramname"><em>src</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Creates an shallow copy of an array. </p> <p>This function clones the specified array by using memcpy(). If the destination capacity is insufficient, an automatic reallocation is attempted.</p> <p>Note: if the destination array is uninitialized, the behavior is undefined.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">dest</td><td>the array to copy to </td></tr> <tr><td class="paramname">src</td><td>the array to copy from </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero on reallocation failure. </dd></dl> </div> </div> <a id="aa5a0bf3d3f0df6406beb0e569021cc28"></a> <h2 class="memtitle"><span class="permalink"><a href="#aa5a0bf3d3f0df6406beb0e569021cc28">◆ </a></span>ucx_array_concat()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_concat </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array2</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Concatenates two arrays. </p> <p>The contents of the second array are appended to the first array in one single operation. The second array is otherwise left untouched.</p> <p>The first array may grow automatically. If this fails, both arrays remain unmodified.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array1</td><td>first array </td></tr> <tr><td class="paramname">array2</td><td>second array </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if reallocation was necessary but failed or the element size does not match </dd></dl> </div> </div> <a id="a5241058cd2329147bc5b1593ae7e51dc"></a> <h2 class="memtitle"><span class="permalink"><a href="#a5241058cd2329147bc5b1593ae7e51dc">◆ </a></span>ucx_array_contains()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_contains </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> const * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>elem</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> </td> <td class="paramname"><em>cmpfnc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Checks, if an array contains a specific element. </p> <p>An element is found, if <a class="el" href="array_8h.html#ae7bdbed94afee9b20b38b95e3ab470f0" title="Returns the index of an element containing the specified data. ">ucx_array_find()</a> returns a value less than the size.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the array where to search for the data </td></tr> <tr><td class="paramname">elem</td><td>the element data </td></tr> <tr><td class="paramname">cmpfnc</td><td>the compare function </td></tr> <tr><td class="paramname">data</td><td>additional data for the compare function </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>1, if and only if the array contains the specified element data </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="array_8h.html#ae7bdbed94afee9b20b38b95e3ab470f0" title="Returns the index of an element containing the specified data. ">ucx_array_find()</a> </dd></dl> </div> </div> <a id="a8e83681d8d5d8cddbf10f63ce5be4c10"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8e83681d8d5d8cddbf10f63ce5be4c10">◆ </a></span>ucx_array_destroy()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_array_destroy </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destroys the array. </p> <p>The data is freed and both capacity and count are reset to zero. If the array structure itself has been dynamically allocated, it has to be freed separately.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the array to destroy </td></tr> </table> </dd> </dl> </div> </div> <a id="a43292b448adb1741677aa8c578bcc201"></a> <h2 class="memtitle"><span class="permalink"><a href="#a43292b448adb1741677aa8c578bcc201">◆ </a></span>ucx_array_equals()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_equals </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> const * </td> <td class="paramname"><em>array1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> const * </td> <td class="paramname"><em>array2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> </td> <td class="paramname"><em>cmpfnc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Compares two UCX arrays element-wise by using a compare function. </p> <p>Elements of the two specified arrays are compared by using the specified compare function and the additional data. The type and content of this additional data depends on the <a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791" title="Function pointer to a compare function. ">cmp_func()</a> used.</p> <p>This function always returns zero, if the element sizes of the arrays do not match and performs no comparisons in this case.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array1</td><td>the first array </td></tr> <tr><td class="paramname">array2</td><td>the second array </td></tr> <tr><td class="paramname">cmpfnc</td><td>the compare function </td></tr> <tr><td class="paramname">data</td><td>additional data for the compare function </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>1, if and only if the two arrays equal element-wise, 0 otherwise </dd></dl> </div> </div> <a id="ae7bdbed94afee9b20b38b95e3ab470f0"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae7bdbed94afee9b20b38b95e3ab470f0">◆ </a></span>ucx_array_find()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">size_t ucx_array_find </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> const * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>elem</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> </td> <td class="paramname"><em>cmpfnc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Returns the index of an element containing the specified data. </p> <p>This function uses a <a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791" title="Function pointer to a compare function. ">cmp_func()</a> to compare the data of each list element with the specified data. If no cmp_func is provided, memcmp() is used.</p> <p>If the array contains the data more than once, the index of the first occurrence is returned. If the array does not contain the data, the size of array is returned.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the array where to search for the data </td></tr> <tr><td class="paramname">elem</td><td>the element data </td></tr> <tr><td class="paramname">cmpfnc</td><td>the compare function </td></tr> <tr><td class="paramname">data</td><td>additional data for the compare function </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the index of the element containing the specified data or the size of the array, if the data is not found in this array </dd></dl> </div> </div> <a id="ac01ee914468a16f470bf3071fffbe438"></a> <h2 class="memtitle"><span class="permalink"><a href="#ac01ee914468a16f470bf3071fffbe438">◆ </a></span>ucx_array_free()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_array_free </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destroys and frees the array. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the array to free </td></tr> </table> </dd> </dl> </div> </div> <a id="ab0cbf243824aaebee48277315e03afce"></a> <h2 class="memtitle"><span class="permalink"><a href="#ab0cbf243824aaebee48277315e03afce">◆ </a></span>ucx_array_grow()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_grow </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>count</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Resizes the capacity, if the specified number of elements would not fit. </p> <p>A call to ucx_array_grow(array, count) is effectively the same as ucx_array_reserve(array, array->size+count).</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer to the array </td></tr> <tr><td class="paramname">count</td><td>the number of elements that should additionally fit into the array </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if reallocation failed </dd></dl> </div> </div> <a id="ad921e85c28ffae32230777a53c5037e5"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad921e85c28ffae32230777a53c5037e5">◆ </a></span>ucx_array_init()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_array_init </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>elemsize</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Initializes a UCX array structure with the given capacity and element size. </p> <p>The structure must be uninitialized as the data pointer will be overwritten.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the structure to initialize </td></tr> <tr><td class="paramname">capacity</td><td>the initial capacity </td></tr> <tr><td class="paramname">elemsize</td><td>the element size </td></tr> </table> </dd> </dl> </div> </div> <a id="a2451e61ebb15a7ba1c1319267ba75b8c"></a> <h2 class="memtitle"><span class="permalink"><a href="#a2451e61ebb15a7ba1c1319267ba75b8c">◆ </a></span>ucx_array_init_a()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_array_init_a </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>elemsize</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structUcxAllocator.html">UcxAllocator</a> * </td> <td class="paramname"><em>allocator</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Initializes a UCX array structure using the specified allocator. </p> <p>The structure must be uninitialized as the data pointer will be overwritten.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the structure to initialize </td></tr> <tr><td class="paramname">capacity</td><td>the initial capacity </td></tr> <tr><td class="paramname">elemsize</td><td>the element size </td></tr> <tr><td class="paramname">allocator</td><td>the allocator to use </td></tr> </table> </dd> </dl> </div> </div> <a id="a994a2fbf1c33a3833e2a70cd9a4352b7"></a> <h2 class="memtitle"><span class="permalink"><a href="#a994a2fbf1c33a3833e2a70cd9a4352b7">◆ </a></span>ucx_array_new()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxArray.html">UcxArray</a>* ucx_array_new </td> <td>(</td> <td class="paramtype">size_t </td> <td class="paramname"><em>capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>elemsize</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Creates a new UCX array with the given capacity and element size. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">capacity</td><td>the initial capacity </td></tr> <tr><td class="paramname">elemsize</td><td>the element size </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to a new UCX array structure </dd></dl> </div> </div> <a id="a177170258c215eb2e4f5a32e59f0cb1b"></a> <h2 class="memtitle"><span class="permalink"><a href="#a177170258c215eb2e4f5a32e59f0cb1b">◆ </a></span>ucx_array_new_a()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxArray.html">UcxArray</a>* ucx_array_new_a </td> <td>(</td> <td class="paramtype">size_t </td> <td class="paramname"><em>capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>elemsize</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structUcxAllocator.html">UcxAllocator</a> * </td> <td class="paramname"><em>allocator</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Creates a new UCX array using the specified allocator. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">capacity</td><td>the initial capacity </td></tr> <tr><td class="paramname">elemsize</td><td>the element size </td></tr> <tr><td class="paramname">allocator</td><td>the allocator to use </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to new UCX array structure </dd></dl> </div> </div> <a id="a95b52acc2193b5c33cf0eaa4f2082477"></a> <h2 class="memtitle"><span class="permalink"><a href="#a95b52acc2193b5c33cf0eaa4f2082477">◆ </a></span>ucx_array_prepend_from()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_prepend_from </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>count</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Inserts elements at the beginning of the array. </p> <p>This is an expensive operation, because the contents must be moved. If there is no particular reason to prepend data, you should use <a class="el" href="array_8h.html#aea01731ad94ea73c0c8fb1d1b7a35fcf" title="Inserts elements at the end of the array. ">ucx_array_append_from()</a> instead.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer the array where to prepend the data </td></tr> <tr><td class="paramname">data</td><td>a pointer to the data to insert (may be <code>NULL</code>) </td></tr> <tr><td class="paramname">count</td><td>number of elements to copy from data (if data is <code>NULL</code>, zeroed elements are inserted) </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if a reallocation was necessary but failed </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="array_8h.html#aea01731ad94ea73c0c8fb1d1b7a35fcf" title="Inserts elements at the end of the array. ">ucx_array_append_from()</a> </dd> <dd> <a class="el" href="array_8h.html#a1bb545d065358d265d80d815ba382a28" title="Sets elements starting at the specified index. ">ucx_array_set_from()</a> </dd> <dd> ucx_array_prepend() </dd></dl> </div> </div> <a id="aa45eac6b697f83adac81c0860cf306b8"></a> <h2 class="memtitle"><span class="permalink"><a href="#aa45eac6b697f83adac81c0860cf306b8">◆ </a></span>ucx_array_remove()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_array_remove </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>index</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Removes an element from the array. </p> <p>This is in general an expensive operation, because several elements may be moved. If the order of the elements is not relevant, use <a class="el" href="array_8h.html#a548d81b07612bae3ba8c4c4b49104b8e" title="Removes an element from the array. ">ucx_array_remove_fast()</a> instead.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>pointer to the array from which the element shall be removed </td></tr> <tr><td class="paramname">index</td><td>the index of the element to remove </td></tr> </table> </dd> </dl> </div> </div> <a id="a548d81b07612bae3ba8c4c4b49104b8e"></a> <h2 class="memtitle"><span class="permalink"><a href="#a548d81b07612bae3ba8c4c4b49104b8e">◆ </a></span>ucx_array_remove_fast()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_array_remove_fast </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>index</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Removes an element from the array. </p> <p>This is an O(1) operation, but does not maintain the order of the elements. The last element in the array is moved to the location of the removed element.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>pointer to the array from which the element shall be removed </td></tr> <tr><td class="paramname">index</td><td>the index of the element to remove </td></tr> </table> </dd> </dl> </div> </div> <a id="a1c3bf8433c1de3c933f3854ab297fe1d"></a> <h2 class="memtitle"><span class="permalink"><a href="#a1c3bf8433c1de3c933f3854ab297fe1d">◆ </a></span>ucx_array_reserve()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_reserve </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>capacity</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Resizes the array only, if the capacity is insufficient. </p> <p>If the requested capacity is smaller than the current capacity, this function does nothing.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer to the array </td></tr> <tr><td class="paramname">capacity</td><td>the guaranteed capacity </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if reallocation failed </dd></dl> </div> </div> <a id="a27762e7c06a6c781015e3c8ceeee0ce3"></a> <h2 class="memtitle"><span class="permalink"><a href="#a27762e7c06a6c781015e3c8ceeee0ce3">◆ </a></span>ucx_array_resize()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_resize </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>capacity</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Sets the capacity of the array. </p> <p>If the new capacity is smaller than the size of the array, the elements are removed and the size is adjusted accordingly.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer to the array </td></tr> <tr><td class="paramname">capacity</td><td>the new capacity </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if reallocation failed </dd></dl> </div> </div> <a id="a1bb545d065358d265d80d815ba382a28"></a> <h2 class="memtitle"><span class="permalink"><a href="#a1bb545d065358d265d80d815ba382a28">◆ </a></span>ucx_array_set_from()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_set_from </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>index</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>count</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Sets elements starting at the specified index. </p> <p>If the any index is out of bounds, the array automatically grows. The pointer to the data may be NULL, in which case the elements are zeroed.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer the array where to set the data </td></tr> <tr><td class="paramname">index</td><td>the index of the element to set </td></tr> <tr><td class="paramname">data</td><td>a pointer to the data to insert (may be <code>NULL</code>) </td></tr> <tr><td class="paramname">count</td><td>number of elements to copy from data (if data is <code>NULL</code>, the memory in the array is zeroed) </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if a reallocation was necessary but failed </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="array_8h.html#aea01731ad94ea73c0c8fb1d1b7a35fcf" title="Inserts elements at the end of the array. ">ucx_array_append_from()</a> </dd> <dd> ucx_array_set() </dd></dl> </div> </div> <a id="a2daf50e80aee9bccebee876a7efd2dfc"></a> <h2 class="memtitle"><span class="permalink"><a href="#a2daf50e80aee9bccebee876a7efd2dfc">◆ </a></span>ucx_array_shrink()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_shrink </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Shrinks the memory to exactly fit the contents. </p> <p>After this operation, the capacity equals the size.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>a pointer to the array </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success, non-zero if reallocation failed </dd></dl> </div> </div> <a id="add773514569b872a6624381b4b6af52c"></a> <h2 class="memtitle"><span class="permalink"><a href="#add773514569b872a6624381b4b6af52c">◆ </a></span>ucx_array_sort()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_array_sort </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxArray.html">UcxArray</a> * </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> </td> <td class="paramname"><em>cmpfnc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Sorts a <a class="el" href="structUcxArray.html" title="UCX array type. ">UcxArray</a> with the best available sort algorithm. </p> <p>The qsort_r() function is used, if available (glibc, FreeBSD or MacOS). The order of arguments is automatically adjusted for the FreeBSD and MacOS version of qsort_r().</p> <p>If qsort_r() is not available, a merge sort algorithm is used, which is guaranteed to use no more additional memory than for exactly one element.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>the array to sort </td></tr> <tr><td class="paramname">cmpfnc</td><td>the function that shall be used to compare the element data </td></tr> <tr><td class="paramname">data</td><td>additional data for the <a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791" title="Function pointer to a compare function. ">cmp_func()</a> or <code>NULL</code> </td></tr> </table> </dd> </dl> </div> </div> <a id="ad0a8d76980cf1c1910e64a245803fb9a"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad0a8d76980cf1c1910e64a245803fb9a">◆ </a></span>ucx_array_util_set_a()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_util_set_a </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAllocator.html">UcxAllocator</a> * </td> <td class="paramname"><em>alloc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void ** </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t * </td> <td class="paramname"><em>capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>elmsize</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>idx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Sets an element in an arbitrary user defined array. </p> <p>The data is copied from the specified data location.</p> <p>If the capacity is insufficient, the array is automatically reallocated using the specified allocator and the possibly new pointer is stored in the <code>array</code> argument.</p> <p>On reallocation the capacity of the array is doubled until it is sufficient. The new capacity is stored back to <code>capacity</code>.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">alloc</td><td>the allocator that shall be used to reallocate the array </td></tr> <tr><td class="paramname">array</td><td>a pointer to location of the array pointer </td></tr> <tr><td class="paramname">capacity</td><td>a pointer to the capacity </td></tr> <tr><td class="paramname">elmsize</td><td>the size of each element </td></tr> <tr><td class="paramname">idx</td><td>the index of the element to set </td></tr> <tr><td class="paramname">data</td><td>a pointer to the element data </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success or non-zero on error (errno will be set) </dd></dl> </div> </div> <a id="ad708b333c0c1b02c998309a58ea65e31"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad708b333c0c1b02c998309a58ea65e31">◆ </a></span>ucx_array_util_setptr_a()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_array_util_setptr_a </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAllocator.html">UcxAllocator</a> * </td> <td class="paramname"><em>alloc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void ** </td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t * </td> <td class="paramname"><em>capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>idx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>ptr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Stores a pointer in an arbitrary user defined array. </p> <p>The element size of the array must be sizeof(void*).</p> <p>If the capacity is insufficient, the array is automatically reallocated using the specified allocator and the possibly new pointer is stored in the <code>array</code> argument.</p> <p>On reallocation the capacity of the array is doubled until it is sufficient. The new capacity is stored back to <code>capacity</code>.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">alloc</td><td>the allocator that shall be used to reallocate the array </td></tr> <tr><td class="paramname">array</td><td>a pointer to location of the array pointer </td></tr> <tr><td class="paramname">capacity</td><td>a pointer to the capacity </td></tr> <tr><td class="paramname">idx</td><td>the index of the element to set </td></tr> <tr><td class="paramname">ptr</td><td>the pointer to store </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero on success or non-zero on error (errno will be set) </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  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>