OSDN Git Service

2008-01-18 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / doc / html / ext / pb_ds / hash_load_check_resize_trigger.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6   <meta name="generator" content=
7   "HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" />
8
9   <title>hash_load_check_resize_trigger Interface</title>
10   <meta http-equiv="Content-Type" content=
11   "text/html; charset=us-ascii" />
12   </head>
13
14 <body>
15   <div id="page">
16     <h1><tt>hash_load_check_resize_trigger</tt> Interface</h1>
17
18     <p>A resize trigger policy based on a load check. It keeps the
19     load factor between some load factors load_min and
20     load_max.</p>
21
22     <p>Defined in: <a href=
23     "../../../../include/ext/pb_ds/hash_policy.hpp"><tt>hash_policy.hpp</tt></a></p>
24
25     <h2><a name="link1" id="link1">Template Parameters</a></h2>
26
27     <table class="c1" width="100%" border="1" summary=
28     "Template Parameters">
29       <tr>
30         <td width="20%" align="left"><b>Parameter</b></td>
31
32         <td width="50%" align="left"><b>Description</b></td>
33
34         <td width="30%" align="left"><b>Default Value</b></td>
35       </tr>
36
37       <tr>
38         <td>
39           <pre>
40 <a name="External_Load_Access1313998607" id=
41 "External_Load_Access1313998607"><b>bool</b> External_Load_Access </a>
42 </pre>
43         </td>
44
45         <td>
46           <p>Specifies whether the load factor can be accessed
47           externally. The two options have different trade-offs in
48           terms of flexibility, genericity, and encapsulation.</p>
49         </td>
50
51         <td><tt><b>false</b></tt></td>
52       </tr>
53
54       <tr>
55         <td>
56           <pre>
57 <a name="Size_Type42920436" id=
58 "Size_Type42920436"><b>typename</b> Size_Type </a>
59 </pre>
60         </td>
61
62         <td>
63           <p>Size type.</p>
64         </td>
65
66         <td>size_t</td>
67       </tr>
68     </table>
69
70     <h2><a name="link2" id="link2">Public Types and
71     Constants</a></h2>
72
73     <h3><a name="link3" id="link3">General Definitions</a></h3>
74
75     <table class="c1" width="100%" border="1" summary="Types">
76       <tr>
77         <td width="30%" align="left"><b>Type</b></td>
78
79         <td width="55%" align="left"><b>Definition</b></td>
80
81         <td width="15%" align="left"><b>Description</b></td>
82       </tr>
83
84       <tr>
85         <td>
86           <pre>
87 <a name="size_type55424436" id="size_type55424436">size_type</a>
88 </pre>
89         </td>
90
91         <td>
92           <pre>
93 <a href="#Size_Type42920436"><tt>Size_Type</tt></a>
94 </pre>
95         </td>
96
97         <td>
98           <p>Size type.</p>
99         </td>
100       </tr>
101
102       <tr>
103         <td>
104           <pre>
105 <a name="external_load_access3976598639" id=
106 "external_load_access3976598639">external_load_access</a>
107 </pre>
108         </td>
109
110         <td>
111           <pre>
112 <a href=
113 "#External_Load_Access1313998607"><tt>External_Load_Access</tt></a>
114 </pre>
115         </td>
116
117         <td>
118           <p>Indicates whether loads can be accessed externally</p>
119         </td>
120       </tr>
121     </table>
122
123     <h2><a name="link4" id="link4">Public Methods</a></h2>
124
125     <h3><a name="link5" id="link5">Constructors, Destructor, and
126     Related</a></h3>
127
128     <table class="c1" width="100%" border="1" summary="Methods">
129       <tr>
130         <td width="45%" align="left"><b>Method</b></td>
131
132         <td width="55%" align="left"><b>Description</b></td>
133       </tr>
134
135       <tr>
136         <td>
137           <pre>
138   hash_load_check_resize_trigger
139   (float load_min = 0.125, 
140     float load_max = 0.5)
141 </pre>
142         </td>
143
144         <td>
145           <p>Default constructor, or constructor taking
146           <span class="c1"><tt>load_min</tt></span> and
147           <span class="c1"><tt>load_max</tt></span> load factors
148           between which this policy will keep the actual load.</p>
149
150           <p>It is the responsibility of the user to ensure that
151           <span class="c1"><tt>load_min</tt></span> is smaller than
152           <span class="c1"><tt>load_max</tt></span>.</p>
153         </td>
154       </tr>
155
156       <tr>
157         <td>
158           <pre>
159 <b>void</b>
160   swap
161   (<span class=
162 "c2"><tt>hash_load_check_resize_trigger</tt></span> &amp;other)
163 </pre>
164         </td>
165
166         <td>
167           <p>Swaps content.</p>
168         </td>
169       </tr>
170
171       <tr>
172         <td>
173           <pre>
174   <b>virtual</b>
175     ~hash_load_check_resize_trigger
176     ()
177 </pre>
178         </td>
179
180         <td>
181           <p>Destructor.</p>
182         </td>
183       </tr>
184     </table>
185
186     <h3><a name="link6" id="link6">Load Access Methods</a></h3>
187
188     <p>These methods are only available if the external access
189     parameter is set.</p>
190
191     <table class="c1" width="100%" border="1" summary="Methods">
192       <tr>
193         <td width="45%" align="left"><b>Method</b></td>
194
195         <td width="55%" align="left"><b>Description</b></td>
196       </tr>
197
198       <tr>
199         <td>
200           <pre>
201 <b>inline</b> std::pair&lt;float, float&gt;
202   get_loads
203   () <b>const</b>
204 </pre>
205         </td>
206
207         <td>
208           <p>Returns a pair of the minimal and maximal loads,
209           respectively.</p>
210
211           <p>Calling this method will not compile when <a href=
212           "#External_Load_Access1313998607"><tt>External_Load_Access</tt></a>
213           == <tt><b>false</b></tt>.</p>
214         </td>
215       </tr>
216
217       <tr>
218         <td>
219           <pre>
220 <b>void</b> 
221   set_loads
222   (std::pair&lt;float, float&gt; load_pair)
223 </pre>
224         </td>
225
226         <td>
227           <p>Sets the loads through a pair of the minimal and
228           maximal loads, respectively.</p>
229
230           <p>Calling this method resizes the container, and might
231           throw an exception. It is the responsibility of the user
232           to pass appropriate loads to this function. Calling this
233           method will not compile when <a href=
234           "#External_Load_Access1313998607"><tt>External_Load_Access</tt></a>
235           == <tt><b>false</b></tt>.</p>
236         </td>
237       </tr>
238     </table>
239
240     <h2><a name="link7" id="link7">Protected Methods</a></h2>
241
242     <h3><a name="link8" id="link8">Insert Search
243     Notifications.</a></h3>
244
245     <p>Notifications called during an insert operation.</p>
246
247     <table class="c1" width="100%" border="1" summary="Methods">
248       <tr>
249         <td width="45%" align="left"><b>Method</b></td>
250
251         <td width="55%" align="left"><b>Description</b></td>
252       </tr>
253
254       <tr>
255         <td>
256           <pre>
257 <b>inline</b> <b>void</b>
258   notify_insert_search_start
259   ()
260 </pre>
261         </td>
262
263         <td>
264           <p>Notifies a search started.</p>
265         </td>
266       </tr>
267
268       <tr>
269         <td>
270           <pre>
271 <b>inline</b> <b>void</b>
272   notify_insert_search_collision
273   ()
274 </pre>
275         </td>
276
277         <td>
278           <p>Notifies a search encountered a collision.</p>
279         </td>
280       </tr>
281
282       <tr>
283         <td>
284           <pre>
285 <b>inline</b> <b>void</b>
286   notify_insert_search_end
287   ()
288 </pre>
289         </td>
290
291         <td>
292           <p>Notifies a search ended.</p>
293         </td>
294       </tr>
295     </table>
296
297     <h3><a name="link9" id="link9">Find Search
298     Notifications.</a></h3>
299
300     <p>Notifications called during a find operation.</p>
301
302     <table class="c1" width="100%" border="1" summary="Methods">
303       <tr>
304         <td width="45%" align="left"><b>Method</b></td>
305
306         <td width="55%" align="left"><b>Description</b></td>
307       </tr>
308
309       <tr>
310         <td>
311           <pre>
312 <b>inline</b> <b>void</b>
313   notify_find_search_start
314   ()
315 </pre>
316         </td>
317
318         <td>
319           <p>Notifies a search started.</p>
320         </td>
321       </tr>
322
323       <tr>
324         <td>
325           <pre>
326 <b>inline</b> <b>void</b>
327   notify_find_search_collision
328   ()
329 </pre>
330         </td>
331
332         <td>
333           <p>Notifies a search encountered a collision.</p>
334         </td>
335       </tr>
336
337       <tr>
338         <td>
339           <pre>
340 <b>inline</b> <b>void</b>
341   notify_find_search_end
342   ()
343 </pre>
344         </td>
345
346         <td>
347           <p>Notifies a search ended.</p>
348         </td>
349       </tr>
350     </table>
351
352     <h3><a name="link10" id="link10">Erase Search
353     Notifications.</a></h3>
354
355     <p>Notifications called during an insert operation.</p>
356
357     <table class="c1" width="100%" border="1" summary="Methods">
358       <tr>
359         <td width="45%" align="left"><b>Method</b></td>
360
361         <td width="55%" align="left"><b>Description</b></td>
362       </tr>
363
364       <tr>
365         <td>
366           <pre>
367 <b>inline</b> <b>void</b>
368   notify_erase_search_start
369   ()
370 </pre>
371         </td>
372
373         <td>
374           <p>Notifies a search started.</p>
375         </td>
376       </tr>
377
378       <tr>
379         <td>
380           <pre>
381 <b>inline</b> <b>void</b>
382   notify_erase_search_collision
383   ()
384 </pre>
385         </td>
386
387         <td>
388           <p>Notifies a search encountered a collision.</p>
389         </td>
390       </tr>
391
392       <tr>
393         <td>
394           <pre>
395 <b>inline</b> <b>void</b>
396   notify_erase_search_end
397   ()
398 </pre>
399         </td>
400
401         <td>
402           <p>Notifies a search ended.</p>
403         </td>
404       </tr>
405     </table>
406
407     <h3><a name="link11" id="link11">Content Change
408     Notifications.</a></h3>
409
410     <p>Notifications called when the content of the table changes
411     in a way that can affect the resize policy.</p>
412
413     <table class="c1" width="100%" border="1" summary="Methods">
414       <tr>
415         <td width="45%" align="left"><b>Method</b></td>
416
417         <td width="55%" align="left"><b>Description</b></td>
418       </tr>
419
420       <tr>
421         <td>
422           <pre>
423 <b>inline</b> <b>void</b>
424   notify_inserted
425   (<a href="#size_type55424436"><tt>size_type</tt></a> num_entries)
426 </pre>
427         </td>
428
429         <td>
430           <p>Notifies an element was inserted. the total number of
431           entries in the table is <span class=
432           "c1"><tt>num_entries</tt></span>.</p>
433         </td>
434       </tr>
435
436       <tr>
437         <td>
438           <pre>
439 <b>inline</b> <b>void</b>
440   notify_erased
441   (<a href="#size_type55424436"><tt>size_type</tt></a> num_entries)
442 </pre>
443         </td>
444
445         <td>
446           <p>Notifies an element was erased.</p>
447         </td>
448       </tr>
449
450       <tr>
451         <td>
452           <pre>
453 <b>void</b> 
454   notify_cleared
455   ()
456 </pre>
457         </td>
458
459         <td>
460           <p>Notifies the table was cleared.</p>
461         </td>
462       </tr>
463     </table>
464
465     <h3><a name="link12" id="link12">Size Change
466     Notifications.</a></h3>
467
468     <p>Notifications called when the table changes size.</p>
469
470     <table class="c1" width="100%" border="1" summary="Methods">
471       <tr>
472         <td width="45%" align="left"><b>Method</b></td>
473
474         <td width="55%" align="left"><b>Description</b></td>
475       </tr>
476
477       <tr>
478         <td>
479           <pre>
480 <b>void</b>
481   notify_resized
482   (<a href="#size_type55424436"><tt>size_type</tt></a> new_size)
483 </pre>
484         </td>
485
486         <td>
487           <p>Notifies the table was resized as a result of this
488           object's signifying that a resize is needed.</p>
489         </td>
490       </tr>
491
492       <tr>
493         <td>
494           <pre>
495 <b>void</b>
496   notify_externally_resized
497   (<a href="#size_type55424436"><tt>size_type</tt></a> new_size)
498 </pre>
499         </td>
500
501         <td>
502           <p>Notifies the table was resized externally.</p>
503         </td>
504       </tr>
505     </table>
506
507     <h3><a name="link13" id="link13">Queries</a></h3>
508
509     <p>Called to query whether/how to resize.</p>
510
511     <table class="c1" width="100%" border="1" summary="Methods">
512       <tr>
513         <td width="45%" align="left"><b>Method</b></td>
514
515         <td width="55%" align="left"><b>Description</b></td>
516       </tr>
517
518       <tr>
519         <td>
520           <pre>
521 <b>inline</b> <b>bool</b> 
522   is_resize_needed
523   () <b>const</b>
524 </pre>
525         </td>
526
527         <td>
528           <p>Queries whether a resize is needed.</p>
529         </td>
530       </tr>
531
532       <tr>
533         <td>
534           <pre>
535 <b>inline</b> <b>bool</b>
536   is_grow_needed
537   (<a href="#size_type55424436"><tt>size_type</tt></a> size, 
538     <a href=
539 "#size_type55424436"><tt>size_type</tt></a> num_entries) <b>const</b>
540 </pre>
541         </td>
542
543         <td>
544           <p>Queries whether a grow is needed.</p>
545
546           <p>This method is called only if this object indicated
547           resize is needed. The actual <span class=
548           "c1"><tt>size</tt></span> of the table is <span class=
549           "c1"><tt>size</tt></span>, and the number of entries in
550           it is <span class="c1"><tt>num_entries</tt></span>.</p>
551         </td>
552       </tr>
553     </table>
554
555     <h2><a name="link14" id="link14">Private Methods</a></h2>
556
557     <h3><a name="link15" id="link15">Overrides</a></h3>
558
559     <table class="c1" width="100%" border="1" summary="Methods">
560       <tr>
561         <td width="45%" align="left"><b>Method</b></td>
562
563         <td width="55%" align="left"><b>Description</b></td>
564       </tr>
565
566       <tr>
567         <td>
568           <pre>
569 <b>virtual</b> <b>void</b>
570   do_resize
571   (<a href="#size_type55424436"><tt>size_type</tt></a> new_size)
572 </pre>
573         </td>
574
575         <td>
576           <p>Resizes to <span class=
577           "c1"><tt>new_size</tt></span>.</p>
578         </td>
579       </tr>
580     </table>
581   </div>
582 </body>
583 </html>