autogen/include/Clownfish/Class.h

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 3 / 3 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Charmony.pm ↑ Summary autogen/include/Clownfish/Hash.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_CLASS
28 #define H_CLOWNFISH_CLASS 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_CLASS
46 extern uint32_t cfish_Class_IVARS_OFFSET;
47 typedef struct cfish_ClassIVARS cfish_ClassIVARS;
48 static CFISH_INLINE cfish_ClassIVARS*
49 cfish_Class_IVARS(cfish_Class *self) {
50 char *ptr = (char*)self + cfish_Class_IVARS_OFFSET;
51 return (cfish_ClassIVARS*)ptr;
52 }
53 #ifdef CFISH_USE_SHORT_NAMES
54 #define ClassIVARS cfish_ClassIVARS
55 #define Class_IVARS cfish_Class_IVARS
56 #endif
57  
58 struct cfish_Class {
59 CFISH_OBJ_HEAD
60 cfish_Class* klass;
61 cfish_Class* parent;
62 cfish_String* name;
63 cfish_String* name_internal;
64 uint32_t flags;
65 const cfish_ParcelSpec* parcel_spec;
66 uint32_t obj_alloc_size;
67 uint32_t class_alloc_size;
68 void* host_type;
69 cfish_Method** methods;
70 cfish_method_t vtable[1];
71 };
72  
73 #endif /* C_CFISH_CLASS */
74  
75 /* Declare this class's inert variables.
76 */
77  
78 extern CFISH_VISIBLE uint32_t cfish_Class_offset_of_parent;
79  
80  
81 /* Declare both this class's inert functions and the C functions which
82 * implement this class's dynamic methods.
83 */
84  
85 CFISH_VISIBLE void
86 cfish_Class_bootstrap(const cfish_ParcelSpec* parcel_spec);
87  
88 CFISH_VISIBLE cfish_Class*
89 cfish_Class_singleton(cfish_String* class_name, cfish_Class* parent);
90  
91 CFISH_VISIBLE bool
92 cfish_Class_add_to_registry(cfish_Class* klass);
93  
94 CFISH_VISIBLE bool
95 cfish_Class_add_alias_to_registry(cfish_Class* klass, const char* alias_ptr, size_t alias_len);
96  
97 CFISH_VISIBLE void
98 cfish_Class_init_registry(void);
99  
100 CFISH_VISIBLE void
101 cfish_Class_register_with_host(cfish_Class* klass, cfish_Class* parent);
102  
103 CFISH_VISIBLE cfish_Class*
104 cfish_Class_fetch_class(cfish_String* class_name);
105  
106 CFISH_VISIBLE cfish_String*
107 cfish_Class_find_parent_class(cfish_String* class_name);
108  
109 CFISH_VISIBLE cfish_Vector*
110 cfish_Class_fresh_host_methods(cfish_String* class_name);
111  
112 CFISH_VISIBLE void
113 cfish_Class_adjust_host_subclass(cfish_Class* klass);
114  
115 void
116 CFISH_Class_Override_IMP(cfish_Class* self, cfish_method_t method_ptr, uint32_t offset);
117  
118 cfish_Obj*
119 CFISH_Class_Make_Obj_IMP(cfish_Class* self);
120  
121 cfish_Obj*
122 CFISH_Class_Init_Obj_IMP(cfish_Class* self, void* allocation);
123  
124 void
125 CFISH_Class_Add_Host_Method_Alias_IMP(cfish_Class* self, const char* alias, const char* meth_name);
126  
127 void
128 CFISH_Class_Exclude_Host_Method_IMP(cfish_Class* self, const char* meth_name);
129  
130 cfish_String*
131 CFISH_Class_Get_Name_IMP(cfish_Class* self);
132  
133 cfish_Class*
134 CFISH_Class_Get_Parent_IMP(cfish_Class* self);
135  
136 uint32_t
137 CFISH_Class_Get_Obj_Alloc_Size_IMP(cfish_Class* self);
138  
139 cfish_Vector*
140 CFISH_Class_Get_Methods_IMP(cfish_Class* self);
141  
142 void
143 CFISH_Class_Destroy_IMP(cfish_Class* self);
144  
145  
146  
147 /* Define typedefs for each dynamic method, allowing us to cast generic
148 * pointers to the appropriate function pointer type more cleanly.
149 */
150  
151 typedef void*
152 (*CFISH_Class_To_Host_t)(cfish_Class* self, void* vcache);
153  
154 typedef cfish_Obj*
155 (*CFISH_Class_Clone_t)(cfish_Class* self);
156  
157 typedef bool
158 (*CFISH_Class_Equals_t)(cfish_Class* self, cfish_Obj* other);
159  
160 typedef int32_t
161 (*CFISH_Class_Compare_To_t)(cfish_Class* self, cfish_Obj* other);
162  
163 typedef void
164 (*CFISH_Class_Destroy_t)(cfish_Class* self);
165  
166 typedef cfish_String*
167 (*CFISH_Class_To_String_t)(cfish_Class* self);
168  
169 typedef void
170 (*CFISH_Class_Override_t)(cfish_Class* self, cfish_method_t method_ptr, uint32_t offset);
171  
172 typedef cfish_Obj*
173 (*CFISH_Class_Make_Obj_t)(cfish_Class* self);
174  
175 typedef cfish_Obj*
176 (*CFISH_Class_Init_Obj_t)(cfish_Class* self, void* allocation);
177  
178 typedef void
179 (*CFISH_Class_Add_Host_Method_Alias_t)(cfish_Class* self, const char* alias, const char* meth_name);
180  
181 typedef void
182 (*CFISH_Class_Exclude_Host_Method_t)(cfish_Class* self, const char* meth_name);
183  
184 typedef cfish_String*
185 (*CFISH_Class_Get_Name_t)(cfish_Class* self);
186  
187 typedef cfish_Class*
188 (*CFISH_Class_Get_Parent_t)(cfish_Class* self);
189  
190 typedef uint32_t
191 (*CFISH_Class_Get_Obj_Alloc_Size_t)(cfish_Class* self);
192  
193 typedef cfish_Vector*
194 (*CFISH_Class_Get_Methods_t)(cfish_Class* self);
195  
196  
197  
198 /* Define type-safe wrappers for inert functions of Obj.
199 */
200  
201 static CFISH_INLINE cfish_Class*
202 cfish_Class_get_class(cfish_Class *self) {
203 return cfish_Obj_get_class((cfish_Obj*)self);
204 }
205  
206 static CFISH_INLINE cfish_String*
207 cfish_Class_get_class_name(cfish_Class *self) {
208 return cfish_Obj_get_class_name((cfish_Obj*)self);
209 }
210  
211 static CFISH_INLINE bool
212 cfish_Class_is_a(cfish_Class *self, cfish_Class *ancestor) {
213 return cfish_Obj_is_a((cfish_Obj*)self, ancestor);
214 }
215  
216  
217 /* Define the inline functions which implement this class's virtual methods.
218 */
219  
220 extern CFISH_VISIBLE uint32_t CFISH_Class_To_Host_OFFSET;
221 static CFISH_INLINE void*
222 CFISH_Class_To_Host(cfish_Class* self, void* vcache) {
223 #ifdef CFP_CFISH
224 return CFISH_Obj_To_Host_IMP((cfish_Obj*)self, vcache);
225 #else
226 const CFISH_Class_To_Host_t method = (CFISH_Class_To_Host_t)cfish_obj_method(self, CFISH_Class_To_Host_OFFSET);
227 return method(self, vcache);
228 #endif
229 }
230  
231 extern CFISH_VISIBLE uint32_t CFISH_Class_Clone_OFFSET;
232 static CFISH_INLINE cfish_Obj*
233 CFISH_Class_Clone(cfish_Class* self) {
234 #ifdef CFP_CFISH
235 return CFISH_Obj_Clone_IMP((cfish_Obj*)self);
236 #else
237 const CFISH_Class_Clone_t method = (CFISH_Class_Clone_t)cfish_obj_method(self, CFISH_Class_Clone_OFFSET);
238 return method(self);
239 #endif
240 }
241  
242 extern CFISH_VISIBLE uint32_t CFISH_Class_Equals_OFFSET;
243 static CFISH_INLINE bool
244 CFISH_Class_Equals(cfish_Class* self, cfish_Obj* other) {
245 #ifdef CFP_CFISH
246 return CFISH_Obj_Equals_IMP((cfish_Obj*)self, other);
247 #else
248 const CFISH_Class_Equals_t method = (CFISH_Class_Equals_t)cfish_obj_method(self, CFISH_Class_Equals_OFFSET);
249 return method(self, other);
250 #endif
251 }
252  
253 extern CFISH_VISIBLE uint32_t CFISH_Class_Compare_To_OFFSET;
254 static CFISH_INLINE int32_t
255 CFISH_Class_Compare_To(cfish_Class* self, cfish_Obj* other) {
256 #ifdef CFP_CFISH
257 return CFISH_Obj_Compare_To_IMP((cfish_Obj*)self, other);
258 #else
259 const CFISH_Class_Compare_To_t method = (CFISH_Class_Compare_To_t)cfish_obj_method(self, CFISH_Class_Compare_To_OFFSET);
260 return method(self, other);
261 #endif
262 }
263  
264 extern CFISH_VISIBLE uint32_t CFISH_Class_Destroy_OFFSET;
265 static CFISH_INLINE void
266 CFISH_Class_Destroy(cfish_Class* self) {
267 #ifdef CFP_CFISH
268 CFISH_Class_Destroy_IMP(self);
269 #else
270 const CFISH_Class_Destroy_t method = (CFISH_Class_Destroy_t)cfish_obj_method(self, CFISH_Class_Destroy_OFFSET);
271 method(self);
272 #endif
273 }
274  
275 extern CFISH_VISIBLE uint32_t CFISH_Class_To_String_OFFSET;
276 static CFISH_INLINE cfish_String*
277 CFISH_Class_To_String(cfish_Class* self) {
278 #ifdef CFP_CFISH
279 return CFISH_Obj_To_String_IMP((cfish_Obj*)self);
280 #else
281 const CFISH_Class_To_String_t method = (CFISH_Class_To_String_t)cfish_obj_method(self, CFISH_Class_To_String_OFFSET);
282 return method(self);
283 #endif
284 }
285  
286 extern CFISH_VISIBLE uint32_t CFISH_Class_Override_OFFSET;
287 static CFISH_INLINE void
288 CFISH_Class_Override(cfish_Class* self, cfish_method_t method_ptr, uint32_t offset) {
289 #ifdef CFP_CFISH
290 CFISH_Class_Override_IMP(self, method_ptr, offset);
291 #else
292 const CFISH_Class_Override_t method = (CFISH_Class_Override_t)cfish_obj_method(self, CFISH_Class_Override_OFFSET);
293 method(self, method_ptr, offset);
294 #endif
295 }
296  
297 extern CFISH_VISIBLE uint32_t CFISH_Class_Make_Obj_OFFSET;
298 static CFISH_INLINE cfish_Obj*
299 CFISH_Class_Make_Obj(cfish_Class* self) {
300 #ifdef CFP_CFISH
301 return CFISH_Class_Make_Obj_IMP(self);
302 #else
303 const CFISH_Class_Make_Obj_t method = (CFISH_Class_Make_Obj_t)cfish_obj_method(self, CFISH_Class_Make_Obj_OFFSET);
304 return method(self);
305 #endif
306 }
307  
308 extern CFISH_VISIBLE uint32_t CFISH_Class_Init_Obj_OFFSET;
309 static CFISH_INLINE cfish_Obj*
310 CFISH_Class_Init_Obj(cfish_Class* self, void* allocation) {
311 #ifdef CFP_CFISH
312 return CFISH_Class_Init_Obj_IMP(self, allocation);
313 #else
314 const CFISH_Class_Init_Obj_t method = (CFISH_Class_Init_Obj_t)cfish_obj_method(self, CFISH_Class_Init_Obj_OFFSET);
315 return method(self, allocation);
316 #endif
317 }
318  
319 extern CFISH_VISIBLE uint32_t CFISH_Class_Add_Host_Method_Alias_OFFSET;
320 static CFISH_INLINE void
321 CFISH_Class_Add_Host_Method_Alias(cfish_Class* self, const char* alias, const char* meth_name) {
322 #ifdef CFP_CFISH
323 CFISH_Class_Add_Host_Method_Alias_IMP(self, alias, meth_name);
324 #else
325 const CFISH_Class_Add_Host_Method_Alias_t method = (CFISH_Class_Add_Host_Method_Alias_t)cfish_obj_method(self, CFISH_Class_Add_Host_Method_Alias_OFFSET);
326 method(self, alias, meth_name);
327 #endif
328 }
329  
330 extern CFISH_VISIBLE uint32_t CFISH_Class_Exclude_Host_Method_OFFSET;
331 static CFISH_INLINE void
332 CFISH_Class_Exclude_Host_Method(cfish_Class* self, const char* meth_name) {
333 #ifdef CFP_CFISH
334 CFISH_Class_Exclude_Host_Method_IMP(self, meth_name);
335 #else
336 const CFISH_Class_Exclude_Host_Method_t method = (CFISH_Class_Exclude_Host_Method_t)cfish_obj_method(self, CFISH_Class_Exclude_Host_Method_OFFSET);
337 method(self, meth_name);
338 #endif
339 }
340  
341 extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Name_OFFSET;
342 static CFISH_INLINE cfish_String*
343 CFISH_Class_Get_Name(cfish_Class* self) {
344 #ifdef CFP_CFISH
345 return CFISH_Class_Get_Name_IMP(self);
346 #else
347 const CFISH_Class_Get_Name_t method = (CFISH_Class_Get_Name_t)cfish_obj_method(self, CFISH_Class_Get_Name_OFFSET);
348 return method(self);
349 #endif
350 }
351  
352 extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Parent_OFFSET;
353 static CFISH_INLINE cfish_Class*
354 CFISH_Class_Get_Parent(cfish_Class* self) {
355 #ifdef CFP_CFISH
356 return CFISH_Class_Get_Parent_IMP(self);
357 #else
358 const CFISH_Class_Get_Parent_t method = (CFISH_Class_Get_Parent_t)cfish_obj_method(self, CFISH_Class_Get_Parent_OFFSET);
359 return method(self);
360 #endif
361 }
362  
363 extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Obj_Alloc_Size_OFFSET;
364 static CFISH_INLINE uint32_t
365 10 CFISH_Class_Get_Obj_Alloc_Size(cfish_Class* self) {
366 #ifdef CFP_CFISH
367 return CFISH_Class_Get_Obj_Alloc_Size_IMP(self);
368 #else
369 10 const CFISH_Class_Get_Obj_Alloc_Size_t method = (CFISH_Class_Get_Obj_Alloc_Size_t)cfish_obj_method(self, CFISH_Class_Get_Obj_Alloc_Size_OFFSET);
370 10 return method(self);
371 #endif
372 }
373  
374 extern CFISH_VISIBLE uint32_t CFISH_Class_Get_Methods_OFFSET;
375 static CFISH_INLINE cfish_Vector*
376 CFISH_Class_Get_Methods(cfish_Class* self) {
377 #ifdef CFP_CFISH
378 return CFISH_Class_Get_Methods_IMP(self);
379 #else
380 const CFISH_Class_Get_Methods_t method = (CFISH_Class_Get_Methods_t)cfish_obj_method(self, CFISH_Class_Get_Methods_OFFSET);
381 return method(self);
382 #endif
383 }
384  
385  
386  
387 /* Declare callbacks for wrapping host overrides.
388 */
389  
390 #ifdef CFISH_NO_DYNAMIC_OVERRIDES
391 #else
392 #endif
393  
394  
395 /* Define "short names" for this class's symbols.
396 */
397  
398 #ifdef CFISH_USE_SHORT_NAMES
399 #define Class cfish_Class
400 #define CLASS CFISH_CLASS
401 #define Class_bootstrap cfish_Class_bootstrap
402 #define Class_singleton cfish_Class_singleton
403 #define Class_add_to_registry cfish_Class_add_to_registry
404 #define Class_add_alias_to_registry cfish_Class_add_alias_to_registry
405 #define Class_init_registry cfish_Class_init_registry
406 #define Class_register_with_host cfish_Class_register_with_host
407 #define Class_fetch_class cfish_Class_fetch_class
408 #define Class_find_parent_class cfish_Class_find_parent_class
409 #define Class_fresh_host_methods cfish_Class_fresh_host_methods
410 #define Class_adjust_host_subclass cfish_Class_adjust_host_subclass
411 #define Class_offset_of_parent cfish_Class_offset_of_parent
412 #define Class_get_class cfish_Class_get_class
413 #define Class_get_class_name cfish_Class_get_class_name
414 #define Class_is_a cfish_Class_is_a
415 #define Class_Override_IMP CFISH_Class_Override_IMP
416 #define Class_Make_Obj_IMP CFISH_Class_Make_Obj_IMP
417 #define Class_Init_Obj_IMP CFISH_Class_Init_Obj_IMP
418 #define Class_Add_Host_Method_Alias_IMP CFISH_Class_Add_Host_Method_Alias_IMP
419 #define Class_Exclude_Host_Method_IMP CFISH_Class_Exclude_Host_Method_IMP
420 #define Class_Get_Name_IMP CFISH_Class_Get_Name_IMP
421 #define Class_Get_Parent_IMP CFISH_Class_Get_Parent_IMP
422 #define Class_Get_Obj_Alloc_Size_IMP CFISH_Class_Get_Obj_Alloc_Size_IMP
423 #define Class_Get_Methods_IMP CFISH_Class_Get_Methods_IMP
424 #define Class_Destroy_IMP CFISH_Class_Destroy_IMP
425 #define Class_To_Host CFISH_Class_To_Host
426 #define Class_To_Host_t CFISH_Class_To_Host_t
427 #define Class_Clone CFISH_Class_Clone
428 #define Class_Clone_t CFISH_Class_Clone_t
429 #define Class_Equals CFISH_Class_Equals
430 #define Class_Equals_t CFISH_Class_Equals_t
431 #define Class_Compare_To CFISH_Class_Compare_To
432 #define Class_Compare_To_t CFISH_Class_Compare_To_t
433 #define Class_Destroy CFISH_Class_Destroy
434 #define Class_Destroy_t CFISH_Class_Destroy_t
435 #define Class_To_String CFISH_Class_To_String
436 #define Class_To_String_t CFISH_Class_To_String_t
437 #define Class_Override CFISH_Class_Override
438 #define Class_Override_t CFISH_Class_Override_t
439 #define Class_Make_Obj CFISH_Class_Make_Obj
440 #define Class_Make_Obj_t CFISH_Class_Make_Obj_t
441 #define Class_Init_Obj CFISH_Class_Init_Obj
442 #define Class_Init_Obj_t CFISH_Class_Init_Obj_t
443 #define Class_Add_Host_Method_Alias CFISH_Class_Add_Host_Method_Alias
444 #define Class_Add_Host_Method_Alias_t CFISH_Class_Add_Host_Method_Alias_t
445 #define Class_Exclude_Host_Method CFISH_Class_Exclude_Host_Method
446 #define Class_Exclude_Host_Method_t CFISH_Class_Exclude_Host_Method_t
447 #define Class_Get_Name CFISH_Class_Get_Name
448 #define Class_Get_Name_t CFISH_Class_Get_Name_t
449 #define Class_Get_Parent CFISH_Class_Get_Parent
450 #define Class_Get_Parent_t CFISH_Class_Get_Parent_t
451 #define Class_Get_Obj_Alloc_Size CFISH_Class_Get_Obj_Alloc_Size
452 #define Class_Get_Obj_Alloc_Size_t CFISH_Class_Get_Obj_Alloc_Size_t
453 #define Class_Get_Methods CFISH_Class_Get_Methods
454 #define Class_Get_Methods_t CFISH_Class_Get_Methods_t
455 #endif /* CFISH_USE_SHORT_NAMES */
456  
457  
458  
459 #define CFISH_ALLOCA_OBJ(class) \
460 cfish_alloca(CFISH_Class_Get_Obj_Alloc_Size(class))
461  
462 /** Bootstrapping hook/hack needed by the Python bindings.
463 *
464 * TODO: Refactor this away in favor of a more general solution.
465 */
466 typedef void
467 (*cfish_Class_bootstrap_hook1_t)(cfish_Class *self);
468 extern cfish_Class_bootstrap_hook1_t cfish_Class_bootstrap_hook1;
469  
470  
471  
472  
473 #ifdef __cplusplus
474 }
475 #endif
476  
477 #endif /* H_CLOWNFISH_CLASS */
478  
479  
480  
481  
« Charmony.pm ↑ Summary autogen/include/Clownfish/Hash.h »