📄 ____hash_8h-source.html
字号:
<a name="l00319"></a>00319 <span class="keywordtype">void</span> TakeArray(<span class="keyword">const</span> std::vector<T> &array);<a name="l00327"></a>00327 bucket_array_unit GetArray(std::vector<T> &array) <span class="keyword">const</span>;<a name="l00328"></a>00328 <a name="l00330"></a>00330 <a name="l00334"></a><a class="code" href="class____hash.html#b6ea7e2b2078eed4efd6677038ea63cc">00334</a> bucket_array_unit GetBucketStats(std::vector<size_t> &array)<span class="keyword"> const </span>{<a name="l00335"></a>00335 array.clear();<a name="l00336"></a>00336 bucket_array &table = <a class="code" href="class____hash.html">__hash<T>::m_buckets</a>;<a name="l00337"></a>00337 <span class="keywordflow">for</span> (bucket_array_unit nTableIndex = 0; nTableIndex < table.size(); nTableIndex++) {<a name="l00338"></a>00338 <span class="keyword">const</span> <a class="code" href="class____hash_1_1elementlist.html">hashelementlist</a> &the_list = table[nTableIndex];<a name="l00339"></a>00339 bucket_array_unit nThisListSize = the_list.size();<a name="l00340"></a>00340 <span class="keywordflow">if</span> (nThisListSize >= array.size()) array.resize(nThisListSize + 1);<a name="l00341"></a>00341 array[nThisListSize]++;<a name="l00342"></a>00342 }<a name="l00343"></a>00343 <span class="keywordflow">return</span> array.size();<a name="l00344"></a>00344 }<a name="l00345"></a>00345 <a name="l00349"></a><a class="code" href="class____hash_1_1hasherator.html">00349</a> <span class="keyword">class </span><a class="code" href="class____hash_1_1hasherator.html">hasherator</a> {<a name="l00350"></a>00350 <span class="keyword">public</span>:<a name="l00352"></a>00352 <a name="l00353"></a><a class="code" href="class____hash_1_1hasherator.html#0531c889370afe2cf67c329fc3a0af2e">00353</a> <a class="code" href="class____hash_1_1hasherator.html">hasherator</a>() {<a name="l00354"></a>00354 <span class="preprocessor"> #ifndef NDEBUG</span><a name="l00355"></a>00355 <span class="preprocessor"></span> m_pbuckets = NULL;<a name="l00356"></a>00356 m_pListElement = NULL;<a name="l00357"></a>00357 <span class="preprocessor"> #endif</span><a name="l00358"></a>00358 <span class="preprocessor"></span> }<a name="l00363"></a>00363 <a class="code" href="class____hash_1_1hasherator.html">hasherator</a>(bucket_array &buckets);<a name="l00364"></a>00364 <a name="l00369"></a>00369 <a class="code" href="class____hash_1_1hasherator.html">hasherator</a> &operator++();<a name="l00374"></a><a class="code" href="class____hash_1_1hasherator.html#1eb3466c98a19db09211b35d0b4a3315">00374</a> T &operator *() {<a name="l00375"></a>00375 <span class="keywordflow">return</span> m_pListElement->m_element;<a name="l00376"></a>00376 }<a name="l00380"></a><a class="code" href="class____hash_1_1hasherator.html#56bdc14e1c944c3af5c6ed1376da65d3">00380</a> T *operator ->() {<a name="l00381"></a>00381 <span class="keywordflow">return</span> &(operator*());<a name="l00382"></a>00382 }<a name="l00388"></a><a class="code" href="class____hash_1_1hasherator.html#cf54aae5e63a6cd803cb6b12eb3a4422">00388</a> <span class="keywordtype">bool</span> operator ==(<span class="keyword">const</span> <a class="code" href="class____hash_1_1hasherator.html">hasherator</a> &p)<span class="keyword"> const </span>{<a name="l00389"></a>00389 <span class="keywordflow">return</span> m_pListElement == p.<a class="code" href="class____hash_1_1hasherator.html#1dd6eed59b8c3765af467b92cc805f23">m_pListElement</a>;<a name="l00390"></a>00390 }<a name="l00396"></a><a class="code" href="class____hash_1_1hasherator.html#67c0a6ffe20a3caee0ed7d979ee0f79f">00396</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> IsEnd()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_pListElement == NULL;}<a name="l00397"></a>00397 <span class="keyword">protected</span>:<a name="l00398"></a><a class="code" href="class____hash_1_1hasherator.html#3819f7d793141967e8719f96d662efa1">00398</a> bucket_array *m_pbuckets;<a name="l00399"></a>00399 <a name="l00400"></a><a class="code" href="class____hash_1_1hasherator.html#111d391c477cf3dca8d63d2780861f27">00400</a> bucket_array_unit m_nBucketIndex;<a name="l00401"></a><a class="code" href="class____hash_1_1hasherator.html#1dd6eed59b8c3765af467b92cc805f23">00401</a> <a class="code" href="class____hash_1_1listelement.html">listelement</a> *m_pListElement;<a name="l00402"></a>00402 };<a name="l00403"></a>00403 <a name="l00405"></a><a class="code" href="class____hash_1_1const__hasherator.html">00405</a> <span class="keyword">class </span><a class="code" href="class____hash_1_1const__hasherator.html">const_hasherator</a> {<a name="l00406"></a>00406 <span class="keyword">public</span>:<a name="l00408"></a>00408 <a name="l00409"></a><a class="code" href="class____hash_1_1const__hasherator.html#0b8e5ac68891fb2ed77e55ce44acde3e">00409</a> <a class="code" href="class____hash_1_1const__hasherator.html">const_hasherator</a>() {<a name="l00410"></a>00410 <span class="preprocessor"> #ifndef NDEBUG</span><a name="l00411"></a>00411 <span class="preprocessor"></span> m_pbuckets = NULL;<a name="l00412"></a>00412 m_pListElement = NULL;<a name="l00413"></a>00413 <span class="preprocessor"> #endif</span><a name="l00414"></a>00414 <span class="preprocessor"></span> }<a name="l00419"></a>00419 <a class="code" href="class____hash_1_1const__hasherator.html">const_hasherator</a>(<span class="keyword">const</span> bucket_array &buckets);<a name="l00420"></a>00420 <a name="l00425"></a>00425 <a class="code" href="class____hash_1_1const__hasherator.html">const_hasherator</a> &operator++();<a name="l00430"></a><a class="code" href="class____hash_1_1const__hasherator.html#0fc4a0ccad31a63cd5eab4766b99361b">00430</a> <span class="keyword">const</span> T &operator *()<span class="keyword"> const </span>{<a name="l00431"></a>00431 assert(m_pListElement != NULL);<a name="l00432"></a>00432 <span class="keywordflow">return</span> m_pListElement->m_element;<a name="l00433"></a>00433 }<a name="l00437"></a><a class="code" href="class____hash_1_1const__hasherator.html#55644e80b5008b4f42f384b38e4a9344">00437</a> <span class="keyword">const</span> T *operator ->()<span class="keyword"> const </span>{<a name="l00438"></a>00438 <span class="keywordflow">return</span> &(operator*());<a name="l00439"></a>00439 }<a name="l00445"></a><a class="code" href="class____hash_1_1const__hasherator.html#c824a8740e5c517ce673e7932734e8ac">00445</a> <span class="keywordtype">bool</span> operator ==(<span class="keyword">const</span> <a class="code" href="class____hash_1_1const__hasherator.html">const_hasherator</a> &iter)<span class="keyword"> const </span>{<a name="l00446"></a>00446 <span class="keywordflow">return</span> m_pListElement == iter.<a class="code" href="class____hash_1_1const__hasherator.html#6f4f5140d964a93c01e091b794d29c87">m_pListElement</a>;<a name="l00447"></a>00447 }<a name="l00453"></a><a class="code" href="class____hash_1_1const__hasherator.html#eae430856c6cea99df33d849021d9acd">00453</a> <span class="keywordtype">bool</span> IsEnd()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_pListElement == NULL;}<a name="l00454"></a>00454 <span class="keyword">protected</span>:<a name="l00455"></a>00455 <span class="comment">//bool m_bEnd;//!<TRUE if this iterator points past-the-end of the hash table, FALSE otherwise</span><a name="l00456"></a>00456 <span class="comment">//typedef const bucket_array * cbucket_array_ptr;</span><a name="l00457"></a><a class="code" href="class____hash_1_1const__hasherator.html#e87e4589026f90cbafa0ca4f8ca10308">00457</a> <span class="keyword">const</span> bucket_array *m_pbuckets;<a name="l00458"></a><a class="code" href="class____hash_1_1const__hasherator.html#322f354f365bc6e765ab0f21725cda00">00458</a> bucket_array_unit m_nBucketIndex;<a name="l00459"></a><a class="code" href="class____hash_1_1const__hasherator.html#6f4f5140d964a93c01e091b794d29c87">00459</a> <span class="keyword">const</span> <a class="code" href="class____hash_1_1listelement.html">listelement</a> *m_pListElement;<a name="l00460"></a>00460 <span class="comment">//const hashelementlist *m_plist;//!<The STL list that this iterator is pointing to.</span><a name="l00461"></a>00461 };<a name="l00462"></a>00462 <a name="l00467"></a><a class="code" href="class____hash.html#9d12bd08a34697e1486ccb92008445d4">00467</a> <a class="code" href="class____hash_1_1hasherator.html">hasherator</a> begin() {<a name="l00468"></a>00468 <a class="code" href="class____hash_1_1hasherator.html">hasherator</a> iter(<a class="code" href="class____hash.html">__hash<T>::m_buckets</a>);<a name="l00469"></a>00469 <span class="keywordflow">return</span> iter;<a name="l00470"></a>00470 }<a name="l00475"></a><a class="code" href="class____hash.html#e885e2c4334d8573e3ad4b1d7ca5c7ec">00475</a> <a class="code" href="class____hash_1_1const__hasherator.html">const_hasherator</a> begin()<span class="keyword"> const </span>{<a name="l00476"></a>00476 <a class="code" href="class____hash_1_1const__hasherator.html">const_hasherator</a> iter(<a class="code" href="class____hash.html">__hash<T>::m_buckets</a>);<a name="l00477"></a>00477 <span class="keywordflow">return</span> iter;<a name="l00478"></a>00478 }<a name="l00479"></a>00479 <a name="l00484"></a><a class="code" href="class____hash.html#a8885d121d5105769c4cfd3ee0ec89b7">00484</a> <span class="keywordtype">void</span> Delete() {<a name="l00485"></a>00485 m_buckets.clear();<a name="l00486"></a>00486 m_nCount = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -