The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
assimobj.h
Go to the documentation of this file.
1 
24 #ifndef _ASSIMOBJ_H
25 #define _ASSIMOBJ_H
26 
27 #ifdef LOG_REFS
28 # define TRACEREF(obj) g_debug("%s.%d: REF(%p)", __FUNCTION__, __LINE__, obj);
29 # define TRACEUNREF(obj) g_debug("%s.%d: UNREF(%p)", __FUNCTION__, __LINE__, obj);
30 #else
31 # define TRACEREF(obj) /* nothing */;
32 # define TRACEUNREF(obj) /* nothing */;
33 #endif
34 
35 #define UNREF(obj) {TRACEUNREF(obj) (obj)->baseclass.unref(&(obj)->baseclass); (obj) = NULL;}
36 #define UNREF2(obj) {TRACEUNREF(obj) (obj)->baseclass.baseclass.unref(&(obj)->baseclass.baseclass); (obj) = NULL;}
37 #define UNREF3(obj) {TRACEUNREF(obj) (obj)->baseclass.baseclass.baseclass.unref(&(obj)->baseclass.baseclass.baseclass); (obj) = NULL;}
38 #define UNREF4(obj) {TRACEUNREF(obj) (obj)->baseclass.baseclass.baseclass.baseclass.unref(&(obj)->baseclass.baseclass.baseclass.baseclass); (obj) = NULL;}
39 #define REF(obj) {TRACEREF(obj) (obj)->baseclass.ref(&(obj)->baseclass);}
40 #define REF2(obj) {TRACEREF(obj) (obj)->baseclass.baseclass.ref(&(obj)->baseclass.baseclass);}
41 #define REF3(obj) {TRACEREF(obj) (obj)->baseclass.baseclass.baseclass.ref(&(obj)->baseclass.baseclass.baseclass);}
42 #define REF4(obj) {TRACEREF(obj) (obj)->baseclass.baseclass.baseclass.baseclass.ref(&(obj)->baseclass.baseclass.baseclass.baseclass);}
43 
46 typedef struct _AssimObj AssimObj;
47 #include <projectcommon.h>
48 
49 struct _AssimObj {
50 #ifdef DEBUGLEAKS
51  long _bornon;
52 #endif
53  int _refcount;
54 
55  void (*_finalize)(AssimObj*);
56  void (*ref)(gpointer);
57  void (*unref)(gpointer);
58  gchar* (*toString)(gconstpointer);
59 };
60 WINEXPORT AssimObj* assimobj_new(guint objsize);
62 extern gboolean badfree; //< for debugging
64 #endif /* ASSIMOBJ_H */