aboutsummaryrefslogtreecommitdiffstats
path: root/doc/html/HashTable_8h_source.html
blob: 19f5df8a2e6415c3e344a2273e2aa125df741dd9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<!-- HTML header for doxygen 1.8.3.1-->
<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Templates -- Meow: meowpp/dsa/HashTable.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Templates -- Meow
   &#160;<span id="projectnumber">204.13.18</span>
   </div>
   <div id="projectbrief">A C++ template contains kinds of interesting classes and functions</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('HashTable_8h_source.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">HashTable.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="HashTable_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef   dsa_HashTable_H__</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define   dsa_HashTable_H__</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;list&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="keyword">namespace </span>meow {</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Data, <span class="keyword">class</span> HashFunc&gt;</div>
<div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html">   15</a></span>&#160;<span class="keyword">class </span><a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a> {</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;  std::vector&lt;std::list&lt;Data&gt; &gt; table_;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;  HashFunc                          func_;</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a327ccf67321d9b5061dbe01c287bd7e3">   23</a></span>&#160;  <a class="code" href="classmeow_1_1HashTableList.html#a327ccf67321d9b5061dbe01c287bd7e3">HashTableList</a>() {</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;  }</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a0ac878f202fd1aba101df32a481e177c">   31</a></span>&#160;  <a class="code" href="classmeow_1_1HashTableList.html#a0ac878f202fd1aba101df32a481e177c">HashTableList</a>(<span class="keywordtype">size_t</span> <a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>, HashFunc <span class="keyword">const</span>&amp; <a class="code" href="classmeow_1_1HashTableList.html#aaf4154c2534c861455149261c0194f00">func</a>): table_(size), func_(func) {</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  }</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#ad460ece4097203d379e95c835a10d79d">   37</a></span>&#160;  <a class="code" href="classmeow_1_1HashTableList.html#ad460ece4097203d379e95c835a10d79d">~HashTableList</a>() {</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;  }</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a3d769d64e448f0bdbe52514e06b73f54">   43</a></span>&#160;  <a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a>&amp; <a class="code" href="classmeow_1_1HashTableList.html#a3d769d64e448f0bdbe52514e06b73f54">copyFrom</a>(<a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a> <span class="keyword">const</span>&amp; b) {</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    table_ = b.table_;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    func_  = b.func_;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;  }</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a79da4ec6056713e2993e367aac2e6220">   52</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classmeow_1_1HashTableList.html#a79da4ec6056713e2993e367aac2e6220">clear</a>() {</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0, I = table_.size(); i &lt; I; i++) {</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;      table_[i].clear();</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    }</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  }</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#ac7417270658997ef1cb33221fba8d6e8">   61</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classmeow_1_1HashTableList.html#ac7417270658997ef1cb33221fba8d6e8">reset</a>(<span class="keywordtype">size_t</span> <a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>, HashFunc <span class="keyword">const</span>&amp; <a class="code" href="classmeow_1_1HashTableList.html#aaf4154c2534c861455149261c0194f00">func</a>) {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    table_.clear();</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    table_.resize(std::max(size, 1u));</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    func_ = <a class="code" href="classmeow_1_1HashTableList.html#aaf4154c2534c861455149261c0194f00">func</a>;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  }</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a2f72023134f79ce5c7e889779a20762e">   70</a></span>&#160;  <span class="keywordtype">size_t</span> <a class="code" href="classmeow_1_1HashTableList.html#a2f72023134f79ce5c7e889779a20762e">tableSize</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <span class="keywordflow">return</span> table_.size();</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  }</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">   77</a></span>&#160;  <span class="keywordtype">size_t</span> <a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="keywordtype">size_t</span> ret = 0;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0, I = table_.size(); i &lt; I; i++) {</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;      ret += table_[i].size();</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    }</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;  }</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#aaf4154c2534c861455149261c0194f00">   88</a></span>&#160;  HashFunc <span class="keyword">const</span>&amp; <a class="code" href="classmeow_1_1HashTableList.html#aaf4154c2534c861455149261c0194f00">func</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordflow">return</span> func_;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  }</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a6d7a0c3ac05a355cc9e1c60856ebd781">   95</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classmeow_1_1HashTableList.html#a6d7a0c3ac05a355cc9e1c60856ebd781">add</a>(Data <span class="keyword">const</span>&amp; e) {</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <span class="keywordtype">size_t</span> index = func_(e) % <a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>();</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    table_[index].push_back(e);</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  }</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a490a3325017696441fdc4ab8db517871">  104</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classmeow_1_1HashTableList.html#a490a3325017696441fdc4ab8db517871">add</a>(<a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a> <span class="keyword">const</span>&amp; h) {</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0, I = h.table_.size(); i &lt; I; i++) {</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;      <span class="keywordflow">for</span> (std::list&lt;Data&gt;::const_iterator</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;           it = h.table_[index].begin(); it != h.table_[index].end(); ++it) {</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        insert(*it);</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;      }</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    }</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;  }</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a63cc363a99ee99024a32133cf0331325">  117</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classmeow_1_1HashTableList.html#a63cc363a99ee99024a32133cf0331325">del</a>(Data <span class="keyword">const</span>&amp; e) {</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <span class="keywordtype">size_t</span> index = func_(e) % <a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>();</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="keywordflow">for</span> (std::list&lt;Data&gt;::const_iterator</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;         it = table_[index].begin(); it != table_[index].end(); ++it) {</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;      <span class="keywordflow">if</span> ((*it) == e) {</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        table_[index].erase(i);</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;      }</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    }</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  }</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a25fa6ad234486128f2b0357bfabf5206">  132</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classmeow_1_1HashTableList.html#a25fa6ad234486128f2b0357bfabf5206">del</a>(<a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a> <span class="keyword">const</span>&amp; h) {</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>() &gt; h.<a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>()) {</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;      <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0, I = h.table_.size(); i &lt; I; i++) {</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;        <span class="keywordflow">for</span> (std::list&lt;Data&gt;::const_iterator</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;             it = h.table_[index].begin(); it != h.table_[index].end(); ++it) {</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;          erase(*it);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        }</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;      }</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    }</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;      <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0, I = table_.size(); i &lt; I; i++) {</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        <span class="keywordflow">for</span> (std::list&lt;Data&gt;::const_iterator</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;             it = table_[index].begin(); it != table_[index].end(); ) {</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;          <span class="keywordflow">if</span> (h.<a class="code" href="classmeow_1_1HashTableList.html#a65227191dccd021a0802810ffe007040">exist</a>(*it)) {</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;            table_[index].erase(it);</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;          }</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;          <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;            ++it;</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;          }</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        }</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;      }</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    }</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;  }</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;</div>
<div class="line"><a name="l00160"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a65227191dccd021a0802810ffe007040">  160</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classmeow_1_1HashTableList.html#a65227191dccd021a0802810ffe007040">exist</a>(Data <span class="keyword">const</span>&amp; e)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    <span class="keywordtype">size_t</span> index = func_(e) % <a class="code" href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">size</a>();</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordflow">for</span> (std::list&lt;Data&gt;::const_iterator</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;         it = table_[index].begin(); it != table_[index].end(); ++it) {</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;      <span class="keywordflow">if</span> ((*it) == e)</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    }</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;  }</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;</div>
<div class="line"><a name="l00173"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a2cdacf0bac46df21b852c3cb91cd44c3">  173</a></span>&#160;  std::vector&lt;Data&gt; <a class="code" href="classmeow_1_1HashTableList.html#a2cdacf0bac46df21b852c3cb91cd44c3">all</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    std::vector&lt;Data&gt; ret;</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0, I = table_.size(); i &lt; I; i++) {</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;      <span class="keywordflow">for</span> (std::list&lt;Data&gt;::const_iterator</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;           it = table_[i].begin(); it != table_[i].end(); ++it) {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        ret.push_back(*it);</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;      }</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    }</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;  }</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div>
<div class="line"><a name="l00187"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#af3ac22fd18ce14878e881331883397b8">  187</a></span>&#160;  std::vector&lt;Data&gt; <a class="code" href="classmeow_1_1HashTableList.html#af3ac22fd18ce14878e881331883397b8">all</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    index %= table_.size();</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;    std::vector&lt;Data&gt; ret;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    <span class="keywordflow">for</span> (std::list&lt;Data&gt;::const_iterator</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;         it = table_[index].begin(); it != table_[index].end(); ++it) {</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;      ret.push_back(*it);</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    }</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;  }</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;</div>
<div class="line"><a name="l00198"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a9f9493e2044df374ac9e650303fdf212">  198</a></span>&#160;  <a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a>&amp; <a class="code" href="classmeow_1_1HashTableList.html#a9f9493e2044df374ac9e650303fdf212">operator=</a>(<a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a> <span class="keyword">const</span>&amp; h) {</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classmeow_1_1HashTableList.html#a3d769d64e448f0bdbe52514e06b73f54">copyFrom</a>(h);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;  }</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div>
<div class="line"><a name="l00203"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a7bef8d0510d33a06507881a872c62156">  203</a></span>&#160;  <a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a>&amp; <a class="code" href="classmeow_1_1HashTableList.html#a7bef8d0510d33a06507881a872c62156">operator+=</a>(<a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a> <span class="keyword">const</span>&amp; h) {</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    <a class="code" href="classmeow_1_1HashTableList.html#a6d7a0c3ac05a355cc9e1c60856ebd781">add</a>(h);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;  }</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;</div>
<div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="classmeow_1_1HashTableList.html#a3c3e1ad9bf9993ded4a6904f07abb920">  209</a></span>&#160;  <a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a>&amp; <a class="code" href="classmeow_1_1HashTableList.html#a3c3e1ad9bf9993ded4a6904f07abb920">operator-=</a>(<a class="code" href="classmeow_1_1HashTableList.html">HashTableList</a> <span class="keyword">const</span>&amp; h) {</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;    <a class="code" href="classmeow_1_1HashTableList.html#a63cc363a99ee99024a32133cf0331325">del</a>(h);</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;  }</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;};</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;} <span class="comment">// meow</span></div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;<span class="preprocessor">#endif // dsa_HashTable_H__</span></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_af3ac22fd18ce14878e881331883397b8"><div class="ttname"><a href="classmeow_1_1HashTableList.html#af3ac22fd18ce14878e881331883397b8">meow::HashTableList::all</a></div><div class="ttdeci">std::vector&lt; Data &gt; all(size_t index) const </div><div class="ttdoc">回傳所有存下來且key為index的資料 </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00187">HashTable.h:187</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a25fa6ad234486128f2b0357bfabf5206"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a25fa6ad234486128f2b0357bfabf5206">meow::HashTableList::del</a></div><div class="ttdeci">bool del(HashTableList const &amp;h)</div><div class="ttdoc">刪除有出現在給定的的HashTableList中的element </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00132">HashTable.h:132</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a327ccf67321d9b5061dbe01c287bd7e3"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a327ccf67321d9b5061dbe01c287bd7e3">meow::HashTableList::HashTableList</a></div><div class="ttdeci">HashTableList()</div><div class="ttdoc">constructor </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00023">HashTable.h:23</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a0ac878f202fd1aba101df32a481e177c"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a0ac878f202fd1aba101df32a481e177c">meow::HashTableList::HashTableList</a></div><div class="ttdeci">HashTableList(size_t size, HashFunc const &amp;func)</div><div class="ttdoc">constructor </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00031">HashTable.h:31</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a7bef8d0510d33a06507881a872c62156"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a7bef8d0510d33a06507881a872c62156">meow::HashTableList::operator+=</a></div><div class="ttdeci">HashTableList &amp; operator+=(HashTableList const &amp;h)</div><div class="ttdoc">same as add(h) </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00203">HashTable.h:203</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a3c3e1ad9bf9993ded4a6904f07abb920"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a3c3e1ad9bf9993ded4a6904f07abb920">meow::HashTableList::operator-=</a></div><div class="ttdeci">HashTableList &amp; operator-=(HashTableList const &amp;h)</div><div class="ttdoc">same as del(h) </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00209">HashTable.h:209</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a79da4ec6056713e2993e367aac2e6220"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a79da4ec6056713e2993e367aac2e6220">meow::HashTableList::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdoc">清除資料 </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00052">HashTable.h:52</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html"><div class="ttname"><a href="classmeow_1_1HashTableList.html">meow::HashTableList</a></div><div class="ttdoc">一個當key相撞時會用list解決的hash_table </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00015">HashTable.h:15</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_af8d49492c5f35bb18706e9fb72d18157"><div class="ttname"><a href="classmeow_1_1HashTableList.html#af8d49492c5f35bb18706e9fb72d18157">meow::HashTableList::size</a></div><div class="ttdeci">size_t size() const </div><div class="ttdoc">回傳目前有多少element在其中 </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00077">HashTable.h:77</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a2cdacf0bac46df21b852c3cb91cd44c3"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a2cdacf0bac46df21b852c3cb91cd44c3">meow::HashTableList::all</a></div><div class="ttdeci">std::vector&lt; Data &gt; all() const </div><div class="ttdoc">回傳所有存下來的資料 </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00173">HashTable.h:173</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a63cc363a99ee99024a32133cf0331325"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a63cc363a99ee99024a32133cf0331325">meow::HashTableList::del</a></div><div class="ttdeci">bool del(Data const &amp;e)</div><div class="ttdoc">刪除element </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00117">HashTable.h:117</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_aaf4154c2534c861455149261c0194f00"><div class="ttname"><a href="classmeow_1_1HashTableList.html#aaf4154c2534c861455149261c0194f00">meow::HashTableList::func</a></div><div class="ttdeci">HashFunc const &amp; func() const </div><div class="ttdoc">回傳hash function </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00088">HashTable.h:88</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a2f72023134f79ce5c7e889779a20762e"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a2f72023134f79ce5c7e889779a20762e">meow::HashTableList::tableSize</a></div><div class="ttdeci">size_t tableSize() const </div><div class="ttdoc">回傳table size </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00070">HashTable.h:70</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a65227191dccd021a0802810ffe007040"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a65227191dccd021a0802810ffe007040">meow::HashTableList::exist</a></div><div class="ttdeci">bool exist(Data const &amp;e) const </div><div class="ttdoc">查看某element是否已經擁有 </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00160">HashTable.h:160</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a6d7a0c3ac05a355cc9e1c60856ebd781"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a6d7a0c3ac05a355cc9e1c60856ebd781">meow::HashTableList::add</a></div><div class="ttdeci">bool add(Data const &amp;e)</div><div class="ttdoc">加入新的element </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00095">HashTable.h:95</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_ac7417270658997ef1cb33221fba8d6e8"><div class="ttname"><a href="classmeow_1_1HashTableList.html#ac7417270658997ef1cb33221fba8d6e8">meow::HashTableList::reset</a></div><div class="ttdeci">void reset(size_t size, HashFunc const &amp;func)</div><div class="ttdoc">清除資料, 指定新的size與hash function </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00061">HashTable.h:61</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a490a3325017696441fdc4ab8db517871"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a490a3325017696441fdc4ab8db517871">meow::HashTableList::add</a></div><div class="ttdeci">bool add(HashTableList const &amp;h)</div><div class="ttdoc">把給定的HashTableList中所有的element全加進來 </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00104">HashTable.h:104</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a3d769d64e448f0bdbe52514e06b73f54"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a3d769d64e448f0bdbe52514e06b73f54">meow::HashTableList::copyFrom</a></div><div class="ttdeci">HashTableList &amp; copyFrom(HashTableList const &amp;b)</div><div class="ttdoc">copy </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00043">HashTable.h:43</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_a9f9493e2044df374ac9e650303fdf212"><div class="ttname"><a href="classmeow_1_1HashTableList.html#a9f9493e2044df374ac9e650303fdf212">meow::HashTableList::operator=</a></div><div class="ttdeci">HashTableList &amp; operator=(HashTableList const &amp;h)</div><div class="ttdoc">same as copyFrom(h) </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00198">HashTable.h:198</a></div></div>
<div class="ttc" id="classmeow_1_1HashTableList_html_ad460ece4097203d379e95c835a10d79d"><div class="ttname"><a href="classmeow_1_1HashTableList.html#ad460ece4097203d379e95c835a10d79d">meow::HashTableList::~HashTableList</a></div><div class="ttdeci">~HashTableList()</div><div class="ttdoc">destructor </div><div class="ttdef"><b>Definition:</b> <a href="HashTable_8h_source.html#l00037">HashTable.h:37</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_92fecd8d02dd5e7a67429447fdf0f60f.html">meowpp</a></li><li class="navelem"><a class="el" href="dir_a17ff8dcb3a1c1b842af541700214096.html">dsa</a></li><li class="navelem"><a class="el" href="HashTable_8h.html">HashTable.h</a></li>
    <li class="footer">Generated on Tue Jun 24 2014 03:53:31 for Templates -- Meow by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>