<!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_set.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 <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 Page</span></a></li> <li><a href="pages.html"><span>Related 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">hash_set.h</div> </div> </div> <div class="contents"> <a href="hash__set_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_set.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: Thu Oct 19 11:04:00 2006</span> <a name="l00009"></a>00009 <span class="comment"> *</span> <a name="l00010"></a>00010 <span class="comment"> * <hr></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"> * <hr></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 "as is" 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 "as is" 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_set.h</span> <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="preprocessor">#ifndef _cvc3__hash__hash_set_h_</span> <a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define _cvc3__hash__hash_set_h_</span> <a name="l00052"></a>00052 <span class="preprocessor"></span> <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="preprocessor">#include "<a class="code" href="hash__fun_8h.html" title="hash functions">hash_fun.h</a>"</span> <a name="l00055"></a>00055 <span class="preprocessor">#include "<a class="code" href="hash__table_8h.html" title="hash table implementation">hash_table.h</a>"</span> <a name="l00056"></a>00056 <a name="l00057"></a>00057 <span class="keyword">namespace </span>Hash { <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="comment">// identity is an extension taken from the SGI</span> <a name="l00060"></a>00060 <span class="comment">// implementation of the STL file functional:</span> <a name="l00061"></a>00061 <span class="comment">// http://www.sgi.com/tech/stl/stl_function.h</span> <a name="l00062"></a>00062 <span class="keyword">template</span> <<span class="keyword">class</span> _Tp> <a name="l00063"></a><a class="code" href="structHash_1_1__Identity.html">00063</a> <span class="keyword">struct </span><a class="code" href="structHash_1_1__Identity.html">_Identity</a> : <span class="keyword">public</span> std::<a class="code" href="classstd_1_1unary__function.html">unary_function</a><_Tp,_Tp> { <a name="l00064"></a><a class="code" href="structHash_1_1__Identity.html#acc1e36569e379fa8a2a3d2b6f1c01f04">00064</a> <span class="keyword">const</span> _Tp& <a class="code" href="structHash_1_1__Identity.html#acc1e36569e379fa8a2a3d2b6f1c01f04">operator()</a>(<span class="keyword">const</span> _Tp& __x)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> __x; } <a name="l00065"></a>00065 }; <a name="l00066"></a>00066 <a name="l00067"></a>00067 <span class="comment"></span> <a name="l00068"></a>00068 <span class="comment"> /*! hash set implementation based on the sgi interface:</span> <a name="l00069"></a>00069 <span class="comment"> http://www.sgi.com/tech/stl/hash_set.html</span> <a name="l00070"></a>00070 <span class="comment"></span> <a name="l00071"></a>00071 <span class="comment"> _Key: hash key type</span> <a name="l00072"></a>00072 <span class="comment"> _HashFcn: functional class providing a hash function: size_type (_Key)</span> <a name="l00073"></a>00073 <span class="comment"> _EqualKey: functional class providing a comparison function: bool(_Key, _Key)</span> <a name="l00074"></a>00074 <span class="comment"> returns true iff two keys are considered to be equal</span> <a name="l00075"></a>00075 <span class="comment"> */</span> <a name="l00076"></a>00076 <span class="keyword">template</span> <<span class="keyword">class</span> _Key, <span class="keyword">class</span> _HashFcn = hash<_Key>, <a name="l00077"></a>00077 <span class="keyword">class</span> _EqualKey = std::equal_to<_Key> > <a name="l00078"></a><a class="code" href="classHash_1_1hash__set.html">00078</a> <span class="keyword">class </span><a class="code" href="classHash_1_1hash__set.html">hash_set</a> { <a name="l00079"></a>00079 <span class="comment"></span> <a name="l00080"></a>00080 <span class="comment"> /// types</span> <a name="l00081"></a>00081 <span class="comment"></span> <span class="keyword">protected</span>: <a name="l00082"></a><a class="code" href="classHash_1_1hash__set.html#a12acfe747a41135e51ca0cb1f73d5570">00082</a> <span class="keyword">typedef</span> <a class="code" href="classHash_1_1hash__table.html">hash_table<_Key, _Key, _HashFcn, _EqualKey, _Identity<_Key></a> > <a class="code" href="classHash_1_1hash__set.html#a12acfe747a41135e51ca0cb1f73d5570" title="types">_hash_table</a>; <a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="keyword">public</span>: <a name="l00085"></a>00085 <span class="comment">// typedefs as custom for other implementations</span> <a name="l00086"></a><a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">00086</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__set.html#a453c55d429fc37785587c895224717d8">size_type</a>; <a name="l00087"></a><a class="code" href="classHash_1_1hash__set.html#ae94044e96dafa1f67c767a5be87947a5">00087</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__set.html#ae94044e96dafa1f67c767a5be87947a5">key_type</a>; <a name="l00088"></a><a class="code" href="classHash_1_1hash__set.html#ac6573905b903da8bdfd55b839bd9d256">00088</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__set.html#ac6573905b903da8bdfd55b839bd9d256">value_type</a>; <a name="l00089"></a><a class="code" href="classHash_1_1hash__set.html#ac46e9d8b9577273ebe9d04491b333487">00089</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structHash_1_1hash.html">_hash_table::hasher</a> <a class="code" href="classHash_1_1hash__set.html#ac46e9d8b9577273ebe9d04491b333487">hasher</a>; <a name="l00090"></a><a class="code" href="classHash_1_1hash__set.html#a85e29370bae7f667a41330f33133a305">00090</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__set.html#a85e29370bae7f667a41330f33133a305">key_equal</a>; <a name="l00091"></a>00091 <a name="l00092"></a>00092 <span class="keyword">public</span>: <a name="l00093"></a>00093 <span class="comment">// iterators</span> <a name="l00094"></a><a class="code" href="classHash_1_1hash__set.html#a87a125f71dd85de65e662559bd5a66dc">00094</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__set.html#a87a125f71dd85de65e662559bd5a66dc">iterator</a>; <a name="l00095"></a><a class="code" href="classHash_1_1hash__set.html#a318342bf9ac6e65541792709f949c3ef">00095</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__set.html#a318342bf9ac6e65541792709f949c3ef">const_iterator</a>; <a name="l00096"></a>00096 <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="comment"></span> <a name="l00099"></a>00099 <span class="comment"> /// variables</span> <a name="l00100"></a>00100 <span class="comment"></span> <a name="l00101"></a>00101 <span class="keyword">protected</span>: <a name="l00102"></a>00102 <span class="comment">// the hash table</span> <a name="l00103"></a><a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27">00103</a> <a class="code" href="classHash_1_1hash__table.html">_hash_table</a> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>; <a name="l00104"></a>00104 <a name="l00105"></a>00105 <span class="comment"></span> <a name="l00106"></a>00106 <span class="comment"> /// methods</span> <a name="l00107"></a>00107 <span class="comment"></span> <a name="l00108"></a>00108 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00109"></a>00109 <span class="comment"> /// constructors</span> <a name="l00110"></a>00110 <span class="comment"></span> <a name="l00111"></a>00111 <span class="comment">// default size is 16 buckets</span> <a name="l00112"></a><a class="code" href="classHash_1_1hash__set.html#aeb77dd1a6c24cd228f60138b57fbaf82">00112</a> <a class="code" href="classHash_1_1hash__set.html#aeb77dd1a6c24cd228f60138b57fbaf82" title="methods">hash_set</a>() : <a name="l00113"></a>00113 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>() <a name="l00114"></a>00114 { }; <a name="l00115"></a>00115 <a name="l00116"></a>00116 <span class="comment">// specifiy initial number of buckets - must be positive</span> <a name="l00117"></a><a class="code" href="classHash_1_1hash__set.html#a18bbc6adb3d60c0c54bc2e5b7a746d1b">00117</a> <a class="code" href="classHash_1_1hash__set.html#aeb77dd1a6c24cd228f60138b57fbaf82" title="methods">hash_set</a>(<a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">size_type</a> initial_capacity) : <a name="l00118"></a>00118 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>(initial_capacity) <a name="l00119"></a>00119 { }; <a name="l00120"></a>00120 <a name="l00121"></a>00121 <span class="comment">// specifiy initial number of buckets and hash function</span> <a name="l00122"></a><a class="code" href="classHash_1_1hash__set.html#a8477c1a539f95293d4bdcb4e13c8464a">00122</a> <a class="code" href="classHash_1_1hash__set.html#aeb77dd1a6c24cd228f60138b57fbaf82" title="methods">hash_set</a>(<a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">size_type</a> initial_capacity, <span class="keyword">const</span> _HashFcn& <a class="code" href="structHash_1_1hash.html">hash</a>) : <a name="l00123"></a>00123 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>(initial_capacity, hash) <a name="l00124"></a>00124 { }; <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="comment">// specifiy initial number of buckets, hash and equal function</span> <a name="l00127"></a><a class="code" href="classHash_1_1hash__set.html#ad836615a153bf7605b1d3aaf99a05035">00127</a> <a class="code" href="classHash_1_1hash__set.html#aeb77dd1a6c24cd228f60138b57fbaf82" title="methods">hash_set</a>(<a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">size_type</a> initial_capacity, <a name="l00128"></a>00128 <span class="keyword">const</span> _HashFcn& <a class="code" href="structHash_1_1hash.html">hash</a>, <span class="keyword">const</span> _EqualKey& equal) : <a name="l00129"></a>00129 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>(initial_capacity, hash, equal) <a name="l00130"></a>00130 { }; <a name="l00131"></a>00131 <a name="l00132"></a>00132 <span class="comment">// copy hash map.</span> <a name="l00133"></a><a class="code" href="classHash_1_1hash__set.html#a5b240d7192fd043474183de0bb26cefb">00133</a> <a class="code" href="classHash_1_1hash__set.html#aeb77dd1a6c24cd228f60138b57fbaf82" title="methods">hash_set</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__set.html">hash_set</a>& other) : <a name="l00134"></a>00134 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>(other.<a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>) <a name="l00135"></a>00135 { }; <a name="l00136"></a>00136 <a name="l00137"></a>00137 <span class="comment">// assign hash map</span> <a name="l00138"></a><a class="code" href="classHash_1_1hash__set.html#aedfbb2359706903827f3fea0a7d6228a">00138</a> <a class="code" href="classHash_1_1hash__set.html">hash_set</a>& <a class="code" href="classHash_1_1hash__set.html#aedfbb2359706903827f3fea0a7d6228a">operator=</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__set.html">hash_set</a>& other) { <a name="l00139"></a>00139 <span class="keywordflow">if</span> (<span class="keyword">this</span> != &other) { <a name="l00140"></a>00140 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a> = other.<a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>; <a name="l00141"></a>00141 } <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00144"></a>00144 } <a name="l00145"></a>00145 <a name="l00146"></a><a class="code" href="classHash_1_1hash__set.html#a515268c3fb6fd6ec64353835019e91d1">00146</a> <span class="keywordtype">void</span> <a class="code" href="classHash_1_1hash__set.html#a515268c3fb6fd6ec64353835019e91d1">swap</a>(<a class="code" href="classHash_1_1hash__set.html">hash_set</a>& other) { <a name="l00147"></a>00147 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" 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__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>); <a name="l00148"></a>00148 } <a name="l00149"></a>00149 <a name="l00150"></a>00150 <span class="comment">// removes all entries, number of buckets is not reduced.</span> <a name="l00151"></a><a class="code" href="classHash_1_1hash__set.html#a2d699de2bb0dac0d1ea819fdc8acda96">00151</a> <span class="keywordtype">void</span> <a class="code" href="classHash_1_1hash__set.html#a2d699de2bb0dac0d1ea819fdc8acda96">clear</a>() { <a name="l00152"></a>00152 <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a51fe4b7db4b7be59ea3531c1ae921de7">clear</a>(); <a name="l00153"></a>00153 }; <a name="l00154"></a>00154 <a name="l00155"></a>00155 <a name="l00156"></a>00156 <span class="comment"></span> <a name="l00157"></a>00157 <span class="comment"> /// operations</span> <a name="l00158"></a>00158 <span class="comment"></span> <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="comment">// returns end iterator if key was not bound</span> <a name="l00161"></a><a class="code" href="classHash_1_1hash__set.html#a955279e5fd49f919bb6b0cd456d39c7b">00161</a> <a class="code" href="classHash_1_1hash__set.html#a87a125f71dd85de65e662559bd5a66dc">iterator</a> <a class="code" href="classHash_1_1hash__set.html#a955279e5fd49f919bb6b0cd456d39c7b" title="operations">find</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__set.html#ae94044e96dafa1f67c767a5be87947a5">key_type</a>& key) { <a name="l00162"></a>00162 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a968b856ff972a7614418f9d4827848ed" title="operations">find</a>(key); <a name="l00163"></a>00163 } <a name="l00164"></a>00164 <a name="l00165"></a>00165 <span class="comment">// const version of find</span> <a name="l00166"></a><a class="code" href="classHash_1_1hash__set.html#a39b682b5aad2c13a0c06ef3186a685c7">00166</a> <a class="code" href="classHash_1_1hash__set.html#a318342bf9ac6e65541792709f949c3ef">const_iterator</a> <a class="code" href="classHash_1_1hash__set.html#a39b682b5aad2c13a0c06ef3186a685c7">find</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__set.html#ae94044e96dafa1f67c767a5be87947a5">key_type</a>& key)<span class="keyword"> const </span>{ <a name="l00167"></a>00167 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a968b856ff972a7614418f9d4827848ed" title="operations">find</a>(key); <a name="l00168"></a>00168 } <a name="l00169"></a>00169 <a name="l00170"></a>00170 <a name="l00171"></a>00171 <span class="comment">// adds the mapping from key to data, if key is still unbound</span> <a name="l00172"></a>00172 <span class="comment">// otherwise returns false</span> <a name="l00173"></a><a class="code" href="classHash_1_1hash__set.html#a156c40ba629d5aba7f7cacf4eeab1e2d">00173</a> std::pair<iterator, bool> <a class="code" href="classHash_1_1hash__set.html#a156c40ba629d5aba7f7cacf4eeab1e2d">insert</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__set.html#ac6573905b903da8bdfd55b839bd9d256">value_type</a>& entry) { <a name="l00174"></a>00174 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a3a934472ef2bcb68a64b37435572843c">insert</a>(entry); <a name="l00175"></a>00175 } <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="comment">// removes binding of key</span> <a name="l00178"></a>00178 <span class="comment">// returns number of keys removed,</span> <a name="l00179"></a>00179 <span class="comment">// i.e. 1 if key was bound, 0 if key was not bound.</span> <a name="l00180"></a><a class="code" href="classHash_1_1hash__set.html#a82dbe044048d8e25f0ffd148d726d1e4">00180</a> <a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">size_type</a> <a class="code" href="classHash_1_1hash__set.html#a82dbe044048d8e25f0ffd148d726d1e4">erase</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__set.html#ae94044e96dafa1f67c767a5be87947a5">key_type</a>& key) { <a name="l00181"></a>00181 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a04a1a587d97f5cf542ed64fc6b10d972">erase</a>(key); <a name="l00182"></a>00182 } <a name="l00183"></a>00183 <a name="l00184"></a>00184 <a name="l00185"></a>00185 <span class="comment"></span> <a name="l00186"></a>00186 <span class="comment"> /// status</span> <a name="l00187"></a>00187 <span class="comment"></span> <a name="l00188"></a>00188 <span class="comment">// is the key bound?</span> <a name="l00189"></a><a class="code" href="classHash_1_1hash__set.html#af34cdaeac932e18cd4618b0abd30c7d1">00189</a> <span class="keywordtype">bool</span> <a class="code" href="classHash_1_1hash__set.html#af34cdaeac932e18cd4618b0abd30c7d1" title="status">contains</a>(<span class="keyword">const</span> <a class="code" href="classHash_1_1hash__set.html#ae94044e96dafa1f67c767a5be87947a5">key_type</a>& key)<span class="keyword"> const </span>{ <a name="l00190"></a>00190 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a4b6eae473c46342713bfeb163c4e8559" title="status">contains</a>(key); <a name="l00191"></a>00191 } <a name="l00192"></a>00192 <a name="l00193"></a>00193 <span class="comment">// returns the number of times a key is bound,</span> <a name="l00194"></a>00194 <span class="comment">// i.e. 0 or 1</span> <a name="l00195"></a><a class="code" href="classHash_1_1hash__set.html#a37cb55e8f59dccad07b4bd7e79535691">00195</a> <a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">size_type</a> <a class="code" href="classHash_1_1hash__set.html#a37cb55e8f59dccad07b4bd7e79535691">count</a>(<span class="keyword">const</span> _Key& key)<span class="keyword"> const </span>{ <a name="l00196"></a>00196 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a7ffa2f780f2d8614b4b6b2b91d55f62e">count</a>(key); <a name="l00197"></a>00197 } <a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="comment">// is the hash map empty?</span> <a name="l00200"></a><a class="code" href="classHash_1_1hash__set.html#af184932d4151562ad96db36d6656f568">00200</a> <span class="keywordtype">bool</span> <a class="code" href="classHash_1_1hash__set.html#af184932d4151562ad96db36d6656f568">empty</a>()<span class="keyword"> const </span>{ <a name="l00201"></a>00201 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a7065f077c220601df60db97a73b0027d">empty</a>(); <a name="l00202"></a>00202 } <a name="l00203"></a>00203 <a name="l00204"></a>00204 <span class="comment">// the number of elements in the hash map</span> <a name="l00205"></a><a class="code" href="classHash_1_1hash__set.html#a8d883de7bd664d4cf8f4e440b711873f">00205</a> <a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">size_type</a> <a class="code" href="classHash_1_1hash__set.html#a8d883de7bd664d4cf8f4e440b711873f">size</a>()<span class="keyword"> const </span>{ <a name="l00206"></a>00206 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#ae30a43e1914f9fabf997e2190fdd6679">size</a>(); <a name="l00207"></a>00207 } <a name="l00208"></a>00208 <a name="l00209"></a>00209 <span class="comment">// the number of buckets in the hash map</span> <a name="l00210"></a><a class="code" href="classHash_1_1hash__set.html#a5b7978c4c9d12650b0813433b025016d">00210</a> <a class="code" href="classHash_1_1hash__set.html#a453c55d429fc37785587c895224717d8">size_type</a> <a class="code" href="classHash_1_1hash__set.html#a5b7978c4c9d12650b0813433b025016d">bucket_count</a>()<span class="keyword"> const </span>{ <a name="l00211"></a>00211 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a462c80ab1a76fd7a1c2e0c5372e66f86">bucket_count</a>(); <a name="l00212"></a>00212 } <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="comment">// returns the average number of elements per bucket</span> <a name="l00215"></a><a class="code" href="classHash_1_1hash__set.html#a7110fbd96a0ac929d6717dad9ed4810d">00215</a> <span class="keywordtype">float</span> <a class="code" href="classHash_1_1hash__set.html#a7110fbd96a0ac929d6717dad9ed4810d">load_factor</a>()<span class="keyword"> const </span>{ <a name="l00216"></a>00216 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a956196112f728577cbd0e280694ed58e">load_factor</a>(); <a name="l00217"></a>00217 } <a name="l00218"></a>00218 <a name="l00219"></a>00219 <a name="l00220"></a>00220 <span class="comment"></span> <a name="l00221"></a>00221 <span class="comment"> /// iterators</span> <a name="l00222"></a>00222 <span class="comment"></span> <a name="l00223"></a>00223 <span class="comment">// returns forward iterator to iterate over all key/data pairs</span> <a name="l00224"></a><a class="code" href="classHash_1_1hash__set.html#a69de75543eb1e9fa3510bb5090ad61a6">00224</a> <a class="code" href="classHash_1_1hash__set.html#a87a125f71dd85de65e662559bd5a66dc">iterator</a> <a class="code" href="classHash_1_1hash__set.html#a69de75543eb1e9fa3510bb5090ad61a6" title="iterators">begin</a>() { <a name="l00225"></a>00225 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a96bd3fd3ef6ce56fef55ccec727aacd2" title="iterators">begin</a>(); <a name="l00226"></a>00226 } <a name="l00227"></a>00227 <a name="l00228"></a>00228 <span class="comment">// const version of begin</span> <a name="l00229"></a><a class="code" href="classHash_1_1hash__set.html#a373db78f8616eb6803196bb38642103f">00229</a> <a class="code" href="classHash_1_1hash__set.html#a318342bf9ac6e65541792709f949c3ef">const_iterator</a> <a class="code" href="classHash_1_1hash__set.html#a373db78f8616eb6803196bb38642103f">begin</a>()<span class="keyword"> const </span>{ <a name="l00230"></a>00230 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a96bd3fd3ef6ce56fef55ccec727aacd2" title="iterators">begin</a>(); <a name="l00231"></a>00231 } <a name="l00232"></a>00232 <a name="l00233"></a>00233 <a name="l00234"></a>00234 <span class="comment">// returns end iterator</span> <a name="l00235"></a><a class="code" href="classHash_1_1hash__set.html#ae3ee82665499970f29a93df9948a5757">00235</a> <a class="code" href="classHash_1_1hash__set.html#a87a125f71dd85de65e662559bd5a66dc">iterator</a> <a class="code" href="classHash_1_1hash__set.html#ae3ee82665499970f29a93df9948a5757">end</a>() { <a name="l00236"></a>00236 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a0b55d938bbf33696c4e75a18bbeb2e8a">end</a>(); <a name="l00237"></a>00237 } <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="comment">// const version of end</span> <a name="l00240"></a><a class="code" href="classHash_1_1hash__set.html#a0803457d6d25f41012bda1a92e45ae84">00240</a> <a class="code" href="classHash_1_1hash__set.html#a318342bf9ac6e65541792709f949c3ef">const_iterator</a> <a class="code" href="classHash_1_1hash__set.html#a0803457d6d25f41012bda1a92e45ae84">end</a>()<span class="keyword"> const </span>{ <a name="l00241"></a>00241 <span class="keywordflow">return</span> <a class="code" href="classHash_1_1hash__set.html#a885b5c4c82db74c7be5022ff35ba0e27" title="variables">d_table</a>.<a class="code" href="classHash_1_1hash__table.html#a0b55d938bbf33696c4e75a18bbeb2e8a">end</a>(); <a name="l00242"></a>00242 } <a name="l00243"></a>00243 }; <a name="l00244"></a>00244 <a name="l00245"></a>00245 } <a name="l00246"></a>00246 <a name="l00247"></a>00247 <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  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>