2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
7 <title>hash_load_check_resize_trigger Interface
14 <tt>hash_load_check_resize_trigger
22 <p>A resize trigger policy based on a load check. It keeps the load factor between some load factors load_min and load_max.
27 <a href = "../../../../include/ext/pb_assoc/hash_policy.hpp"><tt>hash_policy.hpp</tt>
33 <a href = "#link1">Template parameters.
39 Public Types and Constants:
44 <a href = "#link2">General definitions.
59 <a href = "#link3">Constructors, destructor, and related.
65 <a href = "#link4">Load access methods.
80 <a href = "#link5">Insert search notifications.
86 <a href = "#link6">Find search notifications.
92 <a href = "#link7">Erase search notifications.
98 <a href = "#link8">Content change notifications.
104 <a href = "#link9">Size change notifications.
110 <a href = "#link10">Queries.
123 <a name = "link1">Template parameters.
128 <table WIDTH = "100%" BORDER = "1">
129 <TR><TD Width = "20%" ALIGN = "left"><b>Parameter</b></TD><TD Width = "50%" ALIGN = "left"><b>Description</b></TD><TD Width = "30%" ALIGN = "left"><b>Default Value</b></TD></TR>
134 <pre><a name = "External_Load_Access3735929540">External_Load_Access</a></pre>
140 <p>Specifies whether the load factor can be accessed externally. The two options have different tradeoffs in terms of flexibility, genericity, and encapsulation.</p>
146 <tt><b>false</b></tt>
155 <pre><a name = "Size_Type3735929483">Size_Type</a></pre>
177 <a name = "link2">General definitions.
182 <table WIDTH = "100%" BORDER = "1">
183 <TR><TD Width = "30%" ALIGN = "left"><b>Type</b></TD><TD Width = "55%" ALIGN = "left"><b>Definition</b></TD><TD Width = "15%" ALIGN = "left"><b>Description</b></TD></TR>
188 <pre><a name = "size_type3735929547">size_type</a></pre>
194 <pre><a href = "#Size_Type3735929483">Size_Type</a></pre>
209 <pre><a name = "external_load_access3735929604">external_load_access</a></pre>
215 <pre><a href = "#External_Load_Access3735929540">External_Load_Access</a></pre>
221 <p>Indicates whether loads can be accessed externally</p>
231 <a name = "link3">Constructors, destructor, and related.
236 <table WIDTH = "100%" BORDER = "1">
237 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
242 <pre> hash_load_check_resize_trigger
243 (float load_min = 0.125,
244 float load_max = 0.5)</pre>
250 <p>Default constructor, or constructor taking <font color = "#666666"><tt>load_min</tt></font> and <font color = "#666666"><tt>load_max</tt></font> load factors between which this policy will keep the actual load.</p>
253 <p>It is the responsibility of the user to ensure that <font color = "#666666"><tt>load_min</tt></font> is smaller than <font color = "#666666"><tt>load_max</tt></font>.</p>
264 (<font color = "olive">hash_load_check_resize_trigger</font> &r_other)</pre>
270 <p>Swaps content.</p>
280 ~hash_load_check_resize_trigger
297 <a name = "link4">Load access methods.
302 <p> These methods are only available if the external access parameter is set.</p>
305 <table WIDTH = "100%" BORDER = "1">
306 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
311 <pre><b>inline</b> std::pair<float, float>
313 () <b>const</b></pre>
319 <p>Returns a pair of the minimal and maximal loads, respectively.</p>
322 <p>Calling this method will not compile when <a href = "#External_Load_Access3735929540"><tt>External_Load_Access</tt></a> == <tt><b>false</b></tt>.</p>
333 (std::pair<float, float> load_pair)</pre>
339 <p>Sets the loads through a pair of the minimal and maximal loads, respectively.</p>
342 <p>Calling this method resizes the container, and might throw an exception. It is the responsibility of the user to pass appropriate loads to this function. Calling this method will not compile when <a href = "#External_Load_Access3735929540"><tt>External_Load_Access</tt></a> == <tt><b>false</b></tt>.</p>
352 <a name = "link5">Insert search notifications.
357 <p>Notifications called during an insert operation.</p>
360 <table WIDTH = "100%" BORDER = "1">
361 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
366 <pre><b>inline</b> <b>void</b>
367 notify_insert_search_start
374 <p>Notifies a search started.</p>
383 <pre><b>inline</b> <b>void</b>
384 notify_insert_search_collision
391 <p>Notifies a search encountered a collision.</p>
400 <pre><b>inline</b> <b>void</b>
401 notify_insert_search_end
408 <p>Notifies a search ended.</p>
418 <a name = "link6">Find search notifications.
423 <p>Notifications called during a find operation.</p>
426 <table WIDTH = "100%" BORDER = "1">
427 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
432 <pre><b>inline</b> <b>void</b>
433 notify_find_search_start
440 <p>Notifies a search started.</p>
449 <pre><b>inline</b> <b>void</b>
450 notify_find_search_collision
457 <p>Notifies a search encountered a collision.</p>
466 <pre><b>inline</b> <b>void</b>
467 notify_find_search_end
474 <p>Notifies a search ended.</p>
484 <a name = "link7">Erase search notifications.
489 <p>Notifications called during an insert operation.</p>
492 <table WIDTH = "100%" BORDER = "1">
493 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
498 <pre><b>inline</b> <b>void</b>
499 notify_erase_search_start
506 <p>Notifies a search started.</p>
515 <pre><b>inline</b> <b>void</b>
516 notify_erase_search_collision
523 <p>Notifies a search encountered a collision.</p>
532 <pre><b>inline</b> <b>void</b>
533 notify_erase_search_end
540 <p>Notifies a search ended.</p>
550 <a name = "link8">Content change notifications.
555 <p>Notifications called when the content of the table changes in a way that can affect the resize policy.</p>
558 <table WIDTH = "100%" BORDER = "1">
559 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
564 <pre><b>inline</b> <b>void</b>
566 (<a href = "#size_type3735929547">size_type</a> num_entries)</pre>
572 <p>Notifies an element was inserted. the total number of entries in the table is <font color = "#666666"><tt>num_entries</tt></font>.</p>
581 <pre><b>inline</b> <b>void</b>
583 (<a href = "#size_type3735929547">size_type</a> num_entries)</pre>
589 <p>Notifies an element was erased.</p>
606 <p>Notifies the table was cleared.</p>
616 <a name = "link9">Size change notifications.
621 <p>Notifications called when the table changes size.</p>
624 <table WIDTH = "100%" BORDER = "1">
625 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
632 (<a href = "#size_type3735929547">size_type</a> new_size)</pre>
638 <p>Notifies the table was resized as a result of this object's signifying that a resize is needed.</p>
648 notify_externally_resized
649 (<a href = "#size_type3735929547">size_type</a> new_size)</pre>
655 <p>Notifies the table was resized externally.</p>
665 <a name = "link10">Queries.
670 <p>Called to query whether/how to resize.</p>
673 <table WIDTH = "100%" BORDER = "1">
674 <TR><TD Width = "45%" ALIGN = "left"><b>Method</b></TD><TD Width = "55%" ALIGN = "left"><b>Description</b></TD></TR>
679 <pre><b>inline</b> <b>bool</b>
681 () <b>const</b></pre>
687 <p>Queries whether a resize is needed.</p>
696 <pre><b>inline</b> <b>bool</b>
698 (<a href = "#size_type3735929547">size_type</a> size,
699 <a href = "#size_type3735929547">size_type</a> num_entries) <b>const</b></pre>
705 <p>Queries whether a grow is needed.</p>
708 <p>This method is called only if this object indicated resize is needed. The actual <font color = "#666666"><tt>size</tt></font> of the table is <font color = "#666666"><tt>size</tt></font>, and the number of entries in it is <font color = "#666666"><tt>num_entries</tt></font>.</p>
717 <pre><b>inline</b> <b>bool</b>
719 (<a href = "#size_type3735929547">size_type</a> size,
720 <a href = "#size_type3735929547">size_type</a> num_entries) <b>const</b></pre>
726 <p>Queries whether a shrink is needed.</p>
729 <p>This method is called only if this object indicated resize is needed. The actual <font color = "#666666"><tt>size</tt></font> of the table is <font color = "#666666"><tt>size</tt></font>, and the number of entries in it is <font color = "#666666"><tt>num_entries</tt></font>.</p>