/usr/share/doc/libjuce/apiref/classHashMap.html is in libjuce-doc 4.3.0~repack-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | <!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.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>JUCE: HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse > Class Template Reference</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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.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="projectalign" style="padding-left: 0.5em;">
<div id="projectname">JUCE
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="classHashMap-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse > Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Holds a set of mappings between some key/value pairs.
<a href="classHashMap.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap_1_1Iterator.html">Iterator</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Iterates over the items in a <a class="el" href="classHashMap.html" title="Holds a set of mappings between some key/value pairs. ">HashMap</a>. <a href="classHashMap_1_1Iterator.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:adc9bae72a08bd95e9e030b76d101e215"><td class="memItemLeft" align="right" valign="top">typedef TypeOfCriticalSectionToUse::ScopedLockType </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#adc9bae72a08bd95e9e030b76d101e215">ScopedLockType</a></td></tr>
<tr class="memdesc:adc9bae72a08bd95e9e030b76d101e215"><td class="mdescLeft"> </td><td class="mdescRight">Returns the type of scoped lock to use for locking this array. <a href="#adc9bae72a08bd95e9e030b76d101e215">More...</a><br /></td></tr>
<tr class="separator:adc9bae72a08bd95e9e030b76d101e215"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a4d6d41cfc524ccc0a73f0251d7fc1fab"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a4d6d41cfc524ccc0a73f0251d7fc1fab">HashMap</a> (int numberOfSlots=defaultHashTableSize, HashFunctionType hashFunction=HashFunctionType())</td></tr>
<tr class="memdesc:a4d6d41cfc524ccc0a73f0251d7fc1fab"><td class="mdescLeft"> </td><td class="mdescRight">Creates an empty hash-map. <a href="#a4d6d41cfc524ccc0a73f0251d7fc1fab">More...</a><br /></td></tr>
<tr class="separator:a4d6d41cfc524ccc0a73f0251d7fc1fab"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a33001fb7329c32bdca37d969984f1e58"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a33001fb7329c32bdca37d969984f1e58">~HashMap</a> ()</td></tr>
<tr class="memdesc:a33001fb7329c32bdca37d969984f1e58"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a33001fb7329c32bdca37d969984f1e58">More...</a><br /></td></tr>
<tr class="separator:a33001fb7329c32bdca37d969984f1e58"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2922931b85fa384901d82de2b46b0845"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a2922931b85fa384901d82de2b46b0845">clear</a> ()</td></tr>
<tr class="memdesc:a2922931b85fa384901d82de2b46b0845"><td class="mdescLeft"> </td><td class="mdescRight">Removes all values from the map. <a href="#a2922931b85fa384901d82de2b46b0845">More...</a><br /></td></tr>
<tr class="separator:a2922931b85fa384901d82de2b46b0845"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a79c34c9f6a0799d6cae1b84ff61b7a34"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a79c34c9f6a0799d6cae1b84ff61b7a34">size</a> () const noexcept</td></tr>
<tr class="memdesc:a79c34c9f6a0799d6cae1b84ff61b7a34"><td class="mdescLeft"> </td><td class="mdescRight">Returns the current number of items in the map. <a href="#a79c34c9f6a0799d6cae1b84ff61b7a34">More...</a><br /></td></tr>
<tr class="separator:a79c34c9f6a0799d6cae1b84ff61b7a34"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a474cb5ceff88a13e2b15f54e675411ad"><td class="memItemLeft" align="right" valign="top">ValueType </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a474cb5ceff88a13e2b15f54e675411ad">operator[]</a> (KeyTypeParameter keyToLookFor) const</td></tr>
<tr class="memdesc:a474cb5ceff88a13e2b15f54e675411ad"><td class="mdescLeft"> </td><td class="mdescRight">Returns the value corresponding to a given key. <a href="#a474cb5ceff88a13e2b15f54e675411ad">More...</a><br /></td></tr>
<tr class="separator:a474cb5ceff88a13e2b15f54e675411ad"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a134779c6595424e65d74c846ef3e8672"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a134779c6595424e65d74c846ef3e8672">contains</a> (KeyTypeParameter keyToLookFor) const</td></tr>
<tr class="memdesc:a134779c6595424e65d74c846ef3e8672"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the map contains an item with the specied key. <a href="#a134779c6595424e65d74c846ef3e8672">More...</a><br /></td></tr>
<tr class="separator:a134779c6595424e65d74c846ef3e8672"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab0d3799b8b807e4de6a8893c44087a03"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#ab0d3799b8b807e4de6a8893c44087a03">containsValue</a> (ValueTypeParameter valueToLookFor) const</td></tr>
<tr class="memdesc:ab0d3799b8b807e4de6a8893c44087a03"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the hash contains at least one occurrence of a given value. <a href="#ab0d3799b8b807e4de6a8893c44087a03">More...</a><br /></td></tr>
<tr class="separator:ab0d3799b8b807e4de6a8893c44087a03"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a875c55a3b720118cd6687fd6494f7afd"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a875c55a3b720118cd6687fd6494f7afd">set</a> (KeyTypeParameter newKey, ValueTypeParameter newValue)</td></tr>
<tr class="memdesc:a875c55a3b720118cd6687fd6494f7afd"><td class="mdescLeft"> </td><td class="mdescRight">Adds or replaces an element in the hash-map. <a href="#a875c55a3b720118cd6687fd6494f7afd">More...</a><br /></td></tr>
<tr class="separator:a875c55a3b720118cd6687fd6494f7afd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac308687ea47efa4d1559ec1b35505ad2"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#ac308687ea47efa4d1559ec1b35505ad2">remove</a> (KeyTypeParameter keyToRemove)</td></tr>
<tr class="memdesc:ac308687ea47efa4d1559ec1b35505ad2"><td class="mdescLeft"> </td><td class="mdescRight">Removes an item with the given key. <a href="#ac308687ea47efa4d1559ec1b35505ad2">More...</a><br /></td></tr>
<tr class="separator:ac308687ea47efa4d1559ec1b35505ad2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7c7e68766babe36a8ae07033d3652f2f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a7c7e68766babe36a8ae07033d3652f2f">removeValue</a> (ValueTypeParameter valueToRemove)</td></tr>
<tr class="memdesc:a7c7e68766babe36a8ae07033d3652f2f"><td class="mdescLeft"> </td><td class="mdescRight">Removes all items with the given value. <a href="#a7c7e68766babe36a8ae07033d3652f2f">More...</a><br /></td></tr>
<tr class="separator:a7c7e68766babe36a8ae07033d3652f2f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aadd0f7eaeacd996eed49440b27d9f308"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#aadd0f7eaeacd996eed49440b27d9f308">remapTable</a> (int newNumberOfSlots)</td></tr>
<tr class="memdesc:aadd0f7eaeacd996eed49440b27d9f308"><td class="mdescLeft"> </td><td class="mdescRight">Remaps the hash-map to use a different number of slots for its hash function. <a href="#aadd0f7eaeacd996eed49440b27d9f308">More...</a><br /></td></tr>
<tr class="separator:aadd0f7eaeacd996eed49440b27d9f308"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a28c5938ec533466631b98451c6b78072"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a28c5938ec533466631b98451c6b78072">getNumSlots</a> () const noexcept</td></tr>
<tr class="memdesc:a28c5938ec533466631b98451c6b78072"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of slots which are available for hashing. <a href="#a28c5938ec533466631b98451c6b78072">More...</a><br /></td></tr>
<tr class="separator:a28c5938ec533466631b98451c6b78072"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a885345c5f15712041e6e46d38d6e564b"><td class="memTemplParams" colspan="2">template<class OtherHashMapType > </td></tr>
<tr class="memitem:a885345c5f15712041e6e46d38d6e564b"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classHashMap.html#a885345c5f15712041e6e46d38d6e564b">swapWith</a> (OtherHashMapType &otherHashMap) noexcept</td></tr>
<tr class="memdesc:a885345c5f15712041e6e46d38d6e564b"><td class="mdescLeft"> </td><td class="mdescRight">Efficiently swaps the contents of two hash-maps. <a href="#a885345c5f15712041e6e46d38d6e564b">More...</a><br /></td></tr>
<tr class="separator:a885345c5f15712041e6e46d38d6e564b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a539b127c2f399e4d5f6c235222fb7bf2"><td class="memItemLeft" align="right" valign="top">const TypeOfCriticalSectionToUse & </td><td class="memItemRight" valign="bottom"><a class="el" href="classHashMap.html#a539b127c2f399e4d5f6c235222fb7bf2">getLock</a> () const noexcept</td></tr>
<tr class="memdesc:a539b127c2f399e4d5f6c235222fb7bf2"><td class="mdescLeft"> </td><td class="mdescRight">Returns the <a class="el" href="classCriticalSection.html" title="A re-entrant mutex. ">CriticalSection</a> that locks this structure. <a href="#a539b127c2f399e4d5f6c235222fb7bf2">More...</a><br /></td></tr>
<tr class="separator:a539b127c2f399e4d5f6c235222fb7bf2"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection><br />
class HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse ></h3>
<p>Holds a set of mappings between some key/value pairs. </p>
<p>The types of the key and value objects are set as template parameters. You can also specify a class to supply a hash function that converts a key value into an hashed integer. This class must have the form:</p>
<div class="fragment"><div class="line"><span class="keyword">struct </span>MyHashGenerator</div><div class="line">{</div><div class="line"> <span class="keywordtype">int</span> generateHash (MyKeyType key, <span class="keywordtype">int</span> upperLimit)<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> <span class="comment">// The function must return a value 0 <= x < upperLimit</span></div><div class="line"> <span class="keywordflow">return</span> someFunctionOfMyKeyType (key) % upperLimit;</div><div class="line"> }</div><div class="line">};</div></div><!-- fragment --><p>Like the <a class="el" href="classArray.html" title="Holds a resizable array of primitive or copy-by-value objects. ">Array</a> class, the key and value types are expected to be copy-by-value types, so if you define them to be pointer types, this class won't delete the objects that they point to.</p>
<p>If you don't supply a class for the HashFunctionType template parameter, the default one provides some simple mappings for strings and ints.</p>
<div class="fragment"><div class="line"><a class="code" href="classHashMap.html">HashMap<int, String></a> hash;</div><div class="line">hash.<a class="code" href="classHashMap.html#a875c55a3b720118cd6687fd6494f7afd">set</a> (1, <span class="stringliteral">"item1"</span>);</div><div class="line">hash.<a class="code" href="classHashMap.html#a875c55a3b720118cd6687fd6494f7afd">set</a> (2, <span class="stringliteral">"item2"</span>);</div><div class="line"></div><div class="line"><a class="code" href="juce__PlatformDefs_8h.html#a679635952a5d2eb25f3b31398f0fcc25">DBG</a> (hash [1]); <span class="comment">// prints "item1"</span></div><div class="line"><a class="code" href="juce__PlatformDefs_8h.html#a679635952a5d2eb25f3b31398f0fcc25">DBG</a> (hash [2]); <span class="comment">// prints "item2"</span></div><div class="line"></div><div class="line"><span class="comment">// This iterates the map, printing all of its key -> value pairs..</span></div><div class="line"><span class="keywordflow">for</span> (<a class="code" href="classHashMap_1_1Iterator.html">HashMap<int, String>::Iterator</a> i (hash); i.<a class="code" href="classHashMap_1_1Iterator.html#abdbcb9001e0777946703ff4c8cbde785">next</a>();)</div><div class="line"> <a class="code" href="juce__PlatformDefs_8h.html#a679635952a5d2eb25f3b31398f0fcc25">DBG</a> (i.getKey() << <span class="stringliteral">" -> "</span> << i.getValue());</div></div><!-- fragment --><dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">HashFunctionType</td><td>The class of hash function, which must be copy-constructible. </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classCriticalSection.html" title="A re-entrant mutex. ">CriticalSection</a>, <a class="el" href="structDefaultHashFunctions.html" title="A simple class to generate hash functions for some primitive types, intended for use with the HashMap...">DefaultHashFunctions</a>, <a class="el" href="classNamedValueSet.html" title="Holds a set of named var objects. ">NamedValueSet</a>, <a class="el" href="classSortedSet.html" title="Holds a set of unique primitive objects, such as ints or doubles. ">SortedSet</a> </dd></dl>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a id="adc9bae72a08bd95e9e030b76d101e215"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adc9bae72a08bd95e9e030b76d101e215">§ </a></span>ScopedLockType</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">typedef TypeOfCriticalSectionToUse::ScopedLockType <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::<a class="el" href="classHashMap.html#adc9bae72a08bd95e9e030b76d101e215">ScopedLockType</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the type of scoped lock to use for locking this array. </p>
</div>
</div>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="a4d6d41cfc524ccc0a73f0251d7fc1fab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4d6d41cfc524ccc0a73f0251d7fc1fab">§ </a></span>HashMap()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::<a class="el" href="classHashMap.html">HashMap</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>numberOfSlots</em> = <code>defaultHashTableSize</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashFunctionType </td>
<td class="paramname"><em>hashFunction</em> = <code>HashFunctionType()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates an empty hash-map. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">numberOfSlots</td><td>Specifies the number of hash entries the map will use. This will be the "upperLimit" parameter that is passed to your generateHash() function. The number of hash slots will grow automatically if necessary, or it can be remapped manually using <a class="el" href="classHashMap.html#aadd0f7eaeacd996eed49440b27d9f308" title="Remaps the hash-map to use a different number of slots for its hash function. ">remapTable()</a>. </td></tr>
<tr><td class="paramname">hashFunction</td><td>An instance of HashFunctionType, which will be copied and stored to use with the <a class="el" href="classHashMap.html" title="Holds a set of mappings between some key/value pairs. ">HashMap</a>. This parameter can be omitted if HashFunctionType has a default constructor. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a33001fb7329c32bdca37d969984f1e58"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a33001fb7329c32bdca37d969984f1e58">§ </a></span>~HashMap()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::~<a class="el" href="classHashMap.html">HashMap</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a2922931b85fa384901d82de2b46b0845"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2922931b85fa384901d82de2b46b0845">§ </a></span>clear()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::clear </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Removes all values from the map. </p>
<p>Note that this will clear the content, but won't affect the number of slots (see remapTable and getNumSlots). </p>
</div>
</div>
<a id="a79c34c9f6a0799d6cae1b84ff61b7a34"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a79c34c9f6a0799d6cae1b84ff61b7a34">§ </a></span>size()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the current number of items in the map. </p>
</div>
</div>
<a id="a474cb5ceff88a13e2b15f54e675411ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a474cb5ceff88a13e2b15f54e675411ad">§ </a></span>operator[]()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">ValueType <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::operator[] </td>
<td>(</td>
<td class="paramtype">KeyTypeParameter </td>
<td class="paramname"><em>keyToLookFor</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the value corresponding to a given key. </p>
<p>If the map doesn't contain the key, a default instance of the value type is returned. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">keyToLookFor</td><td>the key of the item being requested </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a134779c6595424e65d74c846ef3e8672"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a134779c6595424e65d74c846ef3e8672">§ </a></span>contains()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::contains </td>
<td>(</td>
<td class="paramtype">KeyTypeParameter </td>
<td class="paramname"><em>keyToLookFor</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns true if the map contains an item with the specied key. </p>
</div>
</div>
<a id="ab0d3799b8b807e4de6a8893c44087a03"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0d3799b8b807e4de6a8893c44087a03">§ </a></span>containsValue()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::containsValue </td>
<td>(</td>
<td class="paramtype">ValueTypeParameter </td>
<td class="paramname"><em>valueToLookFor</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns true if the hash contains at least one occurrence of a given value. </p>
</div>
</div>
<a id="a875c55a3b720118cd6687fd6494f7afd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a875c55a3b720118cd6687fd6494f7afd">§ </a></span>set()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::set </td>
<td>(</td>
<td class="paramtype">KeyTypeParameter </td>
<td class="paramname"><em>newKey</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueTypeParameter </td>
<td class="paramname"><em>newValue</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds or replaces an element in the hash-map. </p>
<p>If there's already an item with the given key, this will replace its value. Otherwise, a new item will be added to the map. </p>
<p>Referenced by <a class="el" href="classHashMap.html#aadd0f7eaeacd996eed49440b27d9f308">HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remapTable()</a>.</p>
</div>
</div>
<a id="ac308687ea47efa4d1559ec1b35505ad2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac308687ea47efa4d1559ec1b35505ad2">§ </a></span>remove()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remove </td>
<td>(</td>
<td class="paramtype">KeyTypeParameter </td>
<td class="paramname"><em>keyToRemove</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Removes an item with the given key. </p>
</div>
</div>
<a id="a7c7e68766babe36a8ae07033d3652f2f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7c7e68766babe36a8ae07033d3652f2f">§ </a></span>removeValue()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::removeValue </td>
<td>(</td>
<td class="paramtype">ValueTypeParameter </td>
<td class="paramname"><em>valueToRemove</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Removes all items with the given value. </p>
</div>
</div>
<a id="aadd0f7eaeacd996eed49440b27d9f308"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aadd0f7eaeacd996eed49440b27d9f308">§ </a></span>remapTable()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remapTable </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>newNumberOfSlots</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remaps the hash-map to use a different number of slots for its hash function. </p>
<p>Each slot corresponds to a single hash-code, and each one can contain multiple items. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="classHashMap.html#a28c5938ec533466631b98451c6b78072" title="Returns the number of slots which are available for hashing. ">getNumSlots()</a> </dd></dl>
<p>References <a class="el" href="classHashMap.html#a875c55a3b720118cd6687fd6494f7afd">HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::set()</a>.</p>
</div>
</div>
<a id="a28c5938ec533466631b98451c6b78072"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a28c5938ec533466631b98451c6b78072">§ </a></span>getNumSlots()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::getNumSlots </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of slots which are available for hashing. </p>
<p>Each slot corresponds to a single hash-code, and each one can contain multiple items. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="classHashMap.html#a28c5938ec533466631b98451c6b78072" title="Returns the number of slots which are available for hashing. ">getNumSlots()</a> </dd></dl>
</div>
</div>
<a id="a885345c5f15712041e6e46d38d6e564b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a885345c5f15712041e6e46d38d6e564b">§ </a></span>swapWith()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<div class="memtemplate">
template<class OtherHashMapType > </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::swapWith </td>
<td>(</td>
<td class="paramtype">OtherHashMapType & </td>
<td class="paramname"><em>otherHashMap</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Efficiently swaps the contents of two hash-maps. </p>
</div>
</div>
<a id="a539b127c2f399e4d5f6c235222fb7bf2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a539b127c2f399e4d5f6c235222fb7bf2">§ </a></span>getLock()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename KeyType, typename ValueType, class HashFunctionType = DefaultHashFunctions, class TypeOfCriticalSectionToUse = DummyCriticalSection> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const TypeOfCriticalSectionToUse& <a class="el" href="classHashMap.html">HashMap</a>< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::getLock </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the <a class="el" href="classCriticalSection.html" title="A re-entrant mutex. ">CriticalSection</a> that locks this structure. </p>
<p>To lock, you can call <a class="el" href="classHashMap.html#a539b127c2f399e4d5f6c235222fb7bf2" title="Returns the CriticalSection that locks this structure. ">getLock()</a>.enter() and <a class="el" href="classHashMap.html#a539b127c2f399e4d5f6c235222fb7bf2" title="Returns the CriticalSection that locks this structure. ">getLock()</a>.exit(), or preferably use an object of ScopedLockType as an RAII lock for it. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="juce__HashMap_8h.html">juce_HashMap.h</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/>
<address class="footer"><small>All content © ROLI Ltd.</small></address><br/>
</body>
</html>
|