Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 583ffa4ba069126c3ba0bc565dc0485a > files > 1394

cvc3-doc-2.4.1-1.fc15.noarch.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>CVC3: hash_map.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<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">CVC3&#160;<span id="projectnumber">2.4.1</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="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</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>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">hash_map.h</div>  </div>
</div>
<div class="contents">
<a href="hash__map_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************/</span><span class="comment"></span>
<a name="l00002"></a>00002 <span class="comment">/*!</span>
<a name="l00003"></a>00003 <span class="comment"> *\file hash_map.h</span>
<a name="l00004"></a>00004 <span class="comment"> *\brief hash map implementation</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Author: Alexander Fuchs</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * Created: Fri Oct 13 11:04:00 2006</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00011"></a>00011 <span class="comment"> *</span>
<a name="l00012"></a>00012 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span>
<a name="l00013"></a>00013 <span class="comment"> * and its documentation for any purpose is hereby granted without</span>
<a name="l00014"></a>00014 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span>
<a name="l00015"></a>00015 <span class="comment"> * LICENSE file provided with this distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> * </span>
<a name="l00017"></a>00017 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00018"></a>00018 <span class="comment"> */</span>
<a name="l00019"></a>00019 <span class="comment">/*****************************************************************************/</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * Copyright (c) 1996,1997</span>
<a name="l00023"></a>00023 <span class="comment"> * Silicon Graphics Computer Systems, Inc.</span>
<a name="l00024"></a>00024 <span class="comment"> *</span>
<a name="l00025"></a>00025 <span class="comment"> * Permission to use, copy, modify, distribute and sell this software</span>
<a name="l00026"></a>00026 <span class="comment"> * and its documentation for any purpose is hereby granted without fee,</span>
<a name="l00027"></a>00027 <span class="comment"> * provided that the above copyright notice appear in all copies and</span>
<a name="l00028"></a>00028 <span class="comment"> * that both that copyright notice and this permission notice appear</span>
<a name="l00029"></a>00029 <span class="comment"> * in supporting documentation.  Silicon Graphics makes no</span>
<a name="l00030"></a>00030 <span class="comment"> * representations about the suitability of this software for any</span>
<a name="l00031"></a>00031 <span class="comment"> * purpose.  It is provided &quot;as is&quot; without express or implied warranty.</span>
<a name="l00032"></a>00032 <span class="comment"> *</span>
<a name="l00033"></a>00033 <span class="comment"> *</span>
<a name="l00034"></a>00034 <span class="comment"> * Copyright (c) 1994</span>
<a name="l00035"></a>00035 <span class="comment"> * Hewlett-Packard Company</span>
<a name="l00036"></a>00036 <span class="comment"> *</span>
<a name="l00037"></a>00037 <span class="comment"> * Permission to use, copy, modify, distribute and sell this software</span>
<a name="l00038"></a>00038 <span class="comment"> * and its documentation for any purpose is hereby granted without fee,</span>
<a name="l00039"></a>00039 <span class="comment"> * provided that the above copyright notice appear in all copies and</span>
<a name="l00040"></a>00040 <span class="comment"> * that both that copyright notice and this permission notice appear</span>
<a name="l00041"></a>00041 <span class="comment"> * in supporting documentation.  Hewlett-Packard Company makes no</span>
<a name="l00042"></a>00042 <span class="comment"> * representations about the suitability of this software for any</span>
<a name="l00043"></a>00043 <span class="comment"> * purpose.  It is provided &quot;as is&quot; without express or implied warranty.</span>
<a name="l00044"></a>00044 <span class="comment"> *</span>
<a name="l00045"></a>00045 <span class="comment"> */</span>
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 <span class="comment">// this implementation is in essence a subset of the SGI implementation:</span>
<a name="l00048"></a>00048 <span class="comment">// http://www.sgi.com/tech/stl/stl_hash_map.h</span>
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="preprocessor">#ifndef _cvc3__hash__hash_map_h_</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define _cvc3__hash__hash_map_h_</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00053"></a>00053 <span class="preprocessor">#include &quot;<a class="code" href="hash__fun_8h.html" title="hash functions">hash_fun.h</a>&quot;</span>
<a name="l00054"></a>00054 <span class="preprocessor">#include &quot;<a class="code" href="hash__table_8h.html" title="hash table implementation">hash_table.h</a>&quot;</span>
<a name="l00055"></a>00055 <span class="preprocessor">#include &lt;functional&gt;</span>
<a name="l00056"></a>00056 <span class="preprocessor">#include &lt;utility&gt;</span>
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="keyword">namespace </span>Hash {
<a name="l00059"></a>00059 
<a name="l00060"></a>00060   <span class="comment">// select1st is an extension taken from the SGI</span>
<a name="l00061"></a>00061   <span class="comment">// implementation of the STL file functional:</span>
<a name="l00062"></a>00062   <span class="comment">// http://www.sgi.com/tech/stl/stl_function.h</span>
<a name="l00063"></a>00063   <span class="keyword">template</span> &lt;<span class="keyword">class</span> _Pair&gt;
<a name="l00064"></a><a class="code" href="structHash_1_1__Select1st.html">00064</a>   <span class="keyword">struct </span><a class="code" href="structHash_1_1__Select1st.html">_Select1st</a> : <span class="keyword">public</span> std::<a class="code" href="classstd_1_1unary__function.html">unary_function</a>&lt;_Pair, typename _Pair::first_type&gt; {
<a name="l00065"></a><a class="code" href="structHash_1_1__Select1st.html#ac10b9ca160aeef242dac5b6acd04cb07">00065</a>     <span class="keyword">const</span> <span class="keyword">typename</span> _Pair::first_type&amp; <a class="code" href="structHash_1_1__Select1st.html#ac10b9ca160aeef242dac5b6acd04cb07">operator()</a>(<span class="keyword">const</span> _Pair&amp; __x)<span class="keyword"> const </span>{
<a name="l00066"></a>00066       <span class="keywordflow">return</span> __x.first;
<a name="l00067"></a>00067     }
<a name="l00068"></a>00068   };
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 <span class="comment"></span>
<a name="l00071"></a>00071 <span class="comment">  /*! hash map implementation based on the sgi interface:</span>
<a name="l00072"></a>00072 <span class="comment">    http://www.sgi.com/tech/stl/hash_map.html</span>
<a name="l00073"></a>00073 <span class="comment"></span>
<a name="l00074"></a>00074 <span class="comment">    _Key: hash key type</span>
<a name="l00075"></a>00075 <span class="comment">    _Data: data to store</span>
<a name="l00076"></a>00076 <span class="comment">    _HashFcn: functional class providing a hash function: size_type (_Key)</span>
<a name="l00077"></a>00077 <span class="comment">    _EqualKey: functional class providing a comparison function: bool(_Key, _Key)</span>
<a name="l00078"></a>00078 <span class="comment">      returns true iff two keys are considered to be equal</span>
<a name="l00079"></a>00079 <span class="comment">  */</span>
<a name="l00080"></a>00080   <span class="keyword">template</span> &lt;<span class="keyword">class</span> _Key, <span class="keyword">class</span> _Data, <span class="keyword">class</span> _HashFcn = hash&lt;_Key&gt;,
<a name="l00081"></a>00081       <span class="keyword">class</span> _EqualKey = std::equal_to&lt;_Key&gt; &gt;
<a name="l00082"></a><a class="code" href="classHash_1_1hash__map.html">00082</a>   <span class="keyword">class </span><a class="code" href="classHash_1_1hash__map.html">hash_map</a> {
<a name="l00083"></a>00083 <span class="comment"></span>
<a name="l00084"></a>00084 <span class="comment">  /// types</span>
<a name="l00085"></a>00085 <span class="comment"></span>  <span class="keyword">protected</span>:
<a name="l00086"></a>00086   <span class="comment">// note: const _Key must be used for _Value and _ExtractKey.</span>
<a name="l00087"></a>00087   <span class="comment">// if one is const and the other is not,</span>
<a name="l00088"></a>00088   <span class="comment">// then extracting a key will require a conversion and a temporary</span>
<a name="l00089"></a>00089   <span class="comment">// (at least in debug mode),</span>
<a name="l00090"></a>00090   <span class="comment">// so that the reference returned by _ExtractKey point to a temporary.</span>
<a name="l00091"></a>00091   <span class="keyword">typedef</span> <a class="code" href="classHash_1_1hash__table.html">hash_table&lt;_Key, std::pair&lt;const _Key, _Data&gt;</a>,
<a name="l00092"></a>00092          _HashFcn, _EqualKey, <a class="code" href="structHash_1_1__Select1st.html">_Select1st&lt;std::pair&lt;const _Key, _Data&gt;</a> &gt; &gt;
<a name="l00093"></a><a class="code" href="classHash_1_1hash__map.html#a5f3b686e86c29ffb0cc7c0672fd56907">00093</a>           <a class="code" href="classHash_1_1hash__map.html#a5f3b686e86c29ffb0cc7c0672fd56907" title="types">_hash_table</a>;
<a name="l00094"></a>00094 
<a name="l00095"></a>00095   <span class="keyword">public</span>:
<a name="l00096"></a>00096     <span class="comment">// typedefs as custom for other implementations</span>
<a name="l00097"></a><a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">00097</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classHash_1_1hash__table.html#a324f81cab1c1e0a66f14b93bde73ffe5" title="types">_hash_table::size_type</a> <a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a>;
<a name="l00098"></a><a class="code" href="classHash_1_1hash__map.html#a5e1b8d02bbe6146953794f6a39560fb1">00098</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classHash_1_1hash__table.html#a169157d3eb001aad4379ae2b2858d947">_hash_table::key_type</a> <a class="code" href="classHash_1_1hash__map.html#a5e1b8d02bbe6146953794f6a39560fb1">key_type</a>;
<a name="l00099"></a><a class="code" href="classHash_1_1hash__map.html#a04d69f98db11c4fdb47f1ad009f82520">00099</a>     <span class="keyword">typedef</span> _Data <a class="code" href="classHash_1_1hash__map.html#a04d69f98db11c4fdb47f1ad009f82520">data_type</a>;
<a name="l00100"></a><a class="code" href="classHash_1_1hash__map.html#a9d54d13ed95fb8548621011292875ef8">00100</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classHash_1_1hash__table.html#a73a266824c6f4b1e7398bdb95ee7cb51">_hash_table::value_type</a> <a class="code" href="classHash_1_1hash__map.html#a9d54d13ed95fb8548621011292875ef8">value_type</a>;
<a name="l00101"></a><a class="code" href="classHash_1_1hash__map.html#a263db3c7c9ce53b34529cbda55be123c">00101</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structHash_1_1hash_3_01long_01_4.html">_hash_table::hasher</a> <a class="code" href="classHash_1_1hash__map.html#a263db3c7c9ce53b34529cbda55be123c">hasher</a>;
<a name="l00102"></a><a class="code" href="classHash_1_1hash__map.html#afe18f3473f050e697f36e42cc8246aec">00102</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classHash_1_1hash__table.html#a03e9ef2c5a815421589495e96bb9a6fb">_hash_table::key_equal</a> <a class="code" href="classHash_1_1hash__map.html#afe18f3473f050e697f36e42cc8246aec">key_equal</a>;
<a name="l00103"></a>00103 
<a name="l00104"></a>00104   <span class="keyword">public</span>:
<a name="l00105"></a>00105     <span class="comment">// iterators</span>
<a name="l00106"></a><a class="code" href="classHash_1_1hash__map.html#a0fae180472ddfd8822c881caf23c11a9">00106</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classHash_1_1hash__table.html#a67171474c4da6cc8efe0c7fafefd2b2d">_hash_table::iterator</a> <a class="code" href="classHash_1_1hash__map.html#a0fae180472ddfd8822c881caf23c11a9">iterator</a>;
<a name="l00107"></a><a class="code" href="classHash_1_1hash__map.html#a34789fb591a84314e78bd17b69aa6065">00107</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classHash_1_1hash__table.html#ac220ce1c155db1ac44146c12d178056f">_hash_table::const_iterator</a> <a class="code" href="classHash_1_1hash__map.html#a34789fb591a84314e78bd17b69aa6065">const_iterator</a>;
<a name="l00108"></a>00108 <span class="comment"></span>
<a name="l00109"></a>00109 <span class="comment">  /// variables</span>
<a name="l00110"></a>00110 <span class="comment"></span>
<a name="l00111"></a>00111   <span class="keyword">protected</span>:
<a name="l00112"></a>00112     <span class="comment">// the hash table</span>
<a name="l00113"></a><a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467">00113</a>     <a class="code" href="classHash_1_1hash__table.html">_hash_table</a> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>;
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 <span class="comment"></span>
<a name="l00116"></a>00116 <span class="comment">  /// methods</span>
<a name="l00117"></a>00117 <span class="comment"></span>
<a name="l00118"></a>00118   <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00119"></a>00119 <span class="comment">    /// constructors</span>
<a name="l00120"></a>00120 <span class="comment"></span>
<a name="l00121"></a>00121     <span class="comment">// default size is 16 buckets</span>
<a name="l00122"></a><a class="code" href="classHash_1_1hash__map.html#a413e9183459c8dbfe01956822f74e339">00122</a>     <a class="code" href="classHash_1_1hash__map.html#a413e9183459c8dbfe01956822f74e339" title="methods">hash_map</a>() :
<a name="l00123"></a>00123       <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>()
<a name="l00124"></a>00124     { };
<a name="l00125"></a>00125     
<a name="l00126"></a>00126     <span class="comment">// specifiy initial number of buckets - must be positive</span>
<a name="l00127"></a><a class="code" href="classHash_1_1hash__map.html#a3bcd62bbe9296e4907926da97a379a7b">00127</a>     <a class="code" href="classHash_1_1hash__map.html#a413e9183459c8dbfe01956822f74e339" title="methods">hash_map</a>(<a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a> initial_capacity) : 
<a name="l00128"></a>00128       <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>(initial_capacity)
<a name="l00129"></a>00129     { };
<a name="l00130"></a>00130 
<a name="l00131"></a>00131     <span class="comment">// specifiy initial number of buckets and hash function</span>
<a name="l00132"></a><a class="code" href="classHash_1_1hash__map.html#a4d34bf6d2c6534642b538a6bb5c41337">00132</a>     <a class="code" href="classHash_1_1hash__map.html#a413e9183459c8dbfe01956822f74e339" title="methods">hash_map</a>(<a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a> initial_capacity, <span class="keyword">const</span> _HashFcn&amp; <a class="code" href="structHash_1_1hash.html">hash</a>) : 
<a name="l00133"></a>00133       <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>(initial_capacity, hash)
<a name="l00134"></a>00134     { };
<a name="l00135"></a>00135 
<a name="l00136"></a>00136     <span class="comment">// specifiy initial number of buckets, hash and equal function</span>
<a name="l00137"></a><a class="code" href="classHash_1_1hash__map.html#ad3902269c263bf5117f38defa2bf279f">00137</a>     <a class="code" href="classHash_1_1hash__map.html#a413e9183459c8dbfe01956822f74e339" title="methods">hash_map</a>(<a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a> initial_capacity,
<a name="l00138"></a>00138        <span class="keyword">const</span> _HashFcn&amp; <a class="code" href="structHash_1_1hash.html">hash</a>, <span class="keyword">const</span> _EqualKey&amp; equal) : 
<a name="l00139"></a>00139       <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>(initial_capacity, hash, equal)
<a name="l00140"></a>00140     { };
<a name="l00141"></a>00141 
<a name="l00142"></a>00142     <span class="comment">// copy hash map.</span>
<a name="l00143"></a><a class="code" href="classHash_1_1hash__map.html#a0d7f14bd98a6411da23c0f38d3e008fd">00143</a>     <a class="code" href="classHash_1_1hash__map.html#a413e9183459c8dbfe01956822f74e339" title="methods">hash_map</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html">hash_map</a>&amp; other) :
<a name="l00144"></a>00144       <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>(other.<a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>)
<a name="l00145"></a>00145     { };
<a name="l00146"></a>00146     
<a name="l00147"></a>00147     <span class="comment">// assign hash map</span>
<a name="l00148"></a><a class="code" href="classHash_1_1hash__map.html#a7dde0644b6827b737692d80523b01c6a">00148</a>     <a class="code" href="classHash_1_1hash__map.html">hash_map</a>&amp; <a class="code" href="classHash_1_1hash__map.html#a7dde0644b6827b737692d80523b01c6a">operator=</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html">hash_map</a>&amp; other) {
<a name="l00149"></a>00149       <span class="keywordflow">if</span> (<span class="keyword">this</span> != &amp;other) {
<a name="l00150"></a>00150   <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a> = other.<a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>;
<a name="l00151"></a>00151       }
<a name="l00152"></a>00152 
<a name="l00153"></a>00153       <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00154"></a>00154     }
<a name="l00155"></a>00155 
<a name="l00156"></a><a class="code" href="classHash_1_1hash__map.html#adb8df1bc8f03ff2426d3d1f9d7676e64">00156</a>     <span class="keywordtype">void</span> <a class="code" href="classHash_1_1hash__map.html#adb8df1bc8f03ff2426d3d1f9d7676e64">swap</a>(<a class="code" href="classHash_1_1hash__map.html">hash_map</a>&amp; other) {
<a name="l00157"></a>00157       <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#afcf03a783b1b22e2115405494e99407d">swap</a>(other.<a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>);
<a name="l00158"></a>00158     }
<a name="l00159"></a>00159 
<a name="l00160"></a>00160     <span class="comment">// removes all entries, number of buckets is not reduced.</span>
<a name="l00161"></a><a class="code" href="classHash_1_1hash__map.html#a18703659be23b5ff0b7d7b5c796e6abd">00161</a>     <span class="keywordtype">void</span> <a class="code" href="classHash_1_1hash__map.html#a18703659be23b5ff0b7d7b5c796e6abd">clear</a>() {
<a name="l00162"></a>00162       <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a51fe4b7db4b7be59ea3531c1ae921de7">clear</a>();
<a name="l00163"></a>00163     };
<a name="l00164"></a>00164 
<a name="l00165"></a>00165 
<a name="l00166"></a>00166 <span class="comment"></span>
<a name="l00167"></a>00167 <span class="comment">    /// operations</span>
<a name="l00168"></a>00168 <span class="comment"></span>
<a name="l00169"></a>00169     
<a name="l00170"></a>00170     <span class="comment">// returns end iterator if key was not bound</span>
<a name="l00171"></a><a class="code" href="classHash_1_1hash__map.html#af3317f9087a35d09985b6513c45d2ab8">00171</a>     <a class="code" href="classHash_1_1hash__map.html#a0fae180472ddfd8822c881caf23c11a9">iterator</a> <a class="code" href="classHash_1_1hash__map.html#af3317f9087a35d09985b6513c45d2ab8" title="operations">find</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html#a5e1b8d02bbe6146953794f6a39560fb1">key_type</a>&amp; key) {
<a name="l00172"></a>00172       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a968b856ff972a7614418f9d4827848ed" title="operations">find</a>(key);
<a name="l00173"></a>00173     }
<a name="l00174"></a>00174     
<a name="l00175"></a>00175     <span class="comment">// const version of find</span>
<a name="l00176"></a><a class="code" href="classHash_1_1hash__map.html#ae51c9512fe5f2f2daa8131aff9c435fc">00176</a>     <a class="code" href="classHash_1_1hash__map.html#a34789fb591a84314e78bd17b69aa6065">const_iterator</a> <a class="code" href="classHash_1_1hash__map.html#ae51c9512fe5f2f2daa8131aff9c435fc">find</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html#a5e1b8d02bbe6146953794f6a39560fb1">key_type</a>&amp; key)<span class="keyword"> const </span>{
<a name="l00177"></a>00177       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a968b856ff972a7614418f9d4827848ed" title="operations">find</a>(key);
<a name="l00178"></a>00178     }
<a name="l00179"></a>00179 
<a name="l00180"></a>00180     <span class="comment">// if key in value is already bound,</span>
<a name="l00181"></a>00181     <span class="comment">// returns that binding,</span>
<a name="l00182"></a>00182     <span class="comment">// otherwise inserts a default value and returns a reference to it.</span>
<a name="l00183"></a><a class="code" href="classHash_1_1hash__map.html#a50bce18c5a1585f1c26eaf557de9d252">00183</a>     <a class="code" href="classHash_1_1hash__map.html#a04d69f98db11c4fdb47f1ad009f82520">data_type</a>&amp; <a class="code" href="classHash_1_1hash__map.html#a50bce18c5a1585f1c26eaf557de9d252">operator[]</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html#a5e1b8d02bbe6146953794f6a39560fb1">key_type</a>&amp; key) {
<a name="l00184"></a>00184       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a999ccd1ec65f74547b592b432d1de46d">find_or_insert</a>(std::make_pair(key, <a class="code" href="classHash_1_1hash__map.html#a04d69f98db11c4fdb47f1ad009f82520">data_type</a>())).second;
<a name="l00185"></a>00185     }
<a name="l00186"></a>00186 
<a name="l00187"></a>00187 
<a name="l00188"></a>00188     <span class="comment">// adds the mapping from key to data, if key is still unbound</span>
<a name="l00189"></a>00189     <span class="comment">// otherwise returns false</span>
<a name="l00190"></a><a class="code" href="classHash_1_1hash__map.html#ac90ce3f2c448b2c9c633fb417f4b171d">00190</a>     std::pair&lt;iterator, bool&gt; <a class="code" href="classHash_1_1hash__map.html#ac90ce3f2c448b2c9c633fb417f4b171d">insert</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html#a9d54d13ed95fb8548621011292875ef8">value_type</a>&amp; entry) {
<a name="l00191"></a>00191       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a3a934472ef2bcb68a64b37435572843c">insert</a>(entry);
<a name="l00192"></a>00192     }
<a name="l00193"></a>00193 
<a name="l00194"></a>00194     <span class="comment">// removes binding of key</span>
<a name="l00195"></a>00195     <span class="comment">// returns number of keys removed,</span>
<a name="l00196"></a>00196     <span class="comment">// i.e. 1 if key was bound, 0 if key was not bound.</span>
<a name="l00197"></a><a class="code" href="classHash_1_1hash__map.html#a9e69b0959edfd246d77df4097a24aaae">00197</a>     <a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a> <a class="code" href="classHash_1_1hash__map.html#a9e69b0959edfd246d77df4097a24aaae">erase</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html#a5e1b8d02bbe6146953794f6a39560fb1">key_type</a>&amp; key) {
<a name="l00198"></a>00198       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a04a1a587d97f5cf542ed64fc6b10d972">erase</a>(key);
<a name="l00199"></a>00199     }
<a name="l00200"></a>00200 
<a name="l00201"></a>00201     <span class="comment">// removes element pointed to by iter,</span>
<a name="l00202"></a>00202     <span class="comment">// returns element after iter.</span>
<a name="l00203"></a><a class="code" href="classHash_1_1hash__map.html#a9c1713f6a085c0f25336e7244ab41a46">00203</a>     <a class="code" href="classHash_1_1hash__map.html#a34789fb591a84314e78bd17b69aa6065">const_iterator</a> <a class="code" href="classHash_1_1hash__map.html#a9c1713f6a085c0f25336e7244ab41a46">erase</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html#a34789fb591a84314e78bd17b69aa6065">const_iterator</a>&amp; i) {
<a name="l00204"></a>00204       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a04a1a587d97f5cf542ed64fc6b10d972">erase</a>(i);
<a name="l00205"></a>00205     }
<a name="l00206"></a>00206 
<a name="l00207"></a>00207 <span class="comment"></span>
<a name="l00208"></a>00208 <span class="comment">    /// status</span>
<a name="l00209"></a>00209 <span class="comment"></span>
<a name="l00210"></a>00210     <span class="comment">// is the key bound?</span>
<a name="l00211"></a><a class="code" href="classHash_1_1hash__map.html#a48feee7c5690c9cd9ba1b0817ca3ae9f">00211</a>     <span class="keywordtype">bool</span> <a class="code" href="classHash_1_1hash__map.html#a48feee7c5690c9cd9ba1b0817ca3ae9f" title="status">contains</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__map.html#a5e1b8d02bbe6146953794f6a39560fb1">key_type</a>&amp; key)<span class="keyword"> const </span>{
<a name="l00212"></a>00212       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a4b6eae473c46342713bfeb163c4e8559" title="status">contains</a>(key);
<a name="l00213"></a>00213     }
<a name="l00214"></a>00214 
<a name="l00215"></a>00215     <span class="comment">// returns the number of times a key is bound,</span>
<a name="l00216"></a>00216     <span class="comment">// i.e. 0 or 1</span>
<a name="l00217"></a><a class="code" href="classHash_1_1hash__map.html#a3d52fe0d391d58e9573ce84472dfea24">00217</a>     <a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a> <a class="code" href="classHash_1_1hash__map.html#a3d52fe0d391d58e9573ce84472dfea24">count</a>(<span class="keyword">const</span> _Key&amp; key)<span class="keyword"> const </span>{
<a name="l00218"></a>00218       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a7ffa2f780f2d8614b4b6b2b91d55f62e">count</a>(key);
<a name="l00219"></a>00219     }
<a name="l00220"></a>00220   
<a name="l00221"></a>00221     <span class="comment">// is the hash map empty?</span>
<a name="l00222"></a><a class="code" href="classHash_1_1hash__map.html#a12f477e90d48f319433bb5cc605ce00f">00222</a>     <span class="keywordtype">bool</span> <a class="code" href="classHash_1_1hash__map.html#a12f477e90d48f319433bb5cc605ce00f">empty</a>()<span class="keyword"> const </span>{
<a name="l00223"></a>00223       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a7065f077c220601df60db97a73b0027d">empty</a>();
<a name="l00224"></a>00224     }
<a name="l00225"></a>00225 
<a name="l00226"></a>00226     <span class="comment">// the number of elements in the hash map</span>
<a name="l00227"></a><a class="code" href="classHash_1_1hash__map.html#a1440a04e68060e58f053a38976bc6f9b">00227</a>     <a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a> <a class="code" href="classHash_1_1hash__map.html#a1440a04e68060e58f053a38976bc6f9b">size</a>()<span class="keyword"> const </span>{
<a name="l00228"></a>00228       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#ae30a43e1914f9fabf997e2190fdd6679">size</a>();
<a name="l00229"></a>00229     }
<a name="l00230"></a>00230 
<a name="l00231"></a>00231     <span class="comment">// the number of buckets in the hash map</span>
<a name="l00232"></a><a class="code" href="classHash_1_1hash__map.html#a6516fa8565fac0997d7a62523151d181">00232</a>     <a class="code" href="classHash_1_1hash__map.html#ad4469c366b3be18a80232ab65e27e4b0">size_type</a> <a class="code" href="classHash_1_1hash__map.html#a6516fa8565fac0997d7a62523151d181">bucket_count</a>()<span class="keyword"> const </span>{
<a name="l00233"></a>00233       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a462c80ab1a76fd7a1c2e0c5372e66f86">bucket_count</a>();
<a name="l00234"></a>00234     }
<a name="l00235"></a>00235 
<a name="l00236"></a>00236     <span class="comment">// returns the average number of elements per bucket</span>
<a name="l00237"></a><a class="code" href="classHash_1_1hash__map.html#ac519328bded2c33cad0bb096bb9bfdcf">00237</a>     <span class="keywordtype">float</span> <a class="code" href="classHash_1_1hash__map.html#ac519328bded2c33cad0bb096bb9bfdcf">load_factor</a>()<span class="keyword"> const </span>{
<a name="l00238"></a>00238       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a956196112f728577cbd0e280694ed58e">load_factor</a>();
<a name="l00239"></a>00239     }
<a name="l00240"></a>00240 
<a name="l00241"></a>00241 
<a name="l00242"></a>00242 <span class="comment"></span>
<a name="l00243"></a>00243 <span class="comment">    /// iterators</span>
<a name="l00244"></a>00244 <span class="comment"></span>
<a name="l00245"></a>00245     <span class="comment">// returns forward iterator to iterate over all key/data pairs</span>
<a name="l00246"></a><a class="code" href="classHash_1_1hash__map.html#a478f2d66eb11d4ca51bc2b630373e9ad">00246</a>     <a class="code" href="classHash_1_1hash__map.html#a0fae180472ddfd8822c881caf23c11a9">iterator</a> <a class="code" href="classHash_1_1hash__map.html#a478f2d66eb11d4ca51bc2b630373e9ad" title="iterators">begin</a>() {
<a name="l00247"></a>00247       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a96bd3fd3ef6ce56fef55ccec727aacd2" title="iterators">begin</a>();
<a name="l00248"></a>00248     }
<a name="l00249"></a>00249 
<a name="l00250"></a>00250     <span class="comment">// const version of begin</span>
<a name="l00251"></a><a class="code" href="classHash_1_1hash__map.html#a856df3b8cca34375a835424833f5faf0">00251</a>     <a class="code" href="classHash_1_1hash__map.html#a34789fb591a84314e78bd17b69aa6065">const_iterator</a> <a class="code" href="classHash_1_1hash__map.html#a856df3b8cca34375a835424833f5faf0">begin</a>()<span class="keyword"> const </span>{
<a name="l00252"></a>00252       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a96bd3fd3ef6ce56fef55ccec727aacd2" title="iterators">begin</a>();
<a name="l00253"></a>00253     }
<a name="l00254"></a>00254 
<a name="l00255"></a>00255 
<a name="l00256"></a>00256     <span class="comment">// returns end iterator</span>
<a name="l00257"></a><a class="code" href="classHash_1_1hash__map.html#a2c776e055f3d17226605157e1c37dbc9">00257</a>     <a class="code" href="classHash_1_1hash__map.html#a0fae180472ddfd8822c881caf23c11a9">iterator</a> <a class="code" href="classHash_1_1hash__map.html#a2c776e055f3d17226605157e1c37dbc9">end</a>() {
<a name="l00258"></a>00258       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a0b55d938bbf33696c4e75a18bbeb2e8a">end</a>();
<a name="l00259"></a>00259     }
<a name="l00260"></a>00260     
<a name="l00261"></a>00261     <span class="comment">// const version of end</span>
<a name="l00262"></a><a class="code" href="classHash_1_1hash__map.html#a67d2f88cb7497b9fe0fb11a2dd1c3923">00262</a>     <a class="code" href="classHash_1_1hash__map.html#a34789fb591a84314e78bd17b69aa6065">const_iterator</a> <a class="code" href="classHash_1_1hash__map.html#a67d2f88cb7497b9fe0fb11a2dd1c3923">end</a>()<span class="keyword"> const </span>{
<a name="l00263"></a>00263       <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__map.html#afeeaaecea687bcfc736fede5f8ef6467" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a0b55d938bbf33696c4e75a18bbeb2e8a">end</a>();
<a name="l00264"></a>00264     }
<a name="l00265"></a>00265   };
<a name="l00266"></a>00266 
<a name="l00267"></a>00267 }
<a name="l00268"></a>00268 
<a name="l00269"></a>00269 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Sep 7 2011 for CVC3 by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>