]> Git Repo - pico-vscode.git/blob - web/docs/pheap_8h.html
Merge branch 'main' into main
[pico-vscode.git] / web / docs / pheap_8h.html
1 <!-- HTML header for doxygen 1.8.20-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5         <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6         <meta http-equiv="X-UA-Compatible" content="IE=9"/>
7         <meta name="generator" content="Doxygen 1.9.4"/>
8         <meta name="viewport" content="width=device-width, initial-scale=1"/>
9         <title>Raspberry Pi Pico SDK: include/pico/util/pheap.h File Reference</title>
10         <!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
11         <script type="text/javascript" src="jquery.js"></script>
12         <script type="text/javascript" src="dynsections.js"></script>
13         <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtreedata.js"></script>
16 <script type="text/javascript" src="navtree.js"></script>
17         <link href="search/search.css" rel="stylesheet" type="text/css"/>
18 <script type="text/javascript" src="search/searchdata.js"></script>
19 <script type="text/javascript" src="search/search.js"></script>
20     <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
21         <link href="doxygen.css" rel="stylesheet" type="text/css" />
22         <link href="normalise.css" rel="stylesheet" type="text/css"/>
23 <link href="main.css" rel="stylesheet" type="text/css"/>
24 <link href="styles.css" rel="stylesheet" type="text/css"/>
25 </head>
26 <body>
27         <div class="navigation-mobile">
28                 <div class="logo--mobile">
29                         <a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
30                 </div>
31                 <div class="navigation-toggle">
32                         <span class="line-1"></span>
33                         <span class="line-2">
34                                 <p>Menu Toggle</p>
35                         </span>
36                         <span class="line-3"></span>
37                 </div>
38         </div>
39         <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
40                 <div class="logo">
41                         <a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
42                         <span style="display: inline-block; margin-top: 10px;">
43                                 v2.0.0
44                         </span>
45                 </div>
46                 <div class="navigation-footer">
47                         <img src="logo-mobile.svg" alt="Raspberry Pi">
48                         <a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
49                 </div>
50 <!--            <div class="search">
51                         <form>
52                                 <input type="search" name="search" id="search" placeholder="Search">
53                                 <input type="submit" value="Search">
54                         </form>
55                 </div> -->
56 <!-- Generated by Doxygen 1.9.4 -->
57 <script type="text/javascript">
58 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
59 var searchBox = new SearchBox("searchBox", "search",'Search','.html');
60 /* @license-end */
61 </script>
62 <script type="text/javascript" src="menudata.js"></script>
63 <script type="text/javascript" src="menu.js"></script>
64 <script type="text/javascript">
65 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
66 $(function() {
67   initMenu('',true,false,'search.php','Search');
68   $(document).ready(function() { init_search(); });
69 });
70 /* @license-end */
71 </script>
72 <div id="main-nav"></div>
73 </div><!-- top -->
74 <div id="side-nav" class="ui-resizable side-nav-resizable">
75   <div id="nav-tree">
76     <div id="nav-tree-contents">
77       <div id="nav-sync" class="sync"></div>
78     </div>
79   </div>
80   <div id="splitbar" style="-moz-user-select:none;" 
81        class="ui-resizable-handle">
82   </div>
83 </div>
84 <script type="text/javascript">
85 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
86 $(document).ready(function(){initNavTree('pheap_8h.html',''); initResizable(); });
87 /* @license-end */
88 </script>
89 <div id="doc-content">
90 <!-- window showing the filter options -->
91 <div id="MSearchSelectWindow"
92      onmouseover="return searchBox.OnSearchSelectShow()"
93      onmouseout="return searchBox.OnSearchSelectHide()"
94      onkeydown="return searchBox.OnSearchSelectKey(event)">
95 </div>
96
97 <!-- iframe showing the search results (closed by default) -->
98 <div id="MSearchResultsWindow">
99 <iframe src="javascript:void(0)" frameborder="0" 
100         name="MSearchResults" id="MSearchResults">
101 </iframe>
102 </div>
103
104 <div class="header">
105   <div class="summary">
106 <a href="#nested-classes">Data Structures</a> &#124;
107 <a href="#define-members">Macros</a> &#124;
108 <a href="#typedef-members">Typedefs</a> &#124;
109 <a href="#func-members">Functions</a>  </div>
110   <div class="headertitle"><div class="title">pheap.h File Reference</div></div>
111 </div><!--header-->
112 <div class="contents">
113 <div class="textblock"><code>#include &quot;<a class="el" href="pico_8h_source.html">pico.h</a>&quot;</code><br />
114 </div><div class="textblock"><div class="dynheader">
115 Include dependency graph for pheap.h:</div>
116 <div class="dyncontent">
117 <div class="center"><img src="pheap_8h__incl.png" border="0" usemap="#ainclude_2pico_2util_2pheap_8h" alt=""/></div>
118 <map name="ainclude_2pico_2util_2pheap_8h" id="ainclude_2pico_2util_2pheap_8h">
119 <area shape="rect" title=" " alt="" coords="351,5,533,32"/>
120 <area shape="rect" href="pico_8h.html" title=" " alt="" coords="411,80,473,107"/>
121 <area shape="rect" href="common_2pico__base__headers_2include_2pico_2types_8h_source.html" title=" " alt="" coords="158,304,259,331"/>
122 <area shape="rect" title=" " alt="" coords="252,155,365,181"/>
123 <area shape="rect" href="common_2pico__base__headers_2include_2pico_2config_8h_source.html" title=" " alt="" coords="390,155,494,181"/>
124 <area shape="rect" href="platform_8h.html" title=" " alt="" coords="596,155,717,181"/>
125 <area shape="rect" href="error_8h_source.html" title=" " alt="" coords="741,155,836,181"/>
126 <area shape="rect" href="assert_8h_source.html" title=" " alt="" coords="5,379,111,405"/>
127 <area shape="rect" title=" " alt="" coords="74,453,157,480"/>
128 <area shape="rect" title=" " alt="" coords="211,379,281,405"/>
129 <area shape="rect" title=" " alt="" coords="306,379,381,405"/>
130 <area shape="rect" title=" " alt="" coords="173,229,337,256"/>
131 <area shape="rect" href="compiler_8h_source.html" title=" " alt="" coords="362,229,543,256"/>
132 <area shape="rect" href="sections_8h_source.html" title=" " alt="" coords="567,229,746,256"/>
133 <area shape="rect" href="panic_8h_source.html" title=" " alt="" coords="770,229,930,256"/>
134 <area shape="rect" title=" " alt="" coords="954,229,1165,256"/>
135 <area shape="rect" title=" " alt="" coords="1189,229,1340,256"/>
136 <area shape="rect" title=" " alt="" coords="357,304,548,331"/>
137 </map>
138 </div>
139 </div>
140 <p><a href="pheap_8h_source.html">Go to the source code of this file.</a></p>
141 <table class="memberdecls">
142 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
143 Data Structures</h2></td></tr>
144 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structpheap__node.html">pheap_node</a></td></tr>
145 <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
146 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structpheap.html">pheap</a></td></tr>
147 <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
148 </table><table class="memberdecls">
149 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
150 Macros</h2></td></tr>
151 <tr class="memitem:a2c1ba272dbf334681e0858c6094f8cd9"><td class="memItemLeft" align="right" valign="top"><a id="a2c1ba272dbf334681e0858c6094f8cd9" name="a2c1ba272dbf334681e0858c6094f8cd9"></a>
152 #define&#160;</td><td class="memItemRight" valign="bottom"><b>PARAM_ASSERTIONS_ENABLED_PHEAP</b>&#160;&#160;&#160;0</td></tr>
153 <tr class="separator:a2c1ba272dbf334681e0858c6094f8cd9"><td class="memSeparator" colspan="2">&#160;</td></tr>
154 <tr class="memitem:afadcd7576ad42f9276fc1e83d642aad2"><td class="memItemLeft" align="right" valign="top"><a id="afadcd7576ad42f9276fc1e83d642aad2" name="afadcd7576ad42f9276fc1e83d642aad2"></a>
155 #define&#160;</td><td class="memItemRight" valign="bottom"><b>PICO_PHEAP_MAX_ENTRIES</b>&#160;&#160;&#160;255</td></tr>
156 <tr class="separator:afadcd7576ad42f9276fc1e83d642aad2"><td class="memSeparator" colspan="2">&#160;</td></tr>
157 <tr class="memitem:a9b69785185d58a5f82204c9ee3c2a2d5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a9b69785185d58a5f82204c9ee3c2a2d5">PHEAP_DEFINE_STATIC</a>(name,  _max_nodes)</td></tr>
158 <tr class="memdesc:a9b69785185d58a5f82204c9ee3c2a2d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define a statically allocated pairing heap. This must be initialized by ph_post_alloc_init.  <a href="pheap_8h.html#a9b69785185d58a5f82204c9ee3c2a2d5">More...</a><br /></td></tr>
159 <tr class="separator:a9b69785185d58a5f82204c9ee3c2a2d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
160 </table><table class="memberdecls">
161 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
162 Typedefs</h2></td></tr>
163 <tr class="memitem:a0692045973f15c3302c72f623244ed70"><td class="memItemLeft" align="right" valign="top"><a id="a0692045973f15c3302c72f623244ed70" name="a0692045973f15c3302c72f623244ed70"></a>
164 typedef uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>pheap_node_id_t</b></td></tr>
165 <tr class="separator:a0692045973f15c3302c72f623244ed70"><td class="memSeparator" colspan="2">&#160;</td></tr>
166 <tr class="memitem:a55cc841f8c9956ab1facf0c150bcb81a"><td class="memItemLeft" align="right" valign="top"><a id="a55cc841f8c9956ab1facf0c150bcb81a" name="a55cc841f8c9956ab1facf0c150bcb81a"></a>
167 typedef struct <a class="el" href="structpheap__node.html">pheap_node</a>&#160;</td><td class="memItemRight" valign="bottom"><b>pheap_node_t</b></td></tr>
168 <tr class="separator:a55cc841f8c9956ab1facf0c150bcb81a"><td class="memSeparator" colspan="2">&#160;</td></tr>
169 <tr class="memitem:a0656dff462e9c9b41b60b7c86ba39f09"><td class="memItemLeft" align="right" valign="top">typedef bool(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a0656dff462e9c9b41b60b7c86ba39f09">pheap_comparator</a>) (void *user_data, pheap_node_id_t a, pheap_node_id_t b)</td></tr>
170 <tr class="memdesc:a0656dff462e9c9b41b60b7c86ba39f09"><td class="mdescLeft">&#160;</td><td class="mdescRight">A user comparator function for nodes in a pairing heap.  <a href="pheap_8h.html#a0656dff462e9c9b41b60b7c86ba39f09">More...</a><br /></td></tr>
171 <tr class="separator:a0656dff462e9c9b41b60b7c86ba39f09"><td class="memSeparator" colspan="2">&#160;</td></tr>
172 <tr class="memitem:a08712072a1b1a0c405e0c1807357888f"><td class="memItemLeft" align="right" valign="top"><a id="a08712072a1b1a0c405e0c1807357888f" name="a08712072a1b1a0c405e0c1807357888f"></a>
173 typedef struct <a class="el" href="structpheap.html">pheap</a>&#160;</td><td class="memItemRight" valign="bottom"><b>pheap_t</b></td></tr>
174 <tr class="separator:a08712072a1b1a0c405e0c1807357888f"><td class="memSeparator" colspan="2">&#160;</td></tr>
175 </table><table class="memberdecls">
176 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
177 Functions</h2></td></tr>
178 <tr class="memitem:acde2f3fabd67330b56dbb8473387b272"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#acde2f3fabd67330b56dbb8473387b272">ph_create</a> (uint max_nodes, <a class="el" href="pheap_8h.html#a0656dff462e9c9b41b60b7c86ba39f09">pheap_comparator</a> comparator, void *user_data)</td></tr>
179 <tr class="memdesc:acde2f3fabd67330b56dbb8473387b272"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a pairing heap, which effectively maintains an efficient sorted ordering of nodes. The heap itself stores no user per-node state, it is expected that the user maintains a companion array. A comparator function must be provided so that the heap implementation can determine the relative ordering of nodes.  <a href="pheap_8h.html#acde2f3fabd67330b56dbb8473387b272">More...</a><br /></td></tr>
180 <tr class="separator:acde2f3fabd67330b56dbb8473387b272"><td class="memSeparator" colspan="2">&#160;</td></tr>
181 <tr class="memitem:a1fe718acebd018d31cab37071a65c61b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a1fe718acebd018d31cab37071a65c61b">ph_clear</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap)</td></tr>
182 <tr class="memdesc:a1fe718acebd018d31cab37071a65c61b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes all nodes from the pairing heap.  <a href="pheap_8h.html#a1fe718acebd018d31cab37071a65c61b">More...</a><br /></td></tr>
183 <tr class="separator:a1fe718acebd018d31cab37071a65c61b"><td class="memSeparator" colspan="2">&#160;</td></tr>
184 <tr class="memitem:a0ad42a7be2446ffcdbce6c9c3590eb8e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a0ad42a7be2446ffcdbce6c9c3590eb8e">ph_destroy</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap)</td></tr>
185 <tr class="memdesc:a0ad42a7be2446ffcdbce6c9c3590eb8e"><td class="mdescLeft">&#160;</td><td class="mdescRight">De-allocates a pairing heap.  <a href="pheap_8h.html#a0ad42a7be2446ffcdbce6c9c3590eb8e">More...</a><br /></td></tr>
186 <tr class="separator:a0ad42a7be2446ffcdbce6c9c3590eb8e"><td class="memSeparator" colspan="2">&#160;</td></tr>
187 <tr class="memitem:a93788bb2795becc23f12e268bdeea213"><td class="memItemLeft" align="right" valign="top"><a id="a93788bb2795becc23f12e268bdeea213" name="a93788bb2795becc23f12e268bdeea213"></a>
188 static <a class="el" href="structpheap__node.html">pheap_node_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>ph_get_node</b> (<a class="el" href="structpheap.html">pheap_t</a> *heap, pheap_node_id_t id)</td></tr>
189 <tr class="separator:a93788bb2795becc23f12e268bdeea213"><td class="memSeparator" colspan="2">&#160;</td></tr>
190 <tr class="memitem:a8a21f776fcd536ab440eed0651a93851"><td class="memItemLeft" align="right" valign="top"><a id="a8a21f776fcd536ab440eed0651a93851" name="a8a21f776fcd536ab440eed0651a93851"></a>
191 static void&#160;</td><td class="memItemRight" valign="bottom"><b>ph_add_child_node</b> (<a class="el" href="structpheap.html">pheap_t</a> *heap, pheap_node_id_t parent_id, pheap_node_id_t child_id)</td></tr>
192 <tr class="separator:a8a21f776fcd536ab440eed0651a93851"><td class="memSeparator" colspan="2">&#160;</td></tr>
193 <tr class="memitem:ac62c59afb18a731e763149c20c03d224"><td class="memItemLeft" align="right" valign="top"><a id="ac62c59afb18a731e763149c20c03d224" name="ac62c59afb18a731e763149c20c03d224"></a>
194 static pheap_node_id_t&#160;</td><td class="memItemRight" valign="bottom"><b>ph_merge_nodes</b> (<a class="el" href="structpheap.html">pheap_t</a> *heap, pheap_node_id_t a, pheap_node_id_t b)</td></tr>
195 <tr class="separator:ac62c59afb18a731e763149c20c03d224"><td class="memSeparator" colspan="2">&#160;</td></tr>
196 <tr class="memitem:af631622b2fe9dbd39f39d457eef502d0"><td class="memItemLeft" align="right" valign="top">static pheap_node_id_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#af631622b2fe9dbd39f39d457eef502d0">ph_new_node</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap)</td></tr>
197 <tr class="memdesc:af631622b2fe9dbd39f39d457eef502d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a new node from the unused space in the heap.  <a href="pheap_8h.html#af631622b2fe9dbd39f39d457eef502d0">More...</a><br /></td></tr>
198 <tr class="separator:af631622b2fe9dbd39f39d457eef502d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
199 <tr class="memitem:ab68363a744cae76cf6cce07fc60f4a5c"><td class="memItemLeft" align="right" valign="top">static pheap_node_id_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#ab68363a744cae76cf6cce07fc60f4a5c">ph_insert_node</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap, pheap_node_id_t id)</td></tr>
200 <tr class="memdesc:ab68363a744cae76cf6cce07fc60f4a5c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inserts a node into the heap.  <a href="pheap_8h.html#ab68363a744cae76cf6cce07fc60f4a5c">More...</a><br /></td></tr>
201 <tr class="separator:ab68363a744cae76cf6cce07fc60f4a5c"><td class="memSeparator" colspan="2">&#160;</td></tr>
202 <tr class="memitem:a9723f40e88f36de3cd6cd955e3410600"><td class="memItemLeft" align="right" valign="top">static pheap_node_id_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a9723f40e88f36de3cd6cd955e3410600">ph_peek_head</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap)</td></tr>
203 <tr class="memdesc:a9723f40e88f36de3cd6cd955e3410600"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the head node in the heap, i.e. the node which compares first, but without removing it from the heap.  <a href="pheap_8h.html#a9723f40e88f36de3cd6cd955e3410600">More...</a><br /></td></tr>
204 <tr class="separator:a9723f40e88f36de3cd6cd955e3410600"><td class="memSeparator" colspan="2">&#160;</td></tr>
205 <tr class="memitem:a8ebc494b4ad703fe080bee5f18775fec"><td class="memItemLeft" align="right" valign="top">pheap_node_id_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a8ebc494b4ad703fe080bee5f18775fec">ph_remove_head</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap, bool free)</td></tr>
206 <tr class="memdesc:a8ebc494b4ad703fe080bee5f18775fec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove the head node from the pairing heap. This head node is the node which compares first in the logical ordering provided by the comparator.  <a href="pheap_8h.html#a8ebc494b4ad703fe080bee5f18775fec">More...</a><br /></td></tr>
207 <tr class="separator:a8ebc494b4ad703fe080bee5f18775fec"><td class="memSeparator" colspan="2">&#160;</td></tr>
208 <tr class="memitem:aee7c4944ce644b92572b48b7d14fc65e"><td class="memItemLeft" align="right" valign="top">static pheap_node_id_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#aee7c4944ce644b92572b48b7d14fc65e">ph_remove_and_free_head</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap)</td></tr>
209 <tr class="memdesc:aee7c4944ce644b92572b48b7d14fc65e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove the head node from the pairing heap. This head node is the node which compares first in the logical ordering provided by the comparator.  <a href="pheap_8h.html#aee7c4944ce644b92572b48b7d14fc65e">More...</a><br /></td></tr>
210 <tr class="separator:aee7c4944ce644b92572b48b7d14fc65e"><td class="memSeparator" colspan="2">&#160;</td></tr>
211 <tr class="memitem:a852301ee2d8d4c3985dd61c14eb820a8"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a852301ee2d8d4c3985dd61c14eb820a8">ph_remove_and_free_node</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap, pheap_node_id_t id)</td></tr>
212 <tr class="memdesc:a852301ee2d8d4c3985dd61c14eb820a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove and free an arbitrary node from the pairing heap. This is a more costly operation than removing the head via <a class="el" href="pheap_8h.html#aee7c4944ce644b92572b48b7d14fc65e" title="Remove the head node from the pairing heap. This head node is the node which compares first in the lo...">ph_remove_and_free_head()</a>  <a href="pheap_8h.html#a852301ee2d8d4c3985dd61c14eb820a8">More...</a><br /></td></tr>
213 <tr class="separator:a852301ee2d8d4c3985dd61c14eb820a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
214 <tr class="memitem:a799a2b5a1db608401482816d371a02a5"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a799a2b5a1db608401482816d371a02a5">ph_contains_node</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap, pheap_node_id_t id)</td></tr>
215 <tr class="memdesc:a799a2b5a1db608401482816d371a02a5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine if the heap contains a given node. Note containment refers to whether the node is inserted (<a class="el" href="pheap_8h.html#ab68363a744cae76cf6cce07fc60f4a5c" title="Inserts a node into the heap.">ph_insert_node()</a>) vs allocated (<a class="el" href="pheap_8h.html#af631622b2fe9dbd39f39d457eef502d0" title="Allocate a new node from the unused space in the heap.">ph_new_node()</a>)  <a href="pheap_8h.html#a799a2b5a1db608401482816d371a02a5">More...</a><br /></td></tr>
216 <tr class="separator:a799a2b5a1db608401482816d371a02a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
217 <tr class="memitem:a16d2f59279aad9419ebab05bf15d70b2"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a16d2f59279aad9419ebab05bf15d70b2">ph_free_node</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap, pheap_node_id_t id)</td></tr>
218 <tr class="memdesc:a16d2f59279aad9419ebab05bf15d70b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free a node that is not currently in the heap, but has been allocated.  <a href="pheap_8h.html#a16d2f59279aad9419ebab05bf15d70b2">More...</a><br /></td></tr>
219 <tr class="separator:a16d2f59279aad9419ebab05bf15d70b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
220 <tr class="memitem:aaac9dd2a264364a16a5753ba08c268cf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#aaac9dd2a264364a16a5753ba08c268cf">ph_dump</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap, void(*dump_key)(pheap_node_id_t id, void *user_data), void *user_data)</td></tr>
221 <tr class="memdesc:aaac9dd2a264364a16a5753ba08c268cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print a representation of the heap for debugging.  <a href="pheap_8h.html#aaac9dd2a264364a16a5753ba08c268cf">More...</a><br /></td></tr>
222 <tr class="separator:aaac9dd2a264364a16a5753ba08c268cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
223 <tr class="memitem:a5f8a3b950288b90310216126750ae0ef"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pheap_8h.html#a5f8a3b950288b90310216126750ae0ef">ph_post_alloc_init</a> (<a class="el" href="structpheap.html">pheap_t</a> *heap, uint max_nodes, <a class="el" href="pheap_8h.html#a0656dff462e9c9b41b60b7c86ba39f09">pheap_comparator</a> comparator, void *user_data)</td></tr>
224 <tr class="memdesc:a5f8a3b950288b90310216126750ae0ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize a statically allocated heap (<a class="el" href="pheap_8h.html#acde2f3fabd67330b56dbb8473387b272" title="Create a pairing heap, which effectively maintains an efficient sorted ordering of nodes....">ph_create()</a> using the C heap). The heap member <code>nodes</code> must be allocated of size max_nodes.  <a href="pheap_8h.html#a5f8a3b950288b90310216126750ae0ef">More...</a><br /></td></tr>
225 <tr class="separator:a5f8a3b950288b90310216126750ae0ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
226 </table>
227 <h2 class="groupheader">Macro Definition Documentation</h2>
228 <a id="a9b69785185d58a5f82204c9ee3c2a2d5" name="a9b69785185d58a5f82204c9ee3c2a2d5"></a>
229 <h2 class="memtitle"><span class="permalink"><a href="#a9b69785185d58a5f82204c9ee3c2a2d5">&#9670;&nbsp;</a></span>PHEAP_DEFINE_STATIC</h2>
230
231 <div class="memitem">
232 <div class="memproto">
233       <table class="memname">
234         <tr>
235           <td class="memname">#define PHEAP_DEFINE_STATIC</td>
236           <td>(</td>
237           <td class="paramtype">&#160;</td>
238           <td class="paramname">name, </td>
239         </tr>
240         <tr>
241           <td class="paramkey"></td>
242           <td></td>
243           <td class="paramtype">&#160;</td>
244           <td class="paramname">_max_nodes&#160;</td>
245         </tr>
246         <tr>
247           <td></td>
248           <td>)</td>
249           <td></td><td></td>
250         </tr>
251       </table>
252 </div><div class="memdoc">
253 <b>Value:</b><div class="fragment"><div class="line">    <span class="keyword">static_assert</span>(_max_nodes &amp;&amp; _max_nodes &lt; (1u &lt;&lt; (8 * <span class="keyword">sizeof</span>(pheap_node_id_t))), <span class="stringliteral">&quot;&quot;</span>); \</div>
254 <div class="line">    static <a class="code hl_struct" href="structpheap__node.html">pheap_node_t</a> name ## _nodes[_max_nodes]; \</div>
255 <div class="line">    static <a class="code hl_struct" href="structpheap.html">pheap_t</a> name = { \</div>
256 <div class="line">            .nodes = name ## _nodes, \</div>
257 <div class="line">            .max_nodes = _max_nodes \</div>
258 <div class="line">    };</div>
259 <div class="ttc" id="astructpheap__node_html"><div class="ttname"><a href="structpheap__node.html">pheap_node</a></div><div class="ttdef"><b>Definition:</b> pheap.h:51</div></div>
260 <div class="ttc" id="astructpheap_html"><div class="ttname"><a href="structpheap.html">pheap</a></div><div class="ttdef"><b>Definition:</b> pheap.h:62</div></div>
261 </div><!-- fragment -->
262 <p>Define a statically allocated pairing heap. This must be initialized by ph_post_alloc_init. </p>
263
264 </div>
265 </div>
266 <h2 class="groupheader">Typedef Documentation</h2>
267 <a id="a0656dff462e9c9b41b60b7c86ba39f09" name="a0656dff462e9c9b41b60b7c86ba39f09"></a>
268 <h2 class="memtitle"><span class="permalink"><a href="#a0656dff462e9c9b41b60b7c86ba39f09">&#9670;&nbsp;</a></span>pheap_comparator</h2>
269
270 <div class="memitem">
271 <div class="memproto">
272       <table class="memname">
273         <tr>
274           <td class="memname">typedef bool(* pheap_comparator) (void *user_data, pheap_node_id_t a, pheap_node_id_t b)</td>
275         </tr>
276       </table>
277 </div><div class="memdoc">
278
279 <p>A user comparator function for nodes in a pairing heap. </p>
280 <dl class="section return"><dt>Returns</dt><dd>true if a &lt; b in natural order. Note this relative ordering must be stable from call to call. </dd></dl>
281
282 </div>
283 </div>
284 <h2 class="groupheader">Function Documentation</h2>
285 <a id="a1fe718acebd018d31cab37071a65c61b" name="a1fe718acebd018d31cab37071a65c61b"></a>
286 <h2 class="memtitle"><span class="permalink"><a href="#a1fe718acebd018d31cab37071a65c61b">&#9670;&nbsp;</a></span>ph_clear()</h2>
287
288 <div class="memitem">
289 <div class="memproto">
290       <table class="memname">
291         <tr>
292           <td class="memname">void ph_clear </td>
293           <td>(</td>
294           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
295           <td class="paramname"><em>heap</em></td><td>)</td>
296           <td></td>
297         </tr>
298       </table>
299 </div><div class="memdoc">
300
301 <p>Removes all nodes from the pairing heap. </p>
302 <dl class="params"><dt>Parameters</dt><dd>
303   <table class="params">
304     <tr><td class="paramname">heap</td><td>the heap </td></tr>
305   </table>
306   </dd>
307 </dl>
308
309 </div>
310 </div>
311 <a id="a799a2b5a1db608401482816d371a02a5" name="a799a2b5a1db608401482816d371a02a5"></a>
312 <h2 class="memtitle"><span class="permalink"><a href="#a799a2b5a1db608401482816d371a02a5">&#9670;&nbsp;</a></span>ph_contains_node()</h2>
313
314 <div class="memitem">
315 <div class="memproto">
316 <table class="mlabels">
317   <tr>
318   <td class="mlabels-left">
319       <table class="memname">
320         <tr>
321           <td class="memname">static bool ph_contains_node </td>
322           <td>(</td>
323           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
324           <td class="paramname"><em>heap</em>, </td>
325         </tr>
326         <tr>
327           <td class="paramkey"></td>
328           <td></td>
329           <td class="paramtype">pheap_node_id_t&#160;</td>
330           <td class="paramname"><em>id</em>&#160;</td>
331         </tr>
332         <tr>
333           <td></td>
334           <td>)</td>
335           <td></td><td></td>
336         </tr>
337       </table>
338   </td>
339   <td class="mlabels-right">
340 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
341   </tr>
342 </table>
343 </div><div class="memdoc">
344
345 <p>Determine if the heap contains a given node. Note containment refers to whether the node is inserted (<a class="el" href="pheap_8h.html#ab68363a744cae76cf6cce07fc60f4a5c" title="Inserts a node into the heap.">ph_insert_node()</a>) vs allocated (<a class="el" href="pheap_8h.html#af631622b2fe9dbd39f39d457eef502d0" title="Allocate a new node from the unused space in the heap.">ph_new_node()</a>) </p>
346 <dl class="params"><dt>Parameters</dt><dd>
347   <table class="params">
348     <tr><td class="paramname">heap</td><td>the heap </td></tr>
349     <tr><td class="paramname">id</td><td>the id of the node </td></tr>
350   </table>
351   </dd>
352 </dl>
353 <dl class="section return"><dt>Returns</dt><dd>true if the heap contains a node with the given id, false otherwise. </dd></dl>
354
355 </div>
356 </div>
357 <a id="acde2f3fabd67330b56dbb8473387b272" name="acde2f3fabd67330b56dbb8473387b272"></a>
358 <h2 class="memtitle"><span class="permalink"><a href="#acde2f3fabd67330b56dbb8473387b272">&#9670;&nbsp;</a></span>ph_create()</h2>
359
360 <div class="memitem">
361 <div class="memproto">
362       <table class="memname">
363         <tr>
364           <td class="memname"><a class="el" href="structpheap.html">pheap_t</a> * ph_create </td>
365           <td>(</td>
366           <td class="paramtype">uint&#160;</td>
367           <td class="paramname"><em>max_nodes</em>, </td>
368         </tr>
369         <tr>
370           <td class="paramkey"></td>
371           <td></td>
372           <td class="paramtype"><a class="el" href="pheap_8h.html#a0656dff462e9c9b41b60b7c86ba39f09">pheap_comparator</a>&#160;</td>
373           <td class="paramname"><em>comparator</em>, </td>
374         </tr>
375         <tr>
376           <td class="paramkey"></td>
377           <td></td>
378           <td class="paramtype">void *&#160;</td>
379           <td class="paramname"><em>user_data</em>&#160;</td>
380         </tr>
381         <tr>
382           <td></td>
383           <td>)</td>
384           <td></td><td></td>
385         </tr>
386       </table>
387 </div><div class="memdoc">
388
389 <p>Create a pairing heap, which effectively maintains an efficient sorted ordering of nodes. The heap itself stores no user per-node state, it is expected that the user maintains a companion array. A comparator function must be provided so that the heap implementation can determine the relative ordering of nodes. </p>
390 <dl class="params"><dt>Parameters</dt><dd>
391   <table class="params">
392     <tr><td class="paramname">max_nodes</td><td>the maximum number of nodes that may be in the heap (this is bounded by PICO_PHEAP_MAX_ENTRIES which defaults to 255 to be able to store indexes in a single byte). </td></tr>
393     <tr><td class="paramname">comparator</td><td>the node comparison function </td></tr>
394     <tr><td class="paramname">user_data</td><td>a user data pointer associated with the heap that is provided in callbacks </td></tr>
395   </table>
396   </dd>
397 </dl>
398 <dl class="section return"><dt>Returns</dt><dd>a newly allocated and initialized heap </dd></dl>
399
400 </div>
401 </div>
402 <a id="a0ad42a7be2446ffcdbce6c9c3590eb8e" name="a0ad42a7be2446ffcdbce6c9c3590eb8e"></a>
403 <h2 class="memtitle"><span class="permalink"><a href="#a0ad42a7be2446ffcdbce6c9c3590eb8e">&#9670;&nbsp;</a></span>ph_destroy()</h2>
404
405 <div class="memitem">
406 <div class="memproto">
407       <table class="memname">
408         <tr>
409           <td class="memname">void ph_destroy </td>
410           <td>(</td>
411           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
412           <td class="paramname"><em>heap</em></td><td>)</td>
413           <td></td>
414         </tr>
415       </table>
416 </div><div class="memdoc">
417
418 <p>De-allocates a pairing heap. </p>
419 <p >Note this method must <em>ONLY</em> be called on heaps created by <a class="el" href="pheap_8h.html#acde2f3fabd67330b56dbb8473387b272" title="Create a pairing heap, which effectively maintains an efficient sorted ordering of nodes....">ph_create()</a> </p><dl class="params"><dt>Parameters</dt><dd>
420   <table class="params">
421     <tr><td class="paramname">heap</td><td>the heap </td></tr>
422   </table>
423   </dd>
424 </dl>
425
426 </div>
427 </div>
428 <a id="aaac9dd2a264364a16a5753ba08c268cf" name="aaac9dd2a264364a16a5753ba08c268cf"></a>
429 <h2 class="memtitle"><span class="permalink"><a href="#aaac9dd2a264364a16a5753ba08c268cf">&#9670;&nbsp;</a></span>ph_dump()</h2>
430
431 <div class="memitem">
432 <div class="memproto">
433       <table class="memname">
434         <tr>
435           <td class="memname">void ph_dump </td>
436           <td>(</td>
437           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
438           <td class="paramname"><em>heap</em>, </td>
439         </tr>
440         <tr>
441           <td class="paramkey"></td>
442           <td></td>
443           <td class="paramtype">void(*)(pheap_node_id_t id, void *user_data)&#160;</td>
444           <td class="paramname"><em>dump_key</em>, </td>
445         </tr>
446         <tr>
447           <td class="paramkey"></td>
448           <td></td>
449           <td class="paramtype">void *&#160;</td>
450           <td class="paramname"><em>user_data</em>&#160;</td>
451         </tr>
452         <tr>
453           <td></td>
454           <td>)</td>
455           <td></td><td></td>
456         </tr>
457       </table>
458 </div><div class="memdoc">
459
460 <p>Print a representation of the heap for debugging. </p>
461 <dl class="params"><dt>Parameters</dt><dd>
462   <table class="params">
463     <tr><td class="paramname">heap</td><td>the heap </td></tr>
464     <tr><td class="paramname">dump_key</td><td>a method to print a node value </td></tr>
465     <tr><td class="paramname">user_data</td><td>the user data to pass to the dump_key method </td></tr>
466   </table>
467   </dd>
468 </dl>
469
470 </div>
471 </div>
472 <a id="a16d2f59279aad9419ebab05bf15d70b2" name="a16d2f59279aad9419ebab05bf15d70b2"></a>
473 <h2 class="memtitle"><span class="permalink"><a href="#a16d2f59279aad9419ebab05bf15d70b2">&#9670;&nbsp;</a></span>ph_free_node()</h2>
474
475 <div class="memitem">
476 <div class="memproto">
477 <table class="mlabels">
478   <tr>
479   <td class="mlabels-left">
480       <table class="memname">
481         <tr>
482           <td class="memname">static void ph_free_node </td>
483           <td>(</td>
484           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
485           <td class="paramname"><em>heap</em>, </td>
486         </tr>
487         <tr>
488           <td class="paramkey"></td>
489           <td></td>
490           <td class="paramtype">pheap_node_id_t&#160;</td>
491           <td class="paramname"><em>id</em>&#160;</td>
492         </tr>
493         <tr>
494           <td></td>
495           <td>)</td>
496           <td></td><td></td>
497         </tr>
498       </table>
499   </td>
500   <td class="mlabels-right">
501 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
502   </tr>
503 </table>
504 </div><div class="memdoc">
505
506 <p>Free a node that is not currently in the heap, but has been allocated. </p>
507 <dl class="params"><dt>Parameters</dt><dd>
508   <table class="params">
509     <tr><td class="paramname">heap</td><td>the heap </td></tr>
510     <tr><td class="paramname">id</td><td>the id of the node </td></tr>
511   </table>
512   </dd>
513 </dl>
514
515 </div>
516 </div>
517 <a id="ab68363a744cae76cf6cce07fc60f4a5c" name="ab68363a744cae76cf6cce07fc60f4a5c"></a>
518 <h2 class="memtitle"><span class="permalink"><a href="#ab68363a744cae76cf6cce07fc60f4a5c">&#9670;&nbsp;</a></span>ph_insert_node()</h2>
519
520 <div class="memitem">
521 <div class="memproto">
522 <table class="mlabels">
523   <tr>
524   <td class="mlabels-left">
525       <table class="memname">
526         <tr>
527           <td class="memname">static pheap_node_id_t ph_insert_node </td>
528           <td>(</td>
529           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
530           <td class="paramname"><em>heap</em>, </td>
531         </tr>
532         <tr>
533           <td class="paramkey"></td>
534           <td></td>
535           <td class="paramtype">pheap_node_id_t&#160;</td>
536           <td class="paramname"><em>id</em>&#160;</td>
537         </tr>
538         <tr>
539           <td></td>
540           <td>)</td>
541           <td></td><td></td>
542         </tr>
543       </table>
544   </td>
545   <td class="mlabels-right">
546 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
547   </tr>
548 </table>
549 </div><div class="memdoc">
550
551 <p>Inserts a node into the heap. </p>
552 <p >This method inserts a node (previously allocated by <a class="el" href="pheap_8h.html#af631622b2fe9dbd39f39d457eef502d0" title="Allocate a new node from the unused space in the heap.">ph_new_node()</a>) into the heap, determining the correct order by calling the heap's comparator</p>
553 <dl class="params"><dt>Parameters</dt><dd>
554   <table class="params">
555     <tr><td class="paramname">heap</td><td>the heap </td></tr>
556     <tr><td class="paramname">id</td><td>the id of the node to insert </td></tr>
557   </table>
558   </dd>
559 </dl>
560 <dl class="section return"><dt>Returns</dt><dd>the id of the new head of the pairing heap (i.e. node that compares first) </dd></dl>
561
562 </div>
563 </div>
564 <a id="af631622b2fe9dbd39f39d457eef502d0" name="af631622b2fe9dbd39f39d457eef502d0"></a>
565 <h2 class="memtitle"><span class="permalink"><a href="#af631622b2fe9dbd39f39d457eef502d0">&#9670;&nbsp;</a></span>ph_new_node()</h2>
566
567 <div class="memitem">
568 <div class="memproto">
569 <table class="mlabels">
570   <tr>
571   <td class="mlabels-left">
572       <table class="memname">
573         <tr>
574           <td class="memname">static pheap_node_id_t ph_new_node </td>
575           <td>(</td>
576           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
577           <td class="paramname"><em>heap</em></td><td>)</td>
578           <td></td>
579         </tr>
580       </table>
581   </td>
582   <td class="mlabels-right">
583 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
584   </tr>
585 </table>
586 </div><div class="memdoc">
587
588 <p>Allocate a new node from the unused space in the heap. </p>
589 <dl class="params"><dt>Parameters</dt><dd>
590   <table class="params">
591     <tr><td class="paramname">heap</td><td>the heap </td></tr>
592   </table>
593   </dd>
594 </dl>
595 <dl class="section return"><dt>Returns</dt><dd>an identifier for the node, or 0 if the heap is full </dd></dl>
596
597 </div>
598 </div>
599 <a id="a9723f40e88f36de3cd6cd955e3410600" name="a9723f40e88f36de3cd6cd955e3410600"></a>
600 <h2 class="memtitle"><span class="permalink"><a href="#a9723f40e88f36de3cd6cd955e3410600">&#9670;&nbsp;</a></span>ph_peek_head()</h2>
601
602 <div class="memitem">
603 <div class="memproto">
604 <table class="mlabels">
605   <tr>
606   <td class="mlabels-left">
607       <table class="memname">
608         <tr>
609           <td class="memname">static pheap_node_id_t ph_peek_head </td>
610           <td>(</td>
611           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
612           <td class="paramname"><em>heap</em></td><td>)</td>
613           <td></td>
614         </tr>
615       </table>
616   </td>
617   <td class="mlabels-right">
618 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
619   </tr>
620 </table>
621 </div><div class="memdoc">
622
623 <p>Returns the head node in the heap, i.e. the node which compares first, but without removing it from the heap. </p>
624 <dl class="params"><dt>Parameters</dt><dd>
625   <table class="params">
626     <tr><td class="paramname">heap</td><td>the heap </td></tr>
627   </table>
628   </dd>
629 </dl>
630 <dl class="section return"><dt>Returns</dt><dd>the current head node id </dd></dl>
631
632 </div>
633 </div>
634 <a id="a5f8a3b950288b90310216126750ae0ef" name="a5f8a3b950288b90310216126750ae0ef"></a>
635 <h2 class="memtitle"><span class="permalink"><a href="#a5f8a3b950288b90310216126750ae0ef">&#9670;&nbsp;</a></span>ph_post_alloc_init()</h2>
636
637 <div class="memitem">
638 <div class="memproto">
639       <table class="memname">
640         <tr>
641           <td class="memname">void ph_post_alloc_init </td>
642           <td>(</td>
643           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
644           <td class="paramname"><em>heap</em>, </td>
645         </tr>
646         <tr>
647           <td class="paramkey"></td>
648           <td></td>
649           <td class="paramtype">uint&#160;</td>
650           <td class="paramname"><em>max_nodes</em>, </td>
651         </tr>
652         <tr>
653           <td class="paramkey"></td>
654           <td></td>
655           <td class="paramtype"><a class="el" href="pheap_8h.html#a0656dff462e9c9b41b60b7c86ba39f09">pheap_comparator</a>&#160;</td>
656           <td class="paramname"><em>comparator</em>, </td>
657         </tr>
658         <tr>
659           <td class="paramkey"></td>
660           <td></td>
661           <td class="paramtype">void *&#160;</td>
662           <td class="paramname"><em>user_data</em>&#160;</td>
663         </tr>
664         <tr>
665           <td></td>
666           <td>)</td>
667           <td></td><td></td>
668         </tr>
669       </table>
670 </div><div class="memdoc">
671
672 <p>Initialize a statically allocated heap (<a class="el" href="pheap_8h.html#acde2f3fabd67330b56dbb8473387b272" title="Create a pairing heap, which effectively maintains an efficient sorted ordering of nodes....">ph_create()</a> using the C heap). The heap member <code>nodes</code> must be allocated of size max_nodes. </p>
673 <dl class="params"><dt>Parameters</dt><dd>
674   <table class="params">
675     <tr><td class="paramname">heap</td><td>the heap </td></tr>
676     <tr><td class="paramname">max_nodes</td><td>the max number of nodes in the heap (matching the size of the heap's nodes array) </td></tr>
677     <tr><td class="paramname">comparator</td><td>the comparator for the heap </td></tr>
678     <tr><td class="paramname">user_data</td><td>the user data for the heap. </td></tr>
679   </table>
680   </dd>
681 </dl>
682
683 </div>
684 </div>
685 <a id="aee7c4944ce644b92572b48b7d14fc65e" name="aee7c4944ce644b92572b48b7d14fc65e"></a>
686 <h2 class="memtitle"><span class="permalink"><a href="#aee7c4944ce644b92572b48b7d14fc65e">&#9670;&nbsp;</a></span>ph_remove_and_free_head()</h2>
687
688 <div class="memitem">
689 <div class="memproto">
690 <table class="mlabels">
691   <tr>
692   <td class="mlabels-left">
693       <table class="memname">
694         <tr>
695           <td class="memname">static pheap_node_id_t ph_remove_and_free_head </td>
696           <td>(</td>
697           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
698           <td class="paramname"><em>heap</em></td><td>)</td>
699           <td></td>
700         </tr>
701       </table>
702   </td>
703   <td class="mlabels-right">
704 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
705   </tr>
706 </table>
707 </div><div class="memdoc">
708
709 <p>Remove the head node from the pairing heap. This head node is the node which compares first in the logical ordering provided by the comparator. </p>
710 <p >Note that the returned id will be freed, and thus may be re-used by future node allocations, so the caller should retrieve any per node state from the companion array before modifying the heap further.</p>
711 <dl class="params"><dt>Parameters</dt><dd>
712   <table class="params">
713     <tr><td class="paramname">heap</td><td>the heap </td></tr>
714   </table>
715   </dd>
716 </dl>
717 <dl class="section return"><dt>Returns</dt><dd>the old head node id. </dd></dl>
718
719 </div>
720 </div>
721 <a id="a852301ee2d8d4c3985dd61c14eb820a8" name="a852301ee2d8d4c3985dd61c14eb820a8"></a>
722 <h2 class="memtitle"><span class="permalink"><a href="#a852301ee2d8d4c3985dd61c14eb820a8">&#9670;&nbsp;</a></span>ph_remove_and_free_node()</h2>
723
724 <div class="memitem">
725 <div class="memproto">
726       <table class="memname">
727         <tr>
728           <td class="memname">bool ph_remove_and_free_node </td>
729           <td>(</td>
730           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
731           <td class="paramname"><em>heap</em>, </td>
732         </tr>
733         <tr>
734           <td class="paramkey"></td>
735           <td></td>
736           <td class="paramtype">pheap_node_id_t&#160;</td>
737           <td class="paramname"><em>id</em>&#160;</td>
738         </tr>
739         <tr>
740           <td></td>
741           <td>)</td>
742           <td></td><td></td>
743         </tr>
744       </table>
745 </div><div class="memdoc">
746
747 <p>Remove and free an arbitrary node from the pairing heap. This is a more costly operation than removing the head via <a class="el" href="pheap_8h.html#aee7c4944ce644b92572b48b7d14fc65e" title="Remove the head node from the pairing heap. This head node is the node which compares first in the lo...">ph_remove_and_free_head()</a> </p>
748 <dl class="params"><dt>Parameters</dt><dd>
749   <table class="params">
750     <tr><td class="paramname">heap</td><td>the heap </td></tr>
751     <tr><td class="paramname">id</td><td>the id of the node to free </td></tr>
752   </table>
753   </dd>
754 </dl>
755 <dl class="section return"><dt>Returns</dt><dd>true if the the node was in the heap, false otherwise </dd></dl>
756
757 </div>
758 </div>
759 <a id="a8ebc494b4ad703fe080bee5f18775fec" name="a8ebc494b4ad703fe080bee5f18775fec"></a>
760 <h2 class="memtitle"><span class="permalink"><a href="#a8ebc494b4ad703fe080bee5f18775fec">&#9670;&nbsp;</a></span>ph_remove_head()</h2>
761
762 <div class="memitem">
763 <div class="memproto">
764       <table class="memname">
765         <tr>
766           <td class="memname">pheap_node_id_t ph_remove_head </td>
767           <td>(</td>
768           <td class="paramtype"><a class="el" href="structpheap.html">pheap_t</a> *&#160;</td>
769           <td class="paramname"><em>heap</em>, </td>
770         </tr>
771         <tr>
772           <td class="paramkey"></td>
773           <td></td>
774           <td class="paramtype">bool&#160;</td>
775           <td class="paramname"><em>free</em>&#160;</td>
776         </tr>
777         <tr>
778           <td></td>
779           <td>)</td>
780           <td></td><td></td>
781         </tr>
782       </table>
783 </div><div class="memdoc">
784
785 <p>Remove the head node from the pairing heap. This head node is the node which compares first in the logical ordering provided by the comparator. </p>
786 <p >Note that in the case of free == true, the returned id is no longer allocated and may be re-used by future node allocations, so the caller should retrieve any per node state from the companion array before modifying the heap further.</p>
787 <dl class="params"><dt>Parameters</dt><dd>
788   <table class="params">
789     <tr><td class="paramname">heap</td><td>the heap </td></tr>
790     <tr><td class="paramname">free</td><td>true if the id is also to be freed; false if not - useful if the caller may wish to re-insert an item with the same id) </td></tr>
791   </table>
792   </dd>
793 </dl>
794 <dl class="section return"><dt>Returns</dt><dd>the old head node id. </dd></dl>
795
796 </div>
797 </div>
798 </div><!-- contents -->
799 </div><!-- doc-content -->
800
801         <script src="main.js"></script>
802 </body>
803 </html>
This page took 0.075844 seconds and 4 git commands to generate.