Sun, 01 Sep 2024 16:14:34 +0200
optimize default insert_sorted implementation
resolves #418
<!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/avl.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="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">avl.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>AVL tree 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 /> <code>#include <inttypes.h></code><br /> </div> <p><a href="avl_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="structUcxAVLNode.html">UcxAVLNode</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">UCX AVL Node. <a href="structUcxAVLNode.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">UCX AVL Tree. <a href="structUcxAVLTree.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:ac2886d4b79b48c9fabf6408873f84cd2"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#ac2886d4b79b48c9fabf6408873f84cd2">ucx_avl_default_new</a>()   <a class="el" href="avl_8h.html#af0f868d67e9dc08b4867c02a06c23ee2">ucx_avl_new_a</a>(<a class="el" href="utils_8h.html#aa174d539de3ea59be4f9640f17ce53d8">ucx_cmp_ptr</a>, <a class="el" href="allocator_8h.html#a98d2f1b341118b7a0e341fda5d8b2ebf">ucx_default_allocator</a>())</td></tr> <tr class="memdesc:ac2886d4b79b48c9fabf6408873f84cd2"><td class="mdescLeft"> </td><td class="mdescRight">Macro for initializing a new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> with the default allocator and a <a class="el" href="utils_8h.html#aa174d539de3ea59be4f9640f17ce53d8" title="Compares two pointers. ">ucx_cmp_ptr()</a> compare function. <a href="#ac2886d4b79b48c9fabf6408873f84cd2">More...</a><br /></td></tr> <tr class="separator:ac2886d4b79b48c9fabf6408873f84cd2"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aaaf4a6f6f661cda7791db239212285d9"><td class="memItemLeft" align="right" valign="top"><a id="aaaf4a6f6f661cda7791db239212285d9"></a> #define </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#aaaf4a6f6f661cda7791db239212285d9">UCX_AVL_FIND_EXACT</a>   0</td></tr> <tr class="memdesc:aaaf4a6f6f661cda7791db239212285d9"><td class="mdescLeft"> </td><td class="mdescRight">A mode for <a class="el" href="avl_8h.html#a664986f64d6865605199fbff06e19cd5" title="Finds a node within the tree. ">ucx_avl_find_node()</a> with the same behavior as <a class="el" href="avl_8h.html#acf42da9a4168e47dc10b4ba0d27ceb4e" title="Gets the node from the tree, that is associated with the specified key. ">ucx_avl_get_node()</a>. <br /></td></tr> <tr class="separator:aaaf4a6f6f661cda7791db239212285d9"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:abd2446d544d5412b6997ee8a17bd368c"><td class="memItemLeft" align="right" valign="top"><a id="abd2446d544d5412b6997ee8a17bd368c"></a> #define </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#abd2446d544d5412b6997ee8a17bd368c">UCX_AVL_FIND_LOWER_BOUNDED</a>   1</td></tr> <tr class="memdesc:abd2446d544d5412b6997ee8a17bd368c"><td class="mdescLeft"> </td><td class="mdescRight">A mode for <a class="el" href="avl_8h.html#a664986f64d6865605199fbff06e19cd5" title="Finds a node within the tree. ">ucx_avl_find_node()</a> finding the node whose key is at least as large as the specified key. <br /></td></tr> <tr class="separator:abd2446d544d5412b6997ee8a17bd368c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ac74ee7649c1e206b08b31f37dd68ca5e"><td class="memItemLeft" align="right" valign="top"><a id="ac74ee7649c1e206b08b31f37dd68ca5e"></a> #define </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#ac74ee7649c1e206b08b31f37dd68ca5e">UCX_AVL_FIND_UPPER_BOUNDED</a>   2</td></tr> <tr class="memdesc:ac74ee7649c1e206b08b31f37dd68ca5e"><td class="mdescLeft"> </td><td class="mdescRight">A mode for <a class="el" href="avl_8h.html#a664986f64d6865605199fbff06e19cd5" title="Finds a node within the tree. ">ucx_avl_find_node()</a> finding the node whose key is at most as large as the specified key. <br /></td></tr> <tr class="separator:ac74ee7649c1e206b08b31f37dd68ca5e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:af16f24d74fd6af0154de041566c6603b"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#af16f24d74fd6af0154de041566c6603b">UCX_AVL_FIND_CLOSEST</a>   3</td></tr> <tr class="memdesc:af16f24d74fd6af0154de041566c6603b"><td class="mdescLeft"> </td><td class="mdescRight">A mode for <a class="el" href="avl_8h.html#a664986f64d6865605199fbff06e19cd5" title="Finds a node within the tree. ">ucx_avl_find_node()</a> finding the node with a key that is as close to the specified key as possible. <a href="#af16f24d74fd6af0154de041566c6603b">More...</a><br /></td></tr> <tr class="separator:af16f24d74fd6af0154de041566c6603b"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr class="memitem:a08ba2496c2316df58548c3cc29712add"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a08ba2496c2316df58548c3cc29712add">UcxAVLNode</a></td></tr> <tr class="memdesc:a08ba2496c2316df58548c3cc29712add"><td class="mdescLeft"> </td><td class="mdescRight">UCX AVL Node type. <a href="#a08ba2496c2316df58548c3cc29712add">More...</a><br /></td></tr> <tr class="separator:a08ba2496c2316df58548c3cc29712add"><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:a11b043d65a11b7092d5d98b298e5ede3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a11b043d65a11b7092d5d98b298e5ede3">ucx_avl_new</a> (<a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfunc)</td></tr> <tr class="memdesc:a11b043d65a11b7092d5d98b298e5ede3"><td class="mdescLeft"> </td><td class="mdescRight">Initializes a new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> with a default allocator. <a href="#a11b043d65a11b7092d5d98b298e5ede3">More...</a><br /></td></tr> <tr class="separator:a11b043d65a11b7092d5d98b298e5ede3"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:af0f868d67e9dc08b4867c02a06c23ee2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#af0f868d67e9dc08b4867c02a06c23ee2">ucx_avl_new_a</a> (<a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> cmpfunc, <a class="el" href="structUcxAllocator.html">UcxAllocator</a> *allocator)</td></tr> <tr class="memdesc:af0f868d67e9dc08b4867c02a06c23ee2"><td class="mdescLeft"> </td><td class="mdescRight">Initializes a new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> with the specified allocator. <a href="#af0f868d67e9dc08b4867c02a06c23ee2">More...</a><br /></td></tr> <tr class="separator:af0f868d67e9dc08b4867c02a06c23ee2"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a2f92db538f25fce908d2cb3e5590944c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a2f92db538f25fce908d2cb3e5590944c">ucx_avl_free</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree)</td></tr> <tr class="memdesc:a2f92db538f25fce908d2cb3e5590944c"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a>. <a href="#a2f92db538f25fce908d2cb3e5590944c">More...</a><br /></td></tr> <tr class="separator:a2f92db538f25fce908d2cb3e5590944c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a31ad7fb196ca211f1fc39f4e15f72279"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a31ad7fb196ca211f1fc39f4e15f72279">ucx_avl_free_content</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, <a class="el" href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a> destr)</td></tr> <tr class="memdesc:a31ad7fb196ca211f1fc39f4e15f72279"><td class="mdescLeft"> </td><td class="mdescRight">Frees the contents of a <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a>. <a href="#a31ad7fb196ca211f1fc39f4e15f72279">More...</a><br /></td></tr> <tr class="separator:a31ad7fb196ca211f1fc39f4e15f72279"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:acf42da9a4168e47dc10b4ba0d27ceb4e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#acf42da9a4168e47dc10b4ba0d27ceb4e">ucx_avl_get_node</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key)</td></tr> <tr class="memdesc:acf42da9a4168e47dc10b4ba0d27ceb4e"><td class="mdescLeft"> </td><td class="mdescRight">Gets the node from the tree, that is associated with the specified key. <a href="#acf42da9a4168e47dc10b4ba0d27ceb4e">More...</a><br /></td></tr> <tr class="separator:acf42da9a4168e47dc10b4ba0d27ceb4e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:adbcf7ceb3f014a30c7214f7304519efe"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#adbcf7ceb3f014a30c7214f7304519efe">ucx_avl_get</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key)</td></tr> <tr class="memdesc:adbcf7ceb3f014a30c7214f7304519efe"><td class="mdescLeft"> </td><td class="mdescRight">Gets the value from the tree, that is associated with the specified key. <a href="#adbcf7ceb3f014a30c7214f7304519efe">More...</a><br /></td></tr> <tr class="separator:adbcf7ceb3f014a30c7214f7304519efe"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a664986f64d6865605199fbff06e19cd5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a664986f64d6865605199fbff06e19cd5">ucx_avl_find_node</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key, <a class="el" href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">distance_func</a> dfnc, int mode)</td></tr> <tr class="memdesc:a664986f64d6865605199fbff06e19cd5"><td class="mdescLeft"> </td><td class="mdescRight">Finds a node within the tree. <a href="#a664986f64d6865605199fbff06e19cd5">More...</a><br /></td></tr> <tr class="separator:a664986f64d6865605199fbff06e19cd5"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a51770e1614b28d7d22dea096c3704f83"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a51770e1614b28d7d22dea096c3704f83">ucx_avl_find</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key, <a class="el" href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">distance_func</a> dfnc, int mode)</td></tr> <tr class="memdesc:a51770e1614b28d7d22dea096c3704f83"><td class="mdescLeft"> </td><td class="mdescRight">Finds a value within the tree. <a href="#a51770e1614b28d7d22dea096c3704f83">More...</a><br /></td></tr> <tr class="separator:a51770e1614b28d7d22dea096c3704f83"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aec401fab4a24a7edffa734f9baf88577"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#aec401fab4a24a7edffa734f9baf88577">ucx_avl_put</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key, void *value)</td></tr> <tr class="memdesc:aec401fab4a24a7edffa734f9baf88577"><td class="mdescLeft"> </td><td class="mdescRight">Puts a key/value pair into the tree. <a href="#aec401fab4a24a7edffa734f9baf88577">More...</a><br /></td></tr> <tr class="separator:aec401fab4a24a7edffa734f9baf88577"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a32cf8955cc0226a82bacfc7b76d6474c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a32cf8955cc0226a82bacfc7b76d6474c">ucx_avl_put_s</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key, void *value, void **oldvalue)</td></tr> <tr class="memdesc:a32cf8955cc0226a82bacfc7b76d6474c"><td class="mdescLeft"> </td><td class="mdescRight">Puts a key/value pair into the tree. <a href="#a32cf8955cc0226a82bacfc7b76d6474c">More...</a><br /></td></tr> <tr class="separator:a32cf8955cc0226a82bacfc7b76d6474c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a9a792b7d9e58073deef74a341f8bc720"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a9a792b7d9e58073deef74a341f8bc720">ucx_avl_remove_node</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, <a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> *node)</td></tr> <tr class="memdesc:a9a792b7d9e58073deef74a341f8bc720"><td class="mdescLeft"> </td><td class="mdescRight">Removes a node from the AVL tree. <a href="#a9a792b7d9e58073deef74a341f8bc720">More...</a><br /></td></tr> <tr class="separator:a9a792b7d9e58073deef74a341f8bc720"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1d821119c805d7fbb7e424bc3effeba9"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a1d821119c805d7fbb7e424bc3effeba9">ucx_avl_remove</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key)</td></tr> <tr class="memdesc:a1d821119c805d7fbb7e424bc3effeba9"><td class="mdescLeft"> </td><td class="mdescRight">Removes an element from the AVL tree. <a href="#a1d821119c805d7fbb7e424bc3effeba9">More...</a><br /></td></tr> <tr class="separator:a1d821119c805d7fbb7e424bc3effeba9"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a01aeeecd6415f0cc2b623486eb28f254"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a01aeeecd6415f0cc2b623486eb28f254">ucx_avl_remove_s</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree, intptr_t key, intptr_t *oldkey, void **oldvalue)</td></tr> <tr class="memdesc:a01aeeecd6415f0cc2b623486eb28f254"><td class="mdescLeft"> </td><td class="mdescRight">Removes an element from the AVL tree. <a href="#a01aeeecd6415f0cc2b623486eb28f254">More...</a><br /></td></tr> <tr class="separator:a01aeeecd6415f0cc2b623486eb28f254"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a92c1d41c2b22fe4a029a486ab2153e35"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a92c1d41c2b22fe4a029a486ab2153e35">ucx_avl_count</a> (<a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> *tree)</td></tr> <tr class="memdesc:a92c1d41c2b22fe4a029a486ab2153e35"><td class="mdescLeft"> </td><td class="mdescRight">Counts the nodes in the specified <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a>. <a href="#a92c1d41c2b22fe4a029a486ab2153e35">More...</a><br /></td></tr> <tr class="separator:a92c1d41c2b22fe4a029a486ab2153e35"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a0e739aeb66dda6a6a3f6eb51b50cf346"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#a0e739aeb66dda6a6a3f6eb51b50cf346">ucx_avl_pred</a> (<a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> *node)</td></tr> <tr class="memdesc:a0e739aeb66dda6a6a3f6eb51b50cf346"><td class="mdescLeft"> </td><td class="mdescRight">Finds the in-order predecessor of the given node. <a href="#a0e739aeb66dda6a6a3f6eb51b50cf346">More...</a><br /></td></tr> <tr class="separator:a0e739aeb66dda6a6a3f6eb51b50cf346"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aab1ad9b027ff5e50671aa0ee84e2d541"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="avl_8h.html#aab1ad9b027ff5e50671aa0ee84e2d541">ucx_avl_succ</a> (<a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> *node)</td></tr> <tr class="memdesc:aab1ad9b027ff5e50671aa0ee84e2d541"><td class="mdescLeft"> </td><td class="mdescRight">Finds the in-order successor of the given node. <a href="#aab1ad9b027ff5e50671aa0ee84e2d541">More...</a><br /></td></tr> <tr class="separator:aab1ad9b027ff5e50671aa0ee84e2d541"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>AVL tree implementation. </p> <p>This binary search tree implementation allows average O(1) insertion and removal of elements (excluding binary search time).</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="ac2886d4b79b48c9fabf6408873f84cd2"></a> <h2 class="memtitle"><span class="permalink"><a href="#ac2886d4b79b48c9fabf6408873f84cd2">◆ </a></span>ucx_avl_default_new</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define ucx_avl_default_new</td> <td>(</td> <td class="paramname"></td><td>)</td> <td>   <a class="el" href="avl_8h.html#af0f868d67e9dc08b4867c02a06c23ee2">ucx_avl_new_a</a>(<a class="el" href="utils_8h.html#aa174d539de3ea59be4f9640f17ce53d8">ucx_cmp_ptr</a>, <a class="el" href="allocator_8h.html#a98d2f1b341118b7a0e341fda5d8b2ebf">ucx_default_allocator</a>())</td> </tr> </table> </div><div class="memdoc"> <p>Macro for initializing a new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> with the default allocator and a <a class="el" href="utils_8h.html#aa174d539de3ea59be4f9640f17ce53d8" title="Compares two pointers. ">ucx_cmp_ptr()</a> compare function. </p> <dl class="section return"><dt>Returns</dt><dd>a new default <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> object </dd></dl> </div> </div> <a id="af16f24d74fd6af0154de041566c6603b"></a> <h2 class="memtitle"><span class="permalink"><a href="#af16f24d74fd6af0154de041566c6603b">◆ </a></span>UCX_AVL_FIND_CLOSEST</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_AVL_FIND_CLOSEST   3</td> </tr> </table> </div><div class="memdoc"> <p>A mode for <a class="el" href="avl_8h.html#a664986f64d6865605199fbff06e19cd5" title="Finds a node within the tree. ">ucx_avl_find_node()</a> finding the node with a key that is as close to the specified key as possible. </p> <p>If the key is present, the behavior is like <a class="el" href="avl_8h.html#acf42da9a4168e47dc10b4ba0d27ceb4e" title="Gets the node from the tree, that is associated with the specified key. ">ucx_avl_get_node()</a>. This mode only returns <code>NULL</code> on empty trees. </p> </div> </div> <h2 class="groupheader">Typedef Documentation</h2> <a id="a08ba2496c2316df58548c3cc29712add"></a> <h2 class="memtitle"><span class="permalink"><a href="#a08ba2496c2316df58548c3cc29712add">◆ </a></span>UcxAVLNode</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef struct <a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> <a class="el" href="structUcxAVLNode.html">UcxAVLNode</a></td> </tr> </table> </div><div class="memdoc"> <p>UCX AVL Node type. </p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="structUcxAVLNode.html" title="UCX AVL Node. ">UcxAVLNode</a> </dd></dl> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a id="a92c1d41c2b22fe4a029a486ab2153e35"></a> <h2 class="memtitle"><span class="permalink"><a href="#a92c1d41c2b22fe4a029a486ab2153e35">◆ </a></span>ucx_avl_count()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">size_t ucx_avl_count </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Counts the nodes in the specified <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a>. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the AVL tree </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the node count </dd></dl> </div> </div> <a id="a51770e1614b28d7d22dea096c3704f83"></a> <h2 class="memtitle"><span class="permalink"><a href="#a51770e1614b28d7d22dea096c3704f83">◆ </a></span>ucx_avl_find()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* ucx_avl_find </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">distance_func</a> </td> <td class="paramname"><em>dfnc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>mode</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Finds a value within the tree. </p> <p>See <a class="el" href="avl_8h.html#a664986f64d6865605199fbff06e19cd5" title="Finds a node within the tree. ">ucx_avl_find_node()</a> for details.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key </td></tr> <tr><td class="paramname">dfnc</td><td>the distance function </td></tr> <tr><td class="paramname">mode</td><td>the find mode </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the value (or <code>NULL</code>, if no value can be found) </dd></dl> </div> </div> <a id="a664986f64d6865605199fbff06e19cd5"></a> <h2 class="memtitle"><span class="permalink"><a href="#a664986f64d6865605199fbff06e19cd5">◆ </a></span>ucx_avl_find_node()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a>* ucx_avl_find_node </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">distance_func</a> </td> <td class="paramname"><em>dfnc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>mode</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Finds a node within the tree. </p> <p>The following modes are supported: </p><ul> <li> <a class="el" href="avl_8h.html#aaaf4a6f6f661cda7791db239212285d9" title="A mode for ucx_avl_find_node() with the same behavior as ucx_avl_get_node(). ">UCX_AVL_FIND_EXACT</a>: the same behavior as <a class="el" href="avl_8h.html#acf42da9a4168e47dc10b4ba0d27ceb4e" title="Gets the node from the tree, that is associated with the specified key. ">ucx_avl_get_node()</a> </li> <li> <a class="el" href="avl_8h.html#abd2446d544d5412b6997ee8a17bd368c" title="A mode for ucx_avl_find_node() finding the node whose key is at least as large as the specified key...">UCX_AVL_FIND_LOWER_BOUNDED</a>: finds the node whose key is at least as large as the specified key </li> <li> <a class="el" href="avl_8h.html#ac74ee7649c1e206b08b31f37dd68ca5e" title="A mode for ucx_avl_find_node() finding the node whose key is at most as large as the specified key...">UCX_AVL_FIND_UPPER_BOUNDED</a>: finds the node whose key is at most as large as the specified key </li> <li> <a class="el" href="avl_8h.html#af16f24d74fd6af0154de041566c6603b" title="A mode for ucx_avl_find_node() finding the node with a key that is as close to the specified key as p...">UCX_AVL_FIND_CLOSEST</a>: finds the node with a key that is as close to the specified key as possible. If the key is present, the behavior is like <a class="el" href="avl_8h.html#acf42da9a4168e47dc10b4ba0d27ceb4e" title="Gets the node from the tree, that is associated with the specified key. ">ucx_avl_get_node()</a>. This mode only returns <code>NULL</code> on empty trees. </li> </ul> <p>The distance function provided MUST agree with the compare function of the AVL tree.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key </td></tr> <tr><td class="paramname">dfnc</td><td>the distance function </td></tr> <tr><td class="paramname">mode</td><td>the find mode </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the node (or <code>NULL</code>, if no node can be found) </dd></dl> </div> </div> <a id="a2f92db538f25fce908d2cb3e5590944c"></a> <h2 class="memtitle"><span class="permalink"><a href="#a2f92db538f25fce908d2cb3e5590944c">◆ </a></span>ucx_avl_free()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_avl_free </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destroys a <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a>. </p> <p>Note, that the contents are not automatically freed. Use may use <a class="el" href="avl_8h.html#a31ad7fb196ca211f1fc39f4e15f72279" title="Frees the contents of a UcxAVLTree. ">ucx_avl_free_content()</a> before calling this function.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the tree to destroy </td></tr> </table> </dd> </dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="avl_8h.html#a31ad7fb196ca211f1fc39f4e15f72279" title="Frees the contents of a UcxAVLTree. ">ucx_avl_free_content()</a> </dd></dl> </div> </div> <a id="a31ad7fb196ca211f1fc39f4e15f72279"></a> <h2 class="memtitle"><span class="permalink"><a href="#a31ad7fb196ca211f1fc39f4e15f72279">◆ </a></span>ucx_avl_free_content()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_avl_free_content </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a> </td> <td class="paramname"><em>destr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Frees the contents of a <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a>. </p> <p>This is a convenience function that iterates over the tree and passes all values to the specified destructor function.</p> <p>If no destructor is specified (<code>NULL</code>), the free() function of the tree's own allocator is used.</p> <p>You must ensure, that it is valid to pass each value in the map to the same destructor function.</p> <p>You should free the entire tree afterwards, as the contents will be invalid.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>for which the contents shall be freed </td></tr> <tr><td class="paramname">destr</td><td>optional pointer to a destructor function </td></tr> </table> </dd> </dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="avl_8h.html#a2f92db538f25fce908d2cb3e5590944c" title="Destroys a UcxAVLTree. ">ucx_avl_free()</a> </dd></dl> </div> </div> <a id="adbcf7ceb3f014a30c7214f7304519efe"></a> <h2 class="memtitle"><span class="permalink"><a href="#adbcf7ceb3f014a30c7214f7304519efe">◆ </a></span>ucx_avl_get()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* ucx_avl_get </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Gets the value from the tree, that is associated with the specified key. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the value (or <code>NULL</code>, if the key is not present) </dd></dl> </div> </div> <a id="acf42da9a4168e47dc10b4ba0d27ceb4e"></a> <h2 class="memtitle"><span class="permalink"><a href="#acf42da9a4168e47dc10b4ba0d27ceb4e">◆ </a></span>ucx_avl_get_node()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a>* ucx_avl_get_node </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Gets the node from the tree, that is associated with the specified key. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the node (or <code>NULL</code>, if the key is not present) </dd></dl> </div> </div> <a id="a11b043d65a11b7092d5d98b298e5ede3"></a> <h2 class="memtitle"><span class="permalink"><a href="#a11b043d65a11b7092d5d98b298e5ede3">◆ </a></span>ucx_avl_new()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a>* ucx_avl_new </td> <td>(</td> <td class="paramtype"><a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> </td> <td class="paramname"><em>cmpfunc</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Initializes a new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> with a default allocator. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cmpfunc</td><td>the compare function that shall be used </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> object </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="avl_8h.html#af0f868d67e9dc08b4867c02a06c23ee2" title="Initializes a new UcxAVLTree with the specified allocator. ">ucx_avl_new_a()</a> </dd></dl> </div> </div> <a id="af0f868d67e9dc08b4867c02a06c23ee2"></a> <h2 class="memtitle"><span class="permalink"><a href="#af0f868d67e9dc08b4867c02a06c23ee2">◆ </a></span>ucx_avl_new_a()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a>* ucx_avl_new_a </td> <td>(</td> <td class="paramtype"><a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a> </td> <td class="paramname"><em>cmpfunc</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 new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> with the specified allocator. </p> <p>The cmpfunc should be capable of comparing two keys within this AVL tree. So if you want to use null terminated strings as keys, you could use the <a class="el" href="utils_8h.html#aa6a37b9d172b6a5b2803d152f9e1b258" title="Wraps the strcmp function. ">ucx_cmp_str()</a> function here.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cmpfunc</td><td>the compare function that shall be used </td></tr> <tr><td class="paramname">allocator</td><td>the <a class="el" href="structUcxAllocator.html" title="UCX allocator data structure containing memory management functions. ">UcxAllocator</a> that shall be used </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a new <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> object </dd></dl> </div> </div> <a id="a0e739aeb66dda6a6a3f6eb51b50cf346"></a> <h2 class="memtitle"><span class="permalink"><a href="#a0e739aeb66dda6a6a3f6eb51b50cf346">◆ </a></span>ucx_avl_pred()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a>* ucx_avl_pred </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> * </td> <td class="paramname"><em>node</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Finds the in-order predecessor of the given node. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">node</td><td>an AVL node </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the in-order predecessor of the given node, or <code>NULL</code> if the given node is the in-order minimum </dd></dl> </div> </div> <a id="aec401fab4a24a7edffa734f9baf88577"></a> <h2 class="memtitle"><span class="permalink"><a href="#aec401fab4a24a7edffa734f9baf88577">◆ </a></span>ucx_avl_put()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_avl_put </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>value</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Puts a key/value pair into the tree. </p> <p>Attention: use this function only, if a possible old value does not need to be preserved.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key </td></tr> <tr><td class="paramname">value</td><td>the new value </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero, if and only if the operation succeeded </dd></dl> </div> </div> <a id="a32cf8955cc0226a82bacfc7b76d6474c"></a> <h2 class="memtitle"><span class="permalink"><a href="#a32cf8955cc0226a82bacfc7b76d6474c">◆ </a></span>ucx_avl_put_s()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_avl_put_s </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>value</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void ** </td> <td class="paramname"><em>oldvalue</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Puts a key/value pair into the tree. </p> <p>This is a secure function which saves the old value to the variable pointed at by oldvalue.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key </td></tr> <tr><td class="paramname">value</td><td>the new value </td></tr> <tr><td class="paramname">oldvalue</td><td>optional: a pointer to the location where a possible old value shall be stored </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero, if and only if the operation succeeded </dd></dl> </div> </div> <a id="a1d821119c805d7fbb7e424bc3effeba9"></a> <h2 class="memtitle"><span class="permalink"><a href="#a1d821119c805d7fbb7e424bc3effeba9">◆ </a></span>ucx_avl_remove()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_avl_remove </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Removes an element from the AVL tree. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero, if and only if an element has been removed </dd></dl> </div> </div> <a id="a9a792b7d9e58073deef74a341f8bc720"></a> <h2 class="memtitle"><span class="permalink"><a href="#a9a792b7d9e58073deef74a341f8bc720">◆ </a></span>ucx_avl_remove_node()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_avl_remove_node </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> * </td> <td class="paramname"><em>node</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Removes a node from the AVL tree. </p> <p>Note: the specified node is logically removed. The tree implementation decides which memory area is freed. In most cases the here provided node is freed, so its further use is generally undefined.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">node</td><td>the node to remove </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero, if and only if an element has been removed </dd></dl> </div> </div> <a id="a01aeeecd6415f0cc2b623486eb28f254"></a> <h2 class="memtitle"><span class="permalink"><a href="#a01aeeecd6415f0cc2b623486eb28f254">◆ </a></span>ucx_avl_remove_s()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_avl_remove_s </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLTree.html">UcxAVLTree</a> * </td> <td class="paramname"><em>tree</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t </td> <td class="paramname"><em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">intptr_t * </td> <td class="paramname"><em>oldkey</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void ** </td> <td class="paramname"><em>oldvalue</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Removes an element from the AVL tree. </p> <p>This is a secure function which saves the old key and value data from node to the variables at the location of oldkey and oldvalue (if specified), so they can be freed afterwards (if necessary).</p> <p>Note: the returned key in oldkey is possibly not the same as the provided key for the lookup (in terms of memory location).</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">tree</td><td>the <a class="el" href="structUcxAVLTree.html" title="UCX AVL Tree. ">UcxAVLTree</a> </td></tr> <tr><td class="paramname">key</td><td>the key of the element to remove </td></tr> <tr><td class="paramname">oldkey</td><td>optional: a pointer to the location where the old key shall be stored </td></tr> <tr><td class="paramname">oldvalue</td><td>optional: a pointer to the location where the old value shall be stored </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero, if and only if an element has been removed </dd></dl> </div> </div> <a id="aab1ad9b027ff5e50671aa0ee84e2d541"></a> <h2 class="memtitle"><span class="permalink"><a href="#aab1ad9b027ff5e50671aa0ee84e2d541">◆ </a></span>ucx_avl_succ()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a>* ucx_avl_succ </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxAVLNode.html">UcxAVLNode</a> * </td> <td class="paramname"><em>node</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Finds the in-order successor of the given node. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">node</td><td>an AVL node </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the in-order successor of the given node, or <code>NULL</code> if the given node is the in-order maximum </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>