2 * @file sample_resize_policy.hpp
\r
3 * Contains a sample resize policy for hash tables.
\r
5 * Copyright Ami Tavory, IBM-HRL, 2004.
\r
7 * Permission to use, copy, modify, sell, and distribute this software
\r
8 * is hereby granted without fee, provided that the above copyright notice
\r
9 * appears in all copies, and that both that copyright notice and this
\r
10 * permission notice appear in supporting documentation,
\r
12 * None of the above authors, nor IBM Haifa Research Laboratories, make any
\r
13 * representation about the suitability of this software for any
\r
14 * purpose. It is provided "as is" without express or implied warranty.
\r
18 #ifndef SAMPLE_RESIZE_POLICY_HPP
\r
19 #define SAMPLE_RESIZE_POLICY_HPP
\r
24 * description = "A sample resize policy."
\r
25 * comment = "This class serves to show the interface a resize policy
\r
26 * needs to support.">
\r
28 class sample_resize_policy
\r
31 *******************************************************************************
\r
32 *******************************************************************************
\r
33 * <public_methods_group>
\r
37 ***************************************************************************
\r
38 ***************************************************************************
\r
39 ** <group description = "Constructors, destructor, and related.">
\r
43 * <fn description = "Default constructor."
\r
44 * comment = "Must be default constructible.">
\r
46 sample_resize_policy
\r
51 * <fn description = "Copy constructor."
\r
52 * comment = "Must be copy constructible.">
\r
54 sample_range_hashing
\r
55 (const sample_resize_policy &r_other);
\r
59 * <fn description = "Swaps content."
\r
60 * comment = "Must be swappable (if there is such a word).">
\r
64 (sample_resize_policy &r_other);
\r
68 ***************************************************************************
\r
69 ***************************************************************************
\r
75 *******************************************************************************
\r
76 *******************************************************************************
\r
77 * </public_methods_group>
\r
82 *******************************************************************************
\r
83 *******************************************************************************
\r
84 * <protected_methods_group>
\r
88 ***************************************************************************
\r
89 ***************************************************************************
\r
90 ** <group description = "Insert search notifications."
\r
91 ** comment = "Notifications called during an insert operation.">
\r
95 * <fn description = "Notifies a search started.">
\r
98 notify_insert_search_start
\r
103 * <fn description = "Notifies a search encountered a collision.">
\r
106 notify_insert_search_collision
\r
111 * <fn description = "Notifies a search ended.">
\r
114 notify_insert_search_end
\r
119 ***************************************************************************
\r
120 ***************************************************************************
\r
126 ***************************************************************************
\r
127 ***************************************************************************
\r
128 ** <group description = "Find search notifications."
\r
129 ** comment = "Notifications called during a find operation.">
\r
133 * <fn description = "Notifies a search started.">
\r
136 notify_find_search_start
\r
141 * <fn description = "Notifies a search encountered a collision.">
\r
144 notify_find_search_collision
\r
149 * <fn description = "Notifies a search ended.">
\r
152 notify_find_search_end
\r
157 ***************************************************************************
\r
158 ***************************************************************************
\r
164 ***************************************************************************
\r
165 ***************************************************************************
\r
166 ** <group description = "Erase search notifications."
\r
167 ** comment = "Notifications called during an insert operation.">
\r
171 * <fn description = "Notifies a search started.">
\r
174 notify_erase_search_start
\r
179 * <fn description = "Notifies a search encountered a collision.">
\r
182 notify_erase_search_collision
\r
187 * <fn description = "Notifies a search ended.">
\r
190 notify_erase_search_end
\r
195 ***************************************************************************
\r
196 ***************************************************************************
\r
202 ***************************************************************************
\r
203 ***************************************************************************
\r
204 ** <group description = "Content change notifications."
\r
205 ** comment = "Notifications called when the content of the table
\r
206 ** changes in a way that can affect the resize policy.">
\r
210 * <fn description = "Notifies an element was inserted.">
\r
218 * <fn description = "Notifies an element was erased.">
\r
226 * <fn description = "Notifies the table was cleared.">
\r
234 ***************************************************************************
\r
235 ***************************************************************************
\r
241 ***************************************************************************
\r
242 ***************************************************************************
\r
243 ** <group description = "Size change notifications."
\r
244 ** comment = "Notifications called when the table changes size.">
\r
248 * <fn description = "Notifies the table was resized to new_size.">
\r
252 (size_type new_size);
\r
256 ***************************************************************************
\r
257 ***************************************************************************
\r
263 ***************************************************************************
\r
264 ***************************************************************************
\r
265 ** <group description = "Queries."
\r
266 ** comment = "Called to query whether/how to resize.">
\r
270 * <fn description = "Queries initial size.">
\r
278 * <fn description = "Queries whether a resize is needed.">
\r
286 * <fn description = "Queries what the new size should be.">
\r
290 (size_type size, size_type num_used_e) const;
\r
294 ***************************************************************************
\r
295 ***************************************************************************
\r
300 *******************************************************************************
\r
301 *******************************************************************************
\r
302 * </protected_methods_group>
\r
310 #endif // #ifndef SAMPLE_RESIZE_POLICY_HPP
\r