33#define RAVE_OBJECT_HEAD \
35 struct _raveobjecttype* roh_type; \
36 void* roh_bindingData;
66#define RAVE_OBJECT_NEW(type) \
67 (void*)RaveCoreObject_new(type, __FILE__, __LINE__);
76#define RAVE_OBJECT_RELEASE(obj) \
77 RaveCoreObject_release((RaveCoreObject*)(obj), __FILE__, __LINE__); \
87#define RAVE_OBJECT_COPY(src) \
88 (void*)RaveCoreObject_copy((RaveCoreObject*)(src), __FILE__, __LINE__)
105#define RAVE_OBJECT_CLONE(src) \
106 (void*)RaveCoreObject_clone((RaveCoreObject*)(src), __FILE__, __LINE__)
112#define RAVE_OBJECT_ISCLONEABLE(src) \
113 RaveCoreObject_isCloneable((RaveCoreObject*)(src))
118#define RAVE_OBJECT_REFCNT(src) \
119 RaveCoreObject_getRefCount((RaveCoreObject*)src)
124#define RAVE_OBJECT_BIND(this, bound) \
125 RaveCoreObject_bind((RaveCoreObject*)this, bound)
130#define RAVE_OBJECT_UNBIND(this, bound) \
131 RaveCoreObject_unbind((RaveCoreObject*)this, bound)
136#define RAVE_OBJECT_ISBOUND(this) \
137 (RaveCoreObject_getBindingData((RaveCoreObject*)this) != NULL)
142#define RAVE_OBJECT_GETBINDING(this) \
143 RaveCoreObject_getBindingData((RaveCoreObject*)this)
152#define RAVE_OBJECT_CHECK_TYPE(this, type) \
153 (((RaveCoreObject*)this)->roh_type == type)
void RaveCoreObject_printStatistics(void)
Prints the rave object statistics.
Definition rave_object.c:244
struct _raveobject RaveCoreObject
The basic raveobject that contains the header information for all rave objects.
void RaveCoreObject_release(RaveCoreObject *obj, const char *filename, int lineno)
Decrements the reference counter and if reference counts gets to 0, the destructor that was provided ...
Definition rave_object.c:145
RaveCoreObject * RaveCoreObject_new(RaveCoreObjectType *type, const char *filename, int lineno)
Creates a new instance of the provided type.
Definition rave_object.c:123
struct _raveobjecttype RaveCoreObjectType
The rave object type definition.
int RaveCoreObject_isCloneable(RaveCoreObject *src)
Returns if this object is possible to clone or not.
Definition rave_object.c:228
void RaveCoreObject_bind(RaveCoreObject *src, void *bindingData)
Sets the binding data field, useful when for example associating this object with another object in o...
Definition rave_object.c:203
int RaveCoreObject_getRefCount(RaveCoreObject *src)
Returns the current reference count.
Definition rave_object.c:195
RaveCoreObject * RaveCoreObject_clone(RaveCoreObject *src, const char *filename, int lineno)
Creates a clone of the provided object by using the types copyconstructor (if there is any).
Definition rave_object.c:172
void RaveCoreObject_setTrackObjects(int track)
Will track object creation and destruction.
Definition rave_object.c:271
void RaveCoreObject_printCurrentObjectStatus(void)
Print current status of object creation.
Definition rave_object.c:239
#define RAVE_OBJECT_HEAD
Always should be at top of a struct that implements a RaveObject.
Definition rave_object.h:33
int RaveCoreObject_getTrackObjects(void)
Definition rave_object.c:280
void * RaveCoreObject_getBindingData(RaveCoreObject *src)
Returns the extra data.
Definition rave_object.c:222
void RaveCoreObject_unbind(RaveCoreObject *src, void *bindingData)
Removes the binding from the rave object.
Definition rave_object.c:214
RaveCoreObject * RaveCoreObject_copy(RaveCoreObject *src, const char *filename, int lineno)
Increments the reference counter and returns a pointer to the provided object.
Definition rave_object.c:164
The basic raveobject that contains the header information for all rave objects.
Definition rave_object.h:42
The rave object type definition.
Definition rave_object.h:52
size_t type_size
the size of the object, sizeof(type)
Definition rave_object.h:54
void(* destructor)(RaveCoreObject *obj)
function to be called for release of members in the object
Definition rave_object.h:56
int(* constructor)(RaveCoreObject *obj)
function to be called for initialization of the object
Definition rave_object.h:55
int(* copyconstructor)(RaveCoreObject *obj, RaveCoreObject *source)
Function when creating an clone.
Definition rave_object.h:57
const char * name
the name, for printout
Definition rave_object.h:53