Vuo
0.4.8
|
VuoHeap interface.
Macros | |
#define | VuoRegister(heapPointer, deallocate) VuoRegisterF(heapPointer, deallocate, __FILE__, __LINE__, __func__, #heapPointer); |
Registers heapPointer to be reference-counted and stores its deallocate function (unless heapPointer is null or is already being reference-counted). | |
Typedefs | |
typedef void(* | DeallocateFunctionType )(void *) |
A type for destructor functions, such as free(void *) , which are used to deallocate reference-counted memory when it's no longer in use. | |
Functions | |
void | VuoHeap_init (void) |
Initializes the reference-counting system. | |
void | VuoHeap_fini (void) |
Cleans up the reference-counting system. | |
int | VuoRegisterF (const void *heapPointer, DeallocateFunctionType deallocate, const char *file, unsigned int line, const char *func, const char *pointerName) |
Instead of this function, you probably want to use VuoRegister . | |
int | VuoRetain (const void *heapPointer) |
Increments the reference count for heapPointer (unless heapPointer is not being reference-counted). | |
int | VuoRelease (const void *heapPointer) |
Decrements the reference count for heapPointer (unless heapPointer is not being reference-counted). | |
const char * | VuoHeap_getDescription (const void *heapPointer) |
Returns a description of the specified heapPointer: the file, line, and function where VuoRegister() was called, and the variable name. | |
#define VuoRegister | ( | heapPointer, | |
deallocate | |||
) | VuoRegisterF(heapPointer, deallocate, __FILE__, __LINE__, __func__, #heapPointer); |
Registers heapPointer
to be reference-counted and stores its deallocate function (unless heapPointer
is null or is already being reference-counted).
heapPointer | A pointer to allocated memory on the heap. |
deallocate | The function to be used to deallocate the memory when the reference count gets back to its original value of 0. |
heapPointer
. This is 0 if heapPointer
is not already being reference-counted, greater than 0 if it is, or -1 if heapPointer
is null. void VuoHeap_fini | ( | void | ) |
Cleans up the reference-counting system.
To be called once, after all other reference-counting function calls.
const char* VuoHeap_getDescription | ( | const void * | heapPointer | ) |
Returns a description of the specified heapPointer:
the file, line, and function where VuoRegister()
was called, and the variable name.
The returned string is still owned by VuoHeap; you should not free it.
void VuoHeap_init | ( | void | ) |
Initializes the reference-counting system.
To be called once, before any other reference-counting function calls.
int VuoRegisterF | ( | const void * | heapPointer, |
DeallocateFunctionType | deallocate, | ||
const char * | file, | ||
unsigned int | line, | ||
const char * | func, | ||
const char * | pointerName | ||
) |
Instead of this function, you probably want to use VuoRegister
.
This function is used to implement the VuoRegister
macro.
Registers heapPointer
to be reference-counted and stores its deallocate function (unless heapPointer
is null or is already being reference-counted).
heapPointer | A pointer to allocated memory on the heap. |
deallocate | The function to be used to deallocate the memory when the reference count gets back to its original value of 0. |
file | The name of the file in which VuoRegister is called. |
line | The line in the file in which VuoRegister is called. |
func | The function in which VuoRegister is called. |
pointerName | The stringified pointer variable name. |
heapPointer
. This is 0 if heapPointer
is not already being reference-counted, greater than 0 if it is, or -1 if heapPointer
is null. int VuoRelease | ( | const void * | heapPointer | ) |
Decrements the reference count for heapPointer
(unless heapPointer
is not being reference-counted).
If the reference count becomes 0, heapPointer
is deallocated and is no longer reference-counted.
heapPointer | A pointer to allocated memory on the heap. |
heapPointer
, or -1 if heapPointer
is not being reference-counted, has never been retained, or is null. int VuoRetain | ( | const void * | heapPointer | ) |
Increments the reference count for heapPointer
(unless heapPointer
is not being reference-counted).
heapPointer | A pointer to allocated memory on the heap. |
heapPointer
, or -1 if heapPointer
is not being reference-counted or is null.