|
SafeTypes2
|
The 'reference' type (container of a single externally-managed pointer). More...
#include "s2obj.h"Macros | |
| #define | s2_is_ref(obj) |
Functions | |
| T * | s2ref_create (void *ptr, s2ref_final_func_t finalizer) |
| Creates and returns an reference object. | |
| T * | s2ref_create_weakref (void *ptr) |
Creates a weak reference. Equivalent to s2ref_create(ptr, NULL). | |
| void * | s2ref_unwrap (T *ref) |
| retrieve the underlying pointer. | |
The 'reference' type (container of a single externally-managed pointer).
The purpose of this type is 2-fold:
| #define s2_is_ref | ( | obj | ) |
| obj | the object handle the type of which is being checked. |
| T * s2ref_create | ( | void * | ptr, |
| s2ref_final_func_t | finalizer ) |
Creates and returns an reference object.
| ptr | the pointer to wrap in the reference object. |
| finalizer | finalizes the underlying pointer. |
ptr - this way, the finalizers can be used in their existing form, without having to wrap them in subroutines that does nothing other than to retrieves ptr from the context structure, | void * s2ref_unwrap | ( | T * | ref | ) |
retrieve the underlying pointer.