The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
proj_classes.h
Go to the documentation of this file.
1 
24 #include <projectcommon.h>
25 #include <assimobj.h>
26 #include <glib.h>
27 
28 WINEXPORT gpointer proj_class_new(gsize objsize, const char * static_classname);
29 WINEXPORT void proj_class_dissociate(gpointer object);
30 WINEXPORT void proj_class_free(gpointer object);
31 WINEXPORT void proj_class_register_object(gpointer object, const char * static_classname);
32 WINEXPORT gboolean proj_class_is_a(gconstpointer object, const char * castclass);
33 WINEXPORT gpointer proj_class_castas(gpointer object, const char * castclass);
34 WINEXPORT gconstpointer proj_class_castasconst(gconstpointer object, const char * castclass);
35 WINEXPORT gpointer proj_class_register_subclassed(gpointer object, const char * static_subclassname);
36 WINEXPORT void proj_class_quark_add_superclass_relationship(GQuark superclass, GQuark subclass);
37 WINEXPORT gboolean proj_class_quark_is_a(GQuark objectclass, GQuark testclass);
38 WINEXPORT const char * proj_class_classname(gconstpointer object);
39 WINEXPORT void proj_class_register_debug_counter(const char * Cclass, guint*debugcount);
40 WINEXPORT void proj_class_incr_debug(const char * Cclass);
41 WINEXPORT void proj_class_decr_debug(const char * Cclass);
42 WINEXPORT void proj_class_debug_dump(const char * prefix, const AssimObj* obj, const char *suffix);
43 
48 
51 
55 #define MALLOCBASECLASS(Cclass) ((Cclass *) proj_class_new(sizeof(Cclass), #Cclass))
56 
61 #define MALLOCCLASS(Cclass, size) ((Cclass *) proj_class_new(size, #Cclass))
62 
66 #define CASTTOCLASS(Cclass, obj) ((Cclass *) proj_class_castas(obj, #Cclass))
67 #define NEWSUBCLASS(Cclass, obj) ((Cclass *) proj_class_register_subclassed(obj, #Cclass))
68 #define CASTTOCONSTCLASS(Cclass, obj) ((const Cclass *) proj_class_castasconst(obj, #Cclass))
72 #define OBJ_IS_A(obj, Cclass) proj_class_is_a(obj, Cclass)
73 
76 #define FREECLASSOBJ(obj) {proj_class_free(obj); obj = NULL;}
77 
78 #define DEBUGVAR __class_debug_count
79 #define DEBUGDECLARATIONS static gboolean __class_debug_registered = FALSE; \
80  static guint __class_debug_count = 0;
81 #define BINDDEBUG(Cclass) {if (!__class_debug_registered) {proj_class_register_debug_counter(#Cclass, &__class_debug_count); __class_debug_registered = TRUE;};}
83 
84 
85 #define DEBUG (DEBUGVAR)
86 
87 #define DEBUGMSG(...) {if (DEBUG) {g_debug(__VA_ARGS__);};}
88 #define DEBUGMSGn(n, ...) {if (DEBUG >= (n)) {g_debug(__VA_ARGS__);};}
89 #define DEBUGMSG1(...) DEBUGMSG ( __VA_ARGS__)
90 #define DEBUGMSG2(...) DEBUGMSGn(2, __VA_ARGS__)
91 #define DEBUGMSG3(...) DEBUGMSGn(3, __VA_ARGS__)
92 #define DEBUGMSG4(...) DEBUGMSGn(4, __VA_ARGS__)
93 #define DEBUGMSG5(...) DEBUGMSGn(5, __VA_ARGS__)
94 #define DUMP(prefix, obj, suffix) {proj_class_debug_dump(prefix, obj, suffix);}
95 #define DUMP1(prefix, obj, suffix) {if (DEBUG>=1) {DUMP(prefix, obj, suffix);};}
96 #define DUMP2(prefix, obj, suffix) {if (DEBUG>=2) {DUMP(prefix, obj, suffix);};}
97 #define DUMP3(prefix, obj, suffix) {if (DEBUG>=3) {DUMP(prefix, obj, suffix);};}
98 #define DUMP4(prefix, obj, suffix) {if (DEBUG>=4) {DUMP(prefix, obj, suffix);};}
99 #define DUMP5(prefix, obj, suffix) {if (DEBUG>=5) {DUMP(prefix, obj, suffix);};}
100 
101