autogen/include/Clownfish/Hash.h

filter: Statementstmt 100% 5 / 5 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 5 / 5 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« autogen/include/Clownfish/Class.h ↑ Summary autogen/include/Clownfish/Obj.h »
1 /*
2 * ***********************************************
3 *
4 * !!!! DO NOT EDIT !!!!
5 *
6 * This file was auto-generated by Build.PL.
7 *
8 * ***********************************************
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed with
12 * this work for additional information regarding copyright ownership.
13 * The ASF licenses this file to You under the Apache License, Version 2.0
14 * (the "License"); you may not use this file except in compliance with
15 * the License. You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 */
25  
26  
27 #ifndef H_CLOWNFISH_HASH
28 #define H_CLOWNFISH_HASH 1
29  
30  
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34  
35 #include "cfish_parcel.h"
36  
37 /* Include the header for this class's parent.
38 */
39  
40 #include "Clownfish/Obj.h"
41  
42 /* Define the struct layout for instances of this class.
43 */
44  
45 #ifdef C_CFISH_HASH
46 extern uint32_t cfish_Hash_IVARS_OFFSET;
47 typedef struct cfish_HashIVARS cfish_HashIVARS;
48 static CFISH_INLINE cfish_HashIVARS*
49 cfish_Hash_IVARS(cfish_Hash *self) {
50 char *ptr = (char*)self + cfish_Hash_IVARS_OFFSET;
51 return (cfish_HashIVARS*)ptr;
52 }
53 #ifdef CFISH_USE_SHORT_NAMES
54 #define HashIVARS cfish_HashIVARS
55 #define Hash_IVARS cfish_Hash_IVARS
56 #endif
57  
58 struct cfish_Hash {
59 CFISH_OBJ_HEAD
60 cfish_Class* klass;
61 void* entries;
62 size_t capacity;
63 size_t size;
64 size_t threshold;
65 };
66  
67 #endif /* C_CFISH_HASH */
68  
69 /* Declare this class's inert variables.
70 */
71  
72  
73  
74 /* Declare both this class's inert functions and the C functions which
75 * implement this class's dynamic methods.
76 */
77  
78 CFISH_VISIBLE void
79 cfish_Hash_init_class(void);
80  
81 CFISH_VISIBLE cfish_Hash*
82 cfish_Hash_new(size_t capacity);
83  
84 CFISH_VISIBLE cfish_Hash*
85 cfish_Hash_init(cfish_Hash* self, size_t capacity);
86  
87 CFISH_VISIBLE cfish_String*
88 cfish_Hash_get_tombstone(void);
89  
90 void*
91 CFISH_Hash_To_Host_IMP(cfish_Hash* self, void* vcache);
92  
93 void
94 CFISH_Hash_Clear_IMP(cfish_Hash* self);
95  
96 void
97 CFISH_Hash_Store_IMP(cfish_Hash* self, cfish_String* key, cfish_Obj* value);
98  
99 void
100 CFISH_Hash_Store_Utf8_IMP(cfish_Hash* self, const char* utf8, size_t size, cfish_Obj* value);
101  
102 cfish_Obj*
103 CFISH_Hash_Fetch_IMP(cfish_Hash* self, cfish_String* key);
104  
105 cfish_Obj*
106 CFISH_Hash_Fetch_Utf8_IMP(cfish_Hash* self, const char* utf8, size_t size);
107  
108 cfish_Obj*
109 CFISH_Hash_Delete_IMP(cfish_Hash* self, cfish_String* key);
110  
111 cfish_Obj*
112 CFISH_Hash_Delete_Utf8_IMP(cfish_Hash* self, const char* utf8, size_t size);
113  
114 bool
115 CFISH_Hash_Has_Key_IMP(cfish_Hash* self, cfish_String* key);
116  
117 cfish_Vector*
118 CFISH_Hash_Keys_IMP(cfish_Hash* self);
119  
120 cfish_Vector*
121 CFISH_Hash_Values_IMP(cfish_Hash* self);
122  
123 size_t
124 CFISH_Hash_Get_Capacity_IMP(cfish_Hash* self);
125  
126 size_t
127 CFISH_Hash_Get_Size_IMP(cfish_Hash* self);
128  
129 bool
130 CFISH_Hash_Equals_IMP(cfish_Hash* self, cfish_Obj* other);
131  
132 void
133 CFISH_Hash_Destroy_IMP(cfish_Hash* self);
134  
135  
136  
137 /* Define typedefs for each dynamic method, allowing us to cast generic
138 * pointers to the appropriate function pointer type more cleanly.
139 */
140  
141 typedef void*
142 (*CFISH_Hash_To_Host_t)(cfish_Hash* self, void* vcache);
143  
144 typedef cfish_Obj*
145 (*CFISH_Hash_Clone_t)(cfish_Hash* self);
146  
147 typedef bool
148 (*CFISH_Hash_Equals_t)(cfish_Hash* self, cfish_Obj* other);
149  
150 typedef int32_t
151 (*CFISH_Hash_Compare_To_t)(cfish_Hash* self, cfish_Obj* other);
152  
153 typedef void
154 (*CFISH_Hash_Destroy_t)(cfish_Hash* self);
155  
156 typedef cfish_String*
157 (*CFISH_Hash_To_String_t)(cfish_Hash* self);
158  
159 typedef void
160 (*CFISH_Hash_Clear_t)(cfish_Hash* self);
161  
162 typedef void
163 (*CFISH_Hash_Store_t)(cfish_Hash* self, cfish_String* key, cfish_Obj* value);
164  
165 typedef void
166 (*CFISH_Hash_Store_Utf8_t)(cfish_Hash* self, const char* utf8, size_t size, cfish_Obj* value);
167  
168 typedef cfish_Obj*
169 (*CFISH_Hash_Fetch_t)(cfish_Hash* self, cfish_String* key);
170  
171 typedef cfish_Obj*
172 (*CFISH_Hash_Fetch_Utf8_t)(cfish_Hash* self, const char* utf8, size_t size);
173  
174 typedef cfish_Obj*
175 (*CFISH_Hash_Delete_t)(cfish_Hash* self, cfish_String* key);
176  
177 typedef cfish_Obj*
178 (*CFISH_Hash_Delete_Utf8_t)(cfish_Hash* self, const char* utf8, size_t size);
179  
180 typedef bool
181 (*CFISH_Hash_Has_Key_t)(cfish_Hash* self, cfish_String* key);
182  
183 typedef cfish_Vector*
184 (*CFISH_Hash_Keys_t)(cfish_Hash* self);
185  
186 typedef cfish_Vector*
187 (*CFISH_Hash_Values_t)(cfish_Hash* self);
188  
189 typedef size_t
190 (*CFISH_Hash_Get_Capacity_t)(cfish_Hash* self);
191  
192 typedef size_t
193 (*CFISH_Hash_Get_Size_t)(cfish_Hash* self);
194  
195  
196  
197 /* Define type-safe wrappers for inert functions of Obj.
198 */
199  
200 static CFISH_INLINE cfish_Class*
201 cfish_Hash_get_class(cfish_Hash *self) {
202 return cfish_Obj_get_class((cfish_Obj*)self);
203 }
204  
205 static CFISH_INLINE cfish_String*
206 cfish_Hash_get_class_name(cfish_Hash *self) {
207 return cfish_Obj_get_class_name((cfish_Obj*)self);
208 }
209  
210 static CFISH_INLINE bool
211 cfish_Hash_is_a(cfish_Hash *self, cfish_Class *ancestor) {
212 return cfish_Obj_is_a((cfish_Obj*)self, ancestor);
213 }
214  
215  
216 /* Define the inline functions which implement this class's virtual methods.
217 */
218  
219 extern CFISH_VISIBLE uint32_t CFISH_Hash_To_Host_OFFSET;
220 static CFISH_INLINE void*
221 CFISH_Hash_To_Host(cfish_Hash* self, void* vcache) {
222 #ifdef CFP_CFISH
223 return CFISH_Hash_To_Host_IMP(self, vcache);
224 #else
225 const CFISH_Hash_To_Host_t method = (CFISH_Hash_To_Host_t)cfish_obj_method(self, CFISH_Hash_To_Host_OFFSET);
226 return method(self, vcache);
227 #endif
228 }
229  
230 extern CFISH_VISIBLE uint32_t CFISH_Hash_Clone_OFFSET;
231 static CFISH_INLINE cfish_Obj*
232 CFISH_Hash_Clone(cfish_Hash* self) {
233 #ifdef CFP_CFISH
234 return CFISH_Obj_Clone_IMP((cfish_Obj*)self);
235 #else
236 const CFISH_Hash_Clone_t method = (CFISH_Hash_Clone_t)cfish_obj_method(self, CFISH_Hash_Clone_OFFSET);
237 return method(self);
238 #endif
239 }
240  
241 extern CFISH_VISIBLE uint32_t CFISH_Hash_Equals_OFFSET;
242 static CFISH_INLINE bool
243 CFISH_Hash_Equals(cfish_Hash* self, cfish_Obj* other) {
244 #ifdef CFP_CFISH
245 return CFISH_Hash_Equals_IMP(self, other);
246 #else
247 const CFISH_Hash_Equals_t method = (CFISH_Hash_Equals_t)cfish_obj_method(self, CFISH_Hash_Equals_OFFSET);
248 return method(self, other);
249 #endif
250 }
251  
252 extern CFISH_VISIBLE uint32_t CFISH_Hash_Compare_To_OFFSET;
253 static CFISH_INLINE int32_t
254 CFISH_Hash_Compare_To(cfish_Hash* self, cfish_Obj* other) {
255 #ifdef CFP_CFISH
256 return CFISH_Obj_Compare_To_IMP((cfish_Obj*)self, other);
257 #else
258 const CFISH_Hash_Compare_To_t method = (CFISH_Hash_Compare_To_t)cfish_obj_method(self, CFISH_Hash_Compare_To_OFFSET);
259 return method(self, other);
260 #endif
261 }
262  
263 extern CFISH_VISIBLE uint32_t CFISH_Hash_Destroy_OFFSET;
264 static CFISH_INLINE void
265 CFISH_Hash_Destroy(cfish_Hash* self) {
266 #ifdef CFP_CFISH
267 CFISH_Hash_Destroy_IMP(self);
268 #else
269 const CFISH_Hash_Destroy_t method = (CFISH_Hash_Destroy_t)cfish_obj_method(self, CFISH_Hash_Destroy_OFFSET);
270 method(self);
271 #endif
272 }
273  
274 extern CFISH_VISIBLE uint32_t CFISH_Hash_To_String_OFFSET;
275 static CFISH_INLINE cfish_String*
276 CFISH_Hash_To_String(cfish_Hash* self) {
277 #ifdef CFP_CFISH
278 return CFISH_Obj_To_String_IMP((cfish_Obj*)self);
279 #else
280 const CFISH_Hash_To_String_t method = (CFISH_Hash_To_String_t)cfish_obj_method(self, CFISH_Hash_To_String_OFFSET);
281 return method(self);
282 #endif
283 }
284  
285 extern CFISH_VISIBLE uint32_t CFISH_Hash_Clear_OFFSET;
286 static CFISH_INLINE void
287 CFISH_Hash_Clear(cfish_Hash* self) {
288 #ifdef CFP_CFISH
289 CFISH_Hash_Clear_IMP(self);
290 #else
291 const CFISH_Hash_Clear_t method = (CFISH_Hash_Clear_t)cfish_obj_method(self, CFISH_Hash_Clear_OFFSET);
292 method(self);
293 #endif
294 }
295  
296 extern CFISH_VISIBLE uint32_t CFISH_Hash_Store_OFFSET;
297 static CFISH_INLINE void
298 7 CFISH_Hash_Store(cfish_Hash* self, cfish_String* key, cfish_Obj* value) {
299 #ifdef CFP_CFISH
300 7 CFISH_Hash_Store_IMP(self, key, value);
301 #else
302 const CFISH_Hash_Store_t method = (CFISH_Hash_Store_t)cfish_obj_method(self, CFISH_Hash_Store_OFFSET);
303 method(self, key, value);
304 #endif
305 7 }
306  
307 extern CFISH_VISIBLE uint32_t CFISH_Hash_Store_Utf8_OFFSET;
308 static CFISH_INLINE void
309 CFISH_Hash_Store_Utf8(cfish_Hash* self, const char* utf8, size_t size, cfish_Obj* value) {
310 #ifdef CFP_CFISH
311 CFISH_Hash_Store_Utf8_IMP(self, utf8, size, value);
312 #else
313 const CFISH_Hash_Store_Utf8_t method = (CFISH_Hash_Store_Utf8_t)cfish_obj_method(self, CFISH_Hash_Store_Utf8_OFFSET);
314 method(self, utf8, size, value);
315 #endif
316 }
317  
318 extern CFISH_VISIBLE uint32_t CFISH_Hash_Fetch_OFFSET;
319 static CFISH_INLINE cfish_Obj*
320 5 CFISH_Hash_Fetch(cfish_Hash* self, cfish_String* key) {
321 #ifdef CFP_CFISH
322 5 return CFISH_Hash_Fetch_IMP(self, key);
323 #else
324 const CFISH_Hash_Fetch_t method = (CFISH_Hash_Fetch_t)cfish_obj_method(self, CFISH_Hash_Fetch_OFFSET);
325 return method(self, key);
326 #endif
327 }
328  
329 extern CFISH_VISIBLE uint32_t CFISH_Hash_Fetch_Utf8_OFFSET;
330 static CFISH_INLINE cfish_Obj*
331 CFISH_Hash_Fetch_Utf8(cfish_Hash* self, const char* utf8, size_t size) {
332 #ifdef CFP_CFISH
333 return CFISH_Hash_Fetch_Utf8_IMP(self, utf8, size);
334 #else
335 const CFISH_Hash_Fetch_Utf8_t method = (CFISH_Hash_Fetch_Utf8_t)cfish_obj_method(self, CFISH_Hash_Fetch_Utf8_OFFSET);
336 return method(self, utf8, size);
337 #endif
338 }
339  
340 extern CFISH_VISIBLE uint32_t CFISH_Hash_Delete_OFFSET;
341 static CFISH_INLINE cfish_Obj*
342 CFISH_Hash_Delete(cfish_Hash* self, cfish_String* key) {
343 #ifdef CFP_CFISH
344 return CFISH_Hash_Delete_IMP(self, key);
345 #else
346 const CFISH_Hash_Delete_t method = (CFISH_Hash_Delete_t)cfish_obj_method(self, CFISH_Hash_Delete_OFFSET);
347 return method(self, key);
348 #endif
349 }
350  
351 extern CFISH_VISIBLE uint32_t CFISH_Hash_Delete_Utf8_OFFSET;
352 static CFISH_INLINE cfish_Obj*
353 CFISH_Hash_Delete_Utf8(cfish_Hash* self, const char* utf8, size_t size) {
354 #ifdef CFP_CFISH
355 return CFISH_Hash_Delete_Utf8_IMP(self, utf8, size);
356 #else
357 const CFISH_Hash_Delete_Utf8_t method = (CFISH_Hash_Delete_Utf8_t)cfish_obj_method(self, CFISH_Hash_Delete_Utf8_OFFSET);
358 return method(self, utf8, size);
359 #endif
360 }
361  
362 extern CFISH_VISIBLE uint32_t CFISH_Hash_Has_Key_OFFSET;
363 static CFISH_INLINE bool
364 CFISH_Hash_Has_Key(cfish_Hash* self, cfish_String* key) {
365 #ifdef CFP_CFISH
366 return CFISH_Hash_Has_Key_IMP(self, key);
367 #else
368 const CFISH_Hash_Has_Key_t method = (CFISH_Hash_Has_Key_t)cfish_obj_method(self, CFISH_Hash_Has_Key_OFFSET);
369 return method(self, key);
370 #endif
371 }
372  
373 extern CFISH_VISIBLE uint32_t CFISH_Hash_Keys_OFFSET;
374 static CFISH_INLINE cfish_Vector*
375 CFISH_Hash_Keys(cfish_Hash* self) {
376 #ifdef CFP_CFISH
377 return CFISH_Hash_Keys_IMP(self);
378 #else
379 const CFISH_Hash_Keys_t method = (CFISH_Hash_Keys_t)cfish_obj_method(self, CFISH_Hash_Keys_OFFSET);
380 return method(self);
381 #endif
382 }
383  
384 extern CFISH_VISIBLE uint32_t CFISH_Hash_Values_OFFSET;
385 static CFISH_INLINE cfish_Vector*
386 CFISH_Hash_Values(cfish_Hash* self) {
387 #ifdef CFP_CFISH
388 return CFISH_Hash_Values_IMP(self);
389 #else
390 const CFISH_Hash_Values_t method = (CFISH_Hash_Values_t)cfish_obj_method(self, CFISH_Hash_Values_OFFSET);
391 return method(self);
392 #endif
393 }
394  
395 extern CFISH_VISIBLE uint32_t CFISH_Hash_Get_Capacity_OFFSET;
396 static CFISH_INLINE size_t
397 CFISH_Hash_Get_Capacity(cfish_Hash* self) {
398 #ifdef CFP_CFISH
399 return CFISH_Hash_Get_Capacity_IMP(self);
400 #else
401 const CFISH_Hash_Get_Capacity_t method = (CFISH_Hash_Get_Capacity_t)cfish_obj_method(self, CFISH_Hash_Get_Capacity_OFFSET);
402 return method(self);
403 #endif
404 }
405  
406 extern CFISH_VISIBLE uint32_t CFISH_Hash_Get_Size_OFFSET;
407 static CFISH_INLINE size_t
408 CFISH_Hash_Get_Size(cfish_Hash* self) {
409 #ifdef CFP_CFISH
410 return CFISH_Hash_Get_Size_IMP(self);
411 #else
412 const CFISH_Hash_Get_Size_t method = (CFISH_Hash_Get_Size_t)cfish_obj_method(self, CFISH_Hash_Get_Size_OFFSET);
413 return method(self);
414 #endif
415 }
416  
417  
418  
419 /* Declare callbacks for wrapping host overrides.
420 */
421  
422 #ifdef CFISH_NO_DYNAMIC_OVERRIDES
423 #else
424 #endif
425  
426  
427 /* Define "short names" for this class's symbols.
428 */
429  
430 #ifdef CFISH_USE_SHORT_NAMES
431 #define Hash cfish_Hash
432 #define HASH CFISH_HASH
433 #define Hash_init_class cfish_Hash_init_class
434 #define Hash_new cfish_Hash_new
435 #define Hash_init cfish_Hash_init
436 #define Hash_get_tombstone cfish_Hash_get_tombstone
437 #define Hash_get_class cfish_Hash_get_class
438 #define Hash_get_class_name cfish_Hash_get_class_name
439 #define Hash_is_a cfish_Hash_is_a
440 #define Hash_To_Host_IMP CFISH_Hash_To_Host_IMP
441 #define Hash_Clear_IMP CFISH_Hash_Clear_IMP
442 #define Hash_Store_IMP CFISH_Hash_Store_IMP
443 #define Hash_Store_Utf8_IMP CFISH_Hash_Store_Utf8_IMP
444 #define Hash_Fetch_IMP CFISH_Hash_Fetch_IMP
445 #define Hash_Fetch_Utf8_IMP CFISH_Hash_Fetch_Utf8_IMP
446 #define Hash_Delete_IMP CFISH_Hash_Delete_IMP
447 #define Hash_Delete_Utf8_IMP CFISH_Hash_Delete_Utf8_IMP
448 #define Hash_Has_Key_IMP CFISH_Hash_Has_Key_IMP
449 #define Hash_Keys_IMP CFISH_Hash_Keys_IMP
450 #define Hash_Values_IMP CFISH_Hash_Values_IMP
451 #define Hash_Get_Capacity_IMP CFISH_Hash_Get_Capacity_IMP
452 #define Hash_Get_Size_IMP CFISH_Hash_Get_Size_IMP
453 #define Hash_Equals_IMP CFISH_Hash_Equals_IMP
454 #define Hash_Destroy_IMP CFISH_Hash_Destroy_IMP
455 #define Hash_To_Host CFISH_Hash_To_Host
456 #define Hash_To_Host_t CFISH_Hash_To_Host_t
457 #define Hash_Clone CFISH_Hash_Clone
458 #define Hash_Clone_t CFISH_Hash_Clone_t
459 #define Hash_Equals CFISH_Hash_Equals
460 #define Hash_Equals_t CFISH_Hash_Equals_t
461 #define Hash_Compare_To CFISH_Hash_Compare_To
462 #define Hash_Compare_To_t CFISH_Hash_Compare_To_t
463 #define Hash_Destroy CFISH_Hash_Destroy
464 #define Hash_Destroy_t CFISH_Hash_Destroy_t
465 #define Hash_To_String CFISH_Hash_To_String
466 #define Hash_To_String_t CFISH_Hash_To_String_t
467 #define Hash_Clear CFISH_Hash_Clear
468 #define Hash_Clear_t CFISH_Hash_Clear_t
469 #define Hash_Store CFISH_Hash_Store
470 #define Hash_Store_t CFISH_Hash_Store_t
471 #define Hash_Store_Utf8 CFISH_Hash_Store_Utf8
472 #define Hash_Store_Utf8_t CFISH_Hash_Store_Utf8_t
473 #define Hash_Fetch CFISH_Hash_Fetch
474 #define Hash_Fetch_t CFISH_Hash_Fetch_t
475 #define Hash_Fetch_Utf8 CFISH_Hash_Fetch_Utf8
476 #define Hash_Fetch_Utf8_t CFISH_Hash_Fetch_Utf8_t
477 #define Hash_Delete CFISH_Hash_Delete
478 #define Hash_Delete_t CFISH_Hash_Delete_t
479 #define Hash_Delete_Utf8 CFISH_Hash_Delete_Utf8
480 #define Hash_Delete_Utf8_t CFISH_Hash_Delete_Utf8_t
481 #define Hash_Has_Key CFISH_Hash_Has_Key
482 #define Hash_Has_Key_t CFISH_Hash_Has_Key_t
483 #define Hash_Keys CFISH_Hash_Keys
484 #define Hash_Keys_t CFISH_Hash_Keys_t
485 #define Hash_Values CFISH_Hash_Values
486 #define Hash_Values_t CFISH_Hash_Values_t
487 #define Hash_Get_Capacity CFISH_Hash_Get_Capacity
488 #define Hash_Get_Capacity_t CFISH_Hash_Get_Capacity_t
489 #define Hash_Get_Size CFISH_Hash_Get_Size
490 #define Hash_Get_Size_t CFISH_Hash_Get_Size_t
491 #endif /* CFISH_USE_SHORT_NAMES */
492  
493  
494  
495  
496  
497 #ifdef __cplusplus
498 }
499 #endif
500  
501 #endif /* H_CLOWNFISH_HASH */
502  
503  
504  
505  
« autogen/include/Clownfish/Class.h ↑ Summary autogen/include/Clownfish/Obj.h »