Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 0b420d0fce195cf4115dc6a3be5c2da2 > files > 246

sphinxbase-devel-0.7-1.fc14.i686.rpm

<!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"/>
<title>SphinxBase: include/sphinxbase/heap.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">SphinxBase&#160;<span id="projectnumber">0.6</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('heap_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<h1>include/sphinxbase/heap.h File Reference</h1>  </div>
</div>
<div class="contents">

<p>Heap Implementation.  
<a href="#_details">More...</a></p>
<div class="textblock"><code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;sphinxbase/sphinxbase_export.h&gt;</code><br/>
<code>#include &lt;sphinxbase/prim_type.h&gt;</code><br/>
</div>
<p><a href="heap_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0ffa4ec8648c254bf19eee352b69dc7a"></a><!-- doxytag: member="heap.h::heap_t" ref="a0ffa4ec8648c254bf19eee352b69dc7a" args="" -->
typedef struct <a class="el" href="structheap__s.html">heap_s</a>&#160;</td><td class="memItemRight" valign="bottom"><b>heap_t</b></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9bc21333ce58caaf58e802d8b0190efd"></a><!-- doxytag: member="heap.h::heap_new" ref="a9bc21333ce58caaf58e802d8b0190efd" args="(void)" -->
SPHINXBASE_EXPORT <a class="el" href="structheap__s.html">heap_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="heap_8h.html#a9bc21333ce58caaf58e802d8b0190efd">heap_new</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a new heap and return handle to it. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="heap_8h.html#a64bcded2de5086c5d246ff760caa74a3">heap_insert</a> (<a class="el" href="structheap__s.html">heap_t</a> *heap, void *data, int32 val)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert a new item into the given heap.  <a href="#a64bcded2de5086c5d246ff760caa74a3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="heap_8h.html#ae70da6b59215654c2cd5ec177eaf2aec">heap_top</a> (<a class="el" href="structheap__s.html">heap_t</a> *heap, void **data, int32 *val)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the topmost item in the heap.  <a href="#ae70da6b59215654c2cd5ec177eaf2aec"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a387c8913b4c62ad1a5c4702a4e6dbdbf"></a><!-- doxytag: member="heap.h::heap_pop" ref="a387c8913b4c62ad1a5c4702a4e6dbdbf" args="(heap_t *heap, void **data, int32 *val)" -->
SPHINXBASE_EXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="heap_8h.html#a387c8913b4c62ad1a5c4702a4e6dbdbf">heap_pop</a> (<a class="el" href="structheap__s.html">heap_t</a> *heap, void **data, int32 *val)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Like heap_top but also pop the top item off the heap. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa2dbc059f9707e434098694e8c69157e"></a><!-- doxytag: member="heap.h::heap_remove" ref="aa2dbc059f9707e434098694e8c69157e" args="(heap_t *heap, void *data)" -->
SPHINXBASE_EXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="heap_8h.html#aa2dbc059f9707e434098694e8c69157e">heap_remove</a> (<a class="el" href="structheap__s.html">heap_t</a> *heap, void *data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove an item from the heap. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1c713d67123e96974505edfa4346cb0f"></a><!-- doxytag: member="heap.h::heap_size" ref="a1c713d67123e96974505edfa4346cb0f" args="(heap_t *heap)" -->
SPHINXBASE_EXPORT size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="heap_8h.html#a1c713d67123e96974505edfa4346cb0f">heap_size</a> (<a class="el" href="structheap__s.html">heap_t</a> *heap)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the number of items in the heap. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="heap_8h.html#ab12b1efd6392eb574d2da9c981e7320c">heap_destroy</a> (<a class="el" href="structheap__s.html">heap_t</a> *heap)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy the given heap; free the heap nodes.  <a href="#ab12b1efd6392eb574d2da9c981e7320c"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Heap Implementation. </p>
<p>General Comment: Sorted heap structure with three main operations:</p>
<p>1. Insert a data item (with two attributes: an application supplied pointer and an integer value; the heap is maintained in ascending order of the integer value). 2. Return the currently topmost item (i.e., item with smallest associated value). 3. Return the currently topmost item and pop it off the heap. </p>

<p>Definition in file <a class="el" href="heap_8h_source.html">heap.h</a>.</p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="ab12b1efd6392eb574d2da9c981e7320c"></a><!-- doxytag: member="heap.h::heap_destroy" ref="ab12b1efd6392eb574d2da9c981e7320c" args="(heap_t *heap)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int heap_destroy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structheap__s.html">heap_t</a> *&#160;</td>
          <td class="paramname"><em>heap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destroy the given heap; free the heap nodes. </p>
<p>NOTE: Data pointers in the nodes are NOT freed. Return value: 0 if successful, -1 otherwise. </p>

<p>Definition at line <a class="el" href="heap_8c_source.html#l00281">281</a> of file <a class="el" href="heap_8c_source.html">heap.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8c_source.html#l00241">ckd_free()</a>, <a class="el" href="heap_8c_source.html#l00281">heap_destroy()</a>, and <a class="el" href="heap_8c_source.html#l00209">heap_pop()</a>.</p>

<p>Referenced by <a class="el" href="heap_8c_source.html#l00281">heap_destroy()</a>, <a class="el" href="huff__code_8c_source.html#l00229">huff_code_build_int()</a>, and <a class="el" href="huff__code_8c_source.html#l00269">huff_code_build_str()</a>.</p>

</div>
</div>
<a class="anchor" id="a64bcded2de5086c5d246ff760caa74a3"></a><!-- doxytag: member="heap.h::heap_insert" ref="a64bcded2de5086c5d246ff760caa74a3" args="(heap_t *heap, void *data, int32 val)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int heap_insert </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structheap__s.html">heap_t</a> *&#160;</td>
          <td class="paramname"><em>heap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>val</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Insert a new item into the given heap. </p>
<p>Return value: 0 if successful, -1 otherwise. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">heap</td><td>In: Heap into which item is to be inserted </td></tr>
    <tr><td class="paramname">data</td><td>In: Application-determined data pointer </td></tr>
    <tr><td class="paramname">val</td><td>In: According to item entered in sorted heap </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="heap_8c_source.html#l00161">161</a> of file <a class="el" href="heap_8c_source.html">heap.c</a>.</p>

<p>References <a class="el" href="heap_8c_source.html#l00161">heap_insert()</a>.</p>

<p>Referenced by <a class="el" href="heap_8c_source.html#l00161">heap_insert()</a>, <a class="el" href="huff__code_8c_source.html#l00229">huff_code_build_int()</a>, and <a class="el" href="huff__code_8c_source.html#l00269">huff_code_build_str()</a>.</p>

</div>
</div>
<a class="anchor" id="ae70da6b59215654c2cd5ec177eaf2aec"></a><!-- doxytag: member="heap.h::heap_top" ref="ae70da6b59215654c2cd5ec177eaf2aec" args="(heap_t *heap, void **data, int32 *val)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int heap_top </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structheap__s.html">heap_t</a> *&#160;</td>
          <td class="paramname"><em>heap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32 *&#160;</td>
          <td class="paramname"><em>val</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the topmost item in the heap. </p>
<p>Return value: 1 if heap is not empty and the topmost value is returned; 0 if heap is empty; -1 if some error occurred. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">heap</td><td>In: Heap whose topmost item is to be returned </td></tr>
    <tr><td class="paramname">data</td><td>Out: Data pointer associated with the topmost item </td></tr>
    <tr><td class="paramname">val</td><td>Out: Value associated with the topmost item </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="heap_8c_source.html#l00221">221</a> of file <a class="el" href="heap_8c_source.html">heap.c</a>.</p>

<p>References <a class="el" href="heap_8c_source.html#l00078">heapnode_s::data</a>, <a class="el" href="heap_8c_source.html#l00221">heap_top()</a>, and <a class="el" href="heap_8c_source.html#l00079">heapnode_s::val</a>.</p>

<p>Referenced by <a class="el" href="heap_8c_source.html#l00221">heap_top()</a>.</p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="heap_8h.html">heap.h</a>      </li>
      <li class="footer">Generated on Tue Apr 19 2011 for SphinxBase by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>