2 * @file sample_resize_trigger.hpp
3 * Contains a sample resize trigger policy class.
5 * Copyright Ami Tavory, IBM-HRL, 2004.
7 * Permission to use, copy, modify, sell, and distribute this software
8 * is hereby granted without fee, provided that the above copyright notice
9 * appears in all copies, and that both that copyright notice and this
10 * permission notice appear in supporting documentation.
12 * None of the above authors, nor IBM Haifa Research Laboratories, make any
13 * representation about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied warranty.
18 #ifndef SAMPLE_RESIZE_TRIGGER_HPP
19 #define SAMPLE_RESIZE_TRIGGER_HPP
24 * description = "A sample resize trigger policy."
25 * comment = "This class serves to show the interface a trigger policy
28 class sample_resize_trigger
31 *******************************************************************************
32 *******************************************************************************
33 * <public_methods_group>
37 ***************************************************************************
38 ***************************************************************************
39 ** <group description = "Constructors, destructor, and related.">
43 * <fn description = "Default constructor."
44 * comment = "Must be default constructible.">
51 * <fn description = "Copy constructor."
52 * comment = "Must be copy constructible.">
55 (const sample_resize_trigger &r_other);
59 * <fn description = "Swaps content."
60 * comment = "Must be swappable (if there is such a word).">
64 (sample_resize_trigger &r_other);
68 ***************************************************************************
69 ***************************************************************************
75 *******************************************************************************
76 *******************************************************************************
77 * </public_methods_group>
82 *******************************************************************************
83 *******************************************************************************
84 * <protected_methods_group>
88 **************************************************************************
89 ***************************************************************************
90 ** <group description = "Insert search notifications."
91 ** comment = "Notifications called during an insert operation.">
95 * <fn description = "Notifies a search started.">
98 notify_insert_search_start
103 * <fn description = "Notifies a search encountered a collision.">
106 notify_insert_search_collision
111 * <fn description = "Notifies a search ended.">
114 notify_insert_search_end
119 ***************************************************************************
120 ***************************************************************************
126 ***************************************************************************
127 ***************************************************************************
128 ** <group description = "Find search notifications."
129 ** comment = "Notifications called during a find operation.">
133 * <fn description = "Notifies a search started.">
136 notify_find_search_start
141 * <fn description = "Notifies a search encountered a collision.">
144 notify_find_search_collision
149 * <fn description = "Notifies a search ended.">
152 notify_find_search_end
157 ***************************************************************************
158 ***************************************************************************
164 ***************************************************************************
165 ***************************************************************************
166 ** <group description = "Erase search notifications."
167 ** comment = "Notifications called during an insert operation.">
171 * <fn description = "Notifies a search started.">
174 notify_erase_search_start
179 * <fn description = "Notifies a search encountered a collision.">
182 notify_erase_search_collision
187 * <fn description = "Notifies a search ended.">
190 notify_erase_search_end
195 ***************************************************************************
196 ***************************************************************************
202 ***************************************************************************
203 ***************************************************************************
204 ** <group description = "Content change notifications."
205 ** comment = "Notifications called when the content of the table
206 ** changes in a way that can affect the resize policy.">
210 * <fn description = "Notifies an element was inserted.
211 * the total number of entries in the table is num_entries.">
215 (size_type num_entries);
219 * <fn description = "Notifies an element was erased."
220 * the total number of entries in the table is num_entries.">
224 (size_type num_entries);
228 * <fn description = "Notifies the table was cleared.">
236 ***************************************************************************
237 ***************************************************************************
243 ***************************************************************************
244 ***************************************************************************
245 ** <group description = "Size change notifications."
246 ** comment = "Notifications called when the table changes size.">
250 * <fn description = "Notifies the table was resized as a result of
251 * this object's signifying that a resize is needed."
252 * The actual size of the table is new_size.">
256 (size_type new_size);
260 * <fn description = "Notifies the table was resized externally."
261 * The actual size of the table is new_size.">
264 notify_externally_resized
265 (size_type new_size);
269 ***************************************************************************
270 ***************************************************************************
276 ***************************************************************************
277 ***************************************************************************
278 ** <group description = "Queries."
279 ** comment = "Called to query whether/how to resize.">
283 * <fn description = "Queries whether a resize is needed.">
291 * <fn description = "Queries whether a grow is needed."
292 * comment = "This method is
293 * called only if this object indicated resize is needed.
294 * The actual size of the table is size, and the number of
295 * entries in it is num_entries.">
300 size_type num_entries) const;
304 * <fn description = "Queries whether a shrink is needed."
305 * comment = "This method is
306 * called only if this object indicated resize is needed.
307 * The actual size of the table is size, and the number of
308 * entries in it is num_entries.">
313 size_type num_entries) const;
317 ***************************************************************************
318 ***************************************************************************
324 *******************************************************************************
325 *******************************************************************************
326 * </protected_methods_group>
335 ****************************************************************************
336 ****************************************************************************
338 } // namespace pb_assoc
341 #endif // #ifndef SAMPLE_RESIZE_TRIGGER_HPP