2 * @file sample_resize_trigger.hpp
\r
3 * Contains a sample resize trigger policy class.
\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_TRIGGER_HPP
\r
19 #define SAMPLE_RESIZE_TRIGGER_HPP
\r
24 * description = "A sample resize trigger policy."
\r
25 * comment = "This class serves to show the interface a trigger policy
\r
26 * needs to support.">
\r
28 class sample_resize_trigger
\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_trigger
\r
51 * <fn description = "Copy constructor."
\r
52 * comment = "Must be copy constructible.">
\r
54 sample_range_hashing
\r
55 (const sample_resize_trigger &r_other);
\r
59 * <fn description = "Swaps content."
\r
60 * comment = "Must be swappable (if there is such a word).">
\r
64 (sample_resize_trigger &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
211 * the total number of entries in the table is num_entries.">
\r
215 (size_type num_entries);
\r
219 * <fn description = "Notifies an element was erased."
\r
220 * the total number of entries in the table is num_entries.">
\r
224 (size_type num_entries);
\r
228 * <fn description = "Notifies the table was cleared.">
\r
236 ***************************************************************************
\r
237 ***************************************************************************
\r
243 ***************************************************************************
\r
244 ***************************************************************************
\r
245 ** <group description = "Size change notifications."
\r
246 ** comment = "Notifications called when the table changes size.">
\r
250 * <fn description = "Notifies the table was resized as a result of
\r
251 * this object's signifying that a resize is needed."
\r
252 * The actual size of the table is new_size.">
\r
256 (size_type new_size);
\r
260 * <fn description = "Notifies the table was resized externally."
\r
261 * The actual size of the table is new_size.">
\r
264 notify_externally_resized
\r
265 (size_type new_size);
\r
269 ***************************************************************************
\r
270 ***************************************************************************
\r
276 ***************************************************************************
\r
277 ***************************************************************************
\r
278 ** <group description = "Queries."
\r
279 ** comment = "Called to query whether/how to resize.">
\r
283 * <fn description = "Queries whether a resize is needed.">
\r
291 * <fn description = "Queries whether a grow is needed."
\r
292 * comment = "This method is
\r
293 * called only if this object indicated resize is needed.
\r
294 * The actual size of the table is size, and the number of
\r
295 * entries in it is num_entries.">
\r
300 size_type num_entries) const;
\r
304 * <fn description = "Queries whether a shrink is needed."
\r
305 * comment = "This method is
\r
306 * called only if this object indicated resize is needed.
\r
307 * The actual size of the table is size, and the number of
\r
308 * entries in it is num_entries.">
\r
313 size_type num_entries) const;
\r
317 ***************************************************************************
\r
318 ***************************************************************************
\r
324 *******************************************************************************
\r
325 *******************************************************************************
\r
326 * </protected_methods_group>
\r
335 ****************************************************************************
\r
336 ****************************************************************************
\r
338 } // namespace pb_assoc
\r
341 #endif // #ifndef SAMPLE_RESIZE_TRIGGER_HPP
\r