]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libstdc++-v3/contrib/libstdc++-v3-4.1.0/docs/html/ext/pb_assoc/sample_resize_policy.hpp
update
[l4.git] / l4 / pkg / libstdc++-v3 / contrib / libstdc++-v3-4.1.0 / docs / html / ext / pb_assoc / sample_resize_policy.hpp
1 /** \r
2 * @file sample_resize_policy.hpp\r
3 * Contains a sample resize policy for hash tables.\r
4\r
5 * Copyright Ami Tavory, IBM-HRL, 2004.\r
6\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
11 *\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
15 **/\r
16 \r
17 \r
18 #ifndef SAMPLE_RESIZE_POLICY_HPP\r
19 #define SAMPLE_RESIZE_POLICY_HPP\r
20 \r
21 \r
22 /**\r
23 * <class \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
27 **/\r
28 class sample_resize_policy\r
29 {\r
30 /**\r
31 *******************************************************************************\r
32 *******************************************************************************\r
33 * <public_methods_group>\r
34 **/\r
35 public:\r
36         /**\r
37         ***************************************************************************\r
38         ***************************************************************************\r
39         ** <group description = "Constructors, destructor, and related.">\r
40         **/\r
41 \r
42         /*\r
43         * <fn description = "Default constructor."\r
44         *       comment = "Must be default constructible.">\r
45         **/\r
46                 sample_resize_policy\r
47                 ();\r
48         /** </fn> **/\r
49 \r
50         /*\r
51         * <fn description = "Copy constructor."\r
52         *       comment = "Must be copy constructible.">\r
53         **/\r
54                 sample_range_hashing\r
55                 (const sample_resize_policy &r_other);\r
56         /** </fn> **/\r
57 \r
58         /*\r
59         * <fn description = "Swaps content."\r
60         *       comment = "Must be swappable (if there is such a word).">\r
61         **/\r
62         inline void\r
63                 swap\r
64                 (sample_resize_policy &r_other);\r
65         /** </fn> **/\r
66 \r
67         /*\r
68         ***************************************************************************\r
69         ***************************************************************************\r
70         * </group>\r
71         **/\r
72 \r
73 \r
74 /**\r
75 *******************************************************************************\r
76 *******************************************************************************\r
77 * </public_methods_group>\r
78 **/\r
79 \r
80 \r
81 /**\r
82 *******************************************************************************\r
83 *******************************************************************************\r
84 * <protected_methods_group>\r
85 **/\r
86 protected:\r
87         /**\r
88         ***************************************************************************\r
89         ***************************************************************************\r
90         ** <group description = "Insert search notifications."\r
91         **  comment = "Notifications called during an insert operation.">\r
92         **/\r
93 \r
94         /*\r
95         * <fn description = "Notifies a search started.">\r
96         **/\r
97         inline void\r
98                 notify_insert_search_start\r
99                 ();\r
100         /** </fn> **/\r
101 \r
102         /*\r
103         * <fn description = "Notifies a search encountered a collision.">\r
104         **/\r
105         inline void\r
106                 notify_insert_search_collision\r
107                 ();\r
108         /** </fn> **/\r
109 \r
110         /*\r
111         * <fn description = "Notifies a search ended.">\r
112         **/\r
113         inline void\r
114                 notify_insert_search_end\r
115                 ();\r
116         /** </fn> **/\r
117 \r
118         /*\r
119         ***************************************************************************\r
120         ***************************************************************************\r
121         * </group>\r
122         **/\r
123 \r
124 \r
125         /**\r
126         ***************************************************************************\r
127         ***************************************************************************\r
128         ** <group description = "Find search notifications."\r
129         **  comment = "Notifications called during a find operation.">\r
130         **/\r
131 \r
132         /*\r
133         * <fn description = "Notifies a search started.">\r
134         **/\r
135         inline void\r
136                 notify_find_search_start\r
137                 ();\r
138         /** </fn> **/\r
139 \r
140         /*\r
141         * <fn description = "Notifies a search encountered a collision.">\r
142         **/\r
143         inline void\r
144                 notify_find_search_collision\r
145                 ();\r
146         /** </fn> **/\r
147 \r
148         /*\r
149         * <fn description = "Notifies a search ended.">\r
150         **/\r
151         inline void\r
152                 notify_find_search_end\r
153                 ();\r
154         /** </fn> **/\r
155 \r
156         /*\r
157         ***************************************************************************\r
158         ***************************************************************************\r
159         * </group>\r
160         **/\r
161 \r
162 \r
163         /**\r
164         ***************************************************************************\r
165         ***************************************************************************\r
166         ** <group description = "Erase search notifications."\r
167         **  comment = "Notifications called during an insert operation.">\r
168         **/\r
169 \r
170         /*\r
171         * <fn description = "Notifies a search started.">\r
172         **/\r
173         inline void\r
174                 notify_erase_search_start\r
175                 ();\r
176         /** </fn> **/\r
177 \r
178         /*\r
179         * <fn description = "Notifies a search encountered a collision.">\r
180         **/\r
181         inline void\r
182                 notify_erase_search_collision\r
183                 ();\r
184         /** </fn> **/\r
185 \r
186         /*\r
187         * <fn description = "Notifies a search ended.">\r
188         **/\r
189         inline void\r
190                 notify_erase_search_end\r
191                 ();\r
192         /** </fn> **/\r
193 \r
194         /*\r
195         ***************************************************************************\r
196         ***************************************************************************\r
197         * </group>\r
198         **/\r
199 \r
200 \r
201         /**\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
207         **/\r
208 \r
209         /*\r
210         * <fn description = "Notifies an element was inserted.">\r
211         **/\r
212         inline void\r
213                 notify_inserted\r
214                 (size_type num_e);\r
215         /** </fn> **/\r
216 \r
217         /*\r
218         * <fn description = "Notifies an element was erased.">\r
219         **/\r
220         inline void\r
221                 notify_erased\r
222                 (size_type num_e);\r
223         /** </fn> **/\r
224 \r
225         /*\r
226         * <fn description = "Notifies the table was cleared.">\r
227         **/\r
228         void \r
229                 notify_cleared\r
230                 ();\r
231         /** </fn> **/\r
232 \r
233         /*\r
234         ***************************************************************************\r
235         ***************************************************************************\r
236         * </group>\r
237         **/\r
238 \r
239 \r
240         /**\r
241         ***************************************************************************\r
242         ***************************************************************************\r
243         ** <group description = "Size change notifications."\r
244         **  comment = "Notifications called when the table changes size.">\r
245         **/\r
246 \r
247         /*\r
248         * <fn description = "Notifies the table was resized to new_size.">\r
249         **/\r
250         void\r
251                 notify_resized\r
252                 (size_type new_size);\r
253         /** </fn> **/\r
254 \r
255         /*\r
256         ***************************************************************************\r
257         ***************************************************************************\r
258         * </group>\r
259         **/\r
260 \r
261 \r
262         /**\r
263         ***************************************************************************\r
264         ***************************************************************************\r
265         ** <group description = "Queries."\r
266         **  comment = "Called to query whether/how to resize.">\r
267         **/\r
268 \r
269         /*\r
270         * <fn description = "Queries initial size.">\r
271         **/\r
272         size_type\r
273                 get_init_size\r
274                 () const;\r
275         /** </fn> **/\r
276 \r
277         /*\r
278         * <fn description = "Queries whether a resize is needed.">\r
279         **/\r
280         inline bool\r
281                 is_resize_needed\r
282                 () const;\r
283         /** </fn> **/\r
284 \r
285         /*\r
286         * <fn description = "Queries what the new size should be.">\r
287         **/\r
288         size_type\r
289                 get_new_size\r
290                 (size_type size, size_type num_used_e) const;\r
291         /** </fn> **/\r
292 \r
293         /*\r
294         ***************************************************************************\r
295         ***************************************************************************\r
296         * </group>\r
297         **/\r
298 \r
299 /**\r
300 *******************************************************************************\r
301 *******************************************************************************\r
302 * </protected_methods_group>\r
303 **/\r
304 };\r
305 /**\r
306 * </class>\r
307 **/\r
308 \r
309 \r
310 #endif // #ifndef SAMPLE_RESIZE_POLICY_HPP\r