RAVE
|
Generic implementation of an object that is used within rave. More...
#include "rave_object.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include <stdio.h>
Classes | |
struct | _heapobject |
Heap structure when allocating rave objects. More... | |
Typedefs | |
typedef struct _heapobject | heapobject |
Heap structure when allocating rave objects. | |
Functions | |
RaveCoreObject * | RaveCoreObject_new (RaveCoreObjectType *type, const char *filename, int lineno) |
Creates a new instance of the provided type. | |
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 when creating the instance will be called. | |
RaveCoreObject * | RaveCoreObject_copy (RaveCoreObject *src, const char *filename, int lineno) |
Increments the reference counter and returns a pointer to the provided object. | |
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). | |
int | RaveCoreObject_getRefCount (RaveCoreObject *src) |
Returns the current reference count. | |
void | RaveCoreObject_bind (RaveCoreObject *src, void *bindingData) |
Sets the binding data field, useful when for example associating this object with another object in order to manage objects from python or other languages. | |
void | RaveCoreObject_unbind (RaveCoreObject *src, void *bindingData) |
Removes the binding from the rave object. | |
void * | RaveCoreObject_getBindingData (RaveCoreObject *src) |
Returns the extra data. | |
int | RaveCoreObject_isCloneable (RaveCoreObject *src) |
Returns if this object is possible to clone or not. | |
void | RaveCoreObject_printCurrentObjectStatus (void) |
Print current status of object creation. | |
void | RaveCoreObject_printStatistics (void) |
Prints the rave object statistics. | |
void | RaveCoreObject_setTrackObjects (int track) |
Will track object creation and destruction. | |
int | RaveCoreObject_getTrackObjects (void) |
Generic implementation of an object that is used within rave.
All objects should use this as template for their structure.
typedef struct _heapobject heapobject |
Heap structure when allocating rave objects.
void RaveCoreObject_bind | ( | RaveCoreObject * | src, |
void * | bindingData ) |
Sets the binding data field, useful when for example associating this object with another object in order to manage objects from python or other languages.
Do not use this function directly but use the macros for binding instead.
[in] | src | - this object |
[in] | bindingData | - the associated object (or similar) |
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).
[in] | src | - the object to be cloned |
[in] | filename | - the filename that this operation was performed in |
[in] | lineno | - the linenumber that this operation was performed in |
RaveCoreObject * RaveCoreObject_copy | ( | RaveCoreObject * | src, |
const char * | filename, | ||
int | lineno ) |
Increments the reference counter and returns a pointer to the provided object.
[in] | src | - the object to be copied |
[in] | filename | - the filename that this operation was performed in |
[in] | lineno | - the linenumber that this operation was performed in |
void * RaveCoreObject_getBindingData | ( | RaveCoreObject * | src | ) |
Returns the extra data.
Do not use this function directly but use the macros for binding objects instead.
[in] | src | - this object |
int RaveCoreObject_getRefCount | ( | RaveCoreObject * | src | ) |
Returns the current reference count.
[in] | src | - the the object that should be queried for reference count |
int RaveCoreObject_getTrackObjects | ( | void | ) |
int RaveCoreObject_isCloneable | ( | RaveCoreObject * | src | ) |
Returns if this object is possible to clone or not.
[in] | src | - the rave core object |
RaveCoreObject * RaveCoreObject_new | ( | RaveCoreObjectType * | type, |
const char * | filename, | ||
int | lineno ) |
Creates a new instance of the provided type.
[in] | type | - the object type |
[in] | filename | - the filename that this allocation was performed in |
[in] | lineno | - the linenumber that this allocation was performed in |
void RaveCoreObject_printCurrentObjectStatus | ( | void | ) |
Print current status of object creation.
void RaveCoreObject_printStatistics | ( | void | ) |
Prints the rave object statistics.
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 when creating the instance will be called.
Note, regardless on if and how the destructor has been implemented, the object will be freed.
[in] | obj | - the object to release (including the object itself) |
[in] | filename | - the filename that this operation was performed in |
[in] | lineno | - the linenumber that this operation was performed in |
void RaveCoreObject_setTrackObjects | ( | int | track | ) |
Will track object creation and destruction.
[in] | track | - if object creation / destruction should be tracked |
void RaveCoreObject_unbind | ( | RaveCoreObject * | src, |
void * | bindingData ) |
Removes the binding from the rave object.
Do not use this function directly but use the macros for binding instead. If bindingData != the stored binding data nothing will happen.
[in] | src | - this object |
[in] | bindingData | - the binding to remove |