Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bad97183153701b09df5fae1052b1c30 > files > 645

crystalspace-doc-1.2.1-5mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Crystal Space 1.2.1: csHashReversible&lt; T, K &gt; Class Template Reference (Crystal Space 1.2.1 Public API Reference)</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="head">
 <tr height="59">
  <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td>
  <td class="head"><h2>Public API Reference</h2></td>
 </tr>
 <tr height="11">
  <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td>
 </tr>
</table>
<div class="content">
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li class="current"><a href="classes.html"><span>Classes</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<div class="tabs">
  <ul>
    <li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
    <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
    <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
    <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  </ul>
</div>
<h1>csHashReversible&lt; T, K &gt; Class Template Reference<br>
<small>
[<a class="el" href="group__util__containers.html">Containers</a>]</small>
</h1><!-- doxytag: class="csHashReversible" --><!-- doxytag: inherits="csHash" -->A csHash&lt;&gt; that maintains a reverse hash for indexing keys by values.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="hashr_8h-source.html">csutil/hashr.h</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for csHashReversible&lt; T, K &gt;:</div>
<div class="dynsection">
<p><center><img src="classcsHashReversible__inherit__graph.png" border="0" usemap="#csHashReversible_3_01T_00_01K_01_4__inherit__map" alt="Inheritance graph"></center>
<map name="csHashReversible_3_01T_00_01K_01_4__inherit__map">
<area shape="rect" href="classcsHash.html" title="A generic hash table class, which grows dynamically and whose buckets are unsorted..." alt="" coords="39,7,159,33"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="classcsHashReversible-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsHashReversible.html#515d7120e465c7cdb1514a7209453070">csHashReversible</a> (int size=23, int grow_rate=5, int max_size=20000)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct a hash table with an array of the given size, which for optimisation reasons should be a prime number.  <a href="#515d7120e465c7cdb1514a7209453070"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const K &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsHashReversible.html#df9e60784822033fd979ea74be9edf7d">GetKey</a> (const T &amp;key, const K &amp;fallback) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the first key matching the given value, or <code>fallback</code> if there is none.  <a href="#df9e60784822033fd979ea74be9edf7d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const K *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsHashReversible.html#7af49a66a38bfa2ca2dccd64935df959">GetKeyPointer</a> (const T &amp;key) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a pointer to the first key matching the given value, or 0 if there is none.  <a href="#7af49a66a38bfa2ca2dccd64935df959"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsHashReversible.html#9c25406a6642d4e8f2d8a7d4da52b089">Put</a> (const K &amp;key, const T &amp;value)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add an element to the hash and reverse table.  <a href="#9c25406a6642d4e8f2d8a7d4da52b089"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsHashReversible.html#9942c91231ae37ef9bfe08966348e24e">PutUnique</a> (const K &amp;key, const T &amp;value)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add an element to the hash and to the reverse table.  <a href="#9942c91231ae37ef9bfe08966348e24e"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;class T, class K = unsigned int&gt;<br>
 class csHashReversible&lt; T, K &gt;</h3>

A csHash&lt;&gt; that maintains a reverse hash for indexing keys by values. 
<p>Definition at line <a class="el" href="hashr_8h-source.html#l00034">34</a> of file <a class="el" href="hashr_8h-source.html">hashr.h</a>.</p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="515d7120e465c7cdb1514a7209453070"></a><!-- doxytag: member="csHashReversible::csHashReversible" ref="515d7120e465c7cdb1514a7209453070" args="(int size=23, int grow_rate=5, int max_size=20000)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class K = unsigned int&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcsHashReversible.html">csHashReversible</a>&lt; T, K &gt;::<a class="el" href="classcsHashReversible.html">csHashReversible</a>           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>size</em> = <code>23</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>grow_rate</em> = <code>5</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>max_size</em> = <code>20000</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Construct a hash table with an array of the given size, which for optimisation reasons should be a prime number. 
<p>
Grow_rate is the rate at which the hash table grows: Size doubles once there are size/grow_rate collisions. It will not grow after it reaches max_size.<p>
Here are a few primes: 7, 11, 19, 29, 59, 79, 101, 127, 151, 199, 251, 307, 401, 503, 809, 1009, 1499, 2003, 3001, 5003, 12263, 25247, 36923, 50119, 70951, 90313, 104707. For a bigger list go to <a href="http://www.utm.edu/research/primes/">http://www.utm.edu/research/primes/</a> 
<p>Definition at line <a class="el" href="hashr_8h-source.html#l00051">51</a> of file <a class="el" href="hashr_8h-source.html">hashr.h</a>.</p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="df9e60784822033fd979ea74be9edf7d"></a><!-- doxytag: member="csHashReversible::GetKey" ref="df9e60784822033fd979ea74be9edf7d" args="(const T &amp;key, const K &amp;fallback) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class K = unsigned int&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">const K&amp; <a class="el" href="classcsHashReversible.html">csHashReversible</a>&lt; T, K &gt;::GetKey           </td>
          <td>(</td>
          <td class="paramtype">const T &amp;&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const K &amp;&nbsp;</td>
          <td class="paramname"> <em>fallback</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get the first key matching the given value, or <code>fallback</code> if there is none. 
<p>

<p>Definition at line <a class="el" href="hashr_8h-source.html#l00088">88</a> of file <a class="el" href="hashr_8h-source.html">hashr.h</a>.</p>

<p>References <a class="el" href="hash_8h-source.html#l00478">csHash&lt; T, K, ArrayMemoryAlloc &gt;::Get()</a>.</p>

</div>
</div><p>
<a class="anchor" name="7af49a66a38bfa2ca2dccd64935df959"></a><!-- doxytag: member="csHashReversible::GetKeyPointer" ref="7af49a66a38bfa2ca2dccd64935df959" args="(const T &amp;key) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class K = unsigned int&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">const K* <a class="el" href="classcsHashReversible.html">csHashReversible</a>&lt; T, K &gt;::GetKeyPointer           </td>
          <td>(</td>
          <td class="paramtype">const T &amp;&nbsp;</td>
          <td class="paramname"> <em>key</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get a pointer to the first key matching the given value, or 0 if there is none. 
<p>

<p>Definition at line <a class="el" href="hashr_8h-source.html#l00079">79</a> of file <a class="el" href="hashr_8h-source.html">hashr.h</a>.</p>

<p>References <a class="el" href="hash_8h-source.html#l00430">csHash&lt; T, K, ArrayMemoryAlloc &gt;::GetElementPointer()</a>.</p>

</div>
</div><p>
<a class="anchor" name="9c25406a6642d4e8f2d8a7d4da52b089"></a><!-- doxytag: member="csHashReversible::Put" ref="9c25406a6642d4e8f2d8a7d4da52b089" args="(const K &amp;key, const T &amp;value)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class K = unsigned int&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcsHashReversible.html">csHashReversible</a>&lt; T, K &gt;::Put           </td>
          <td>(</td>
          <td class="paramtype">const K &amp;&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T &amp;&nbsp;</td>
          <td class="paramname"> <em>value</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add an element to the hash and reverse table. 
<p>

<p>Reimplemented from <a class="el" href="classcsHash.html#25d78ac60667a3f6950ef9212db6a12c">csHash&lt; T, K, ArrayMemoryAlloc &gt;</a>.</p>

<p>Definition at line <a class="el" href="hashr_8h-source.html#l00059">59</a> of file <a class="el" href="hashr_8h-source.html">hashr.h</a>.</p>

<p>References <a class="el" href="hash_8h-source.html#l00346">csHash&lt; T, K, ArrayMemoryAlloc &gt;::Put()</a>.</p>

</div>
</div><p>
<a class="anchor" name="9942c91231ae37ef9bfe08966348e24e"></a><!-- doxytag: member="csHashReversible::PutUnique" ref="9942c91231ae37ef9bfe08966348e24e" args="(const K &amp;key, const T &amp;value)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class K = unsigned int&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcsHashReversible.html">csHashReversible</a>&lt; T, K &gt;::PutUnique           </td>
          <td>(</td>
          <td class="paramtype">const K &amp;&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T &amp;&nbsp;</td>
          <td class="paramname"> <em>value</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add an element to the hash and to the reverse table. 
<p>
<dl class="remark" compact><dt><b>Remarks:</b></dt><dd></dd></dl>

<p>Reimplemented from <a class="el" href="classcsHash.html#26669d4e89f8a5615cbb974442cf92ab">csHash&lt; T, K, ArrayMemoryAlloc &gt;</a>.</p>

<p>Definition at line <a class="el" href="hashr_8h-source.html#l00069">69</a> of file <a class="el" href="hashr_8h-source.html">hashr.h</a>.</p>

<p>References <a class="el" href="hash_8h-source.html#l00383">csHash&lt; T, K, ArrayMemoryAlloc &gt;::PutUnique()</a>.</p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>csutil/<a class="el" href="hashr_8h-source.html">hashr.h</a></ul>
<hr size="1"><address><small>Generated for Crystal Space 1.2.1 by 
<a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 
</small></address> </div></body> </html>