Pajdeg
0.2.2
Pajdeg
|
The generic Pajdeg object type. More...
Files | |
file | PDType.h |
Macros | |
#define | PDReleaseFunc PDRelease |
#define | PDDebugBeginSession() |
#define | PDDebugEndSession() 0 |
#define | PDFlagGlobalObject(ob) |
Functions | |
void | PDRelease (void *pajdegObject) |
void * | PDRetain (void *pajdegObject) |
void * | PDAutorelease (void *pajdegObject) |
PDInstanceType | PDResolve (void *pajdegObject) |
const char * | PDDescription (void *pajdegObject) |
The generic Pajdeg object type.
PDType provides the release and retain functionality to Pajdeg objects.
PD
is always a Pajdeg object, and can be retained and released, whereas objects using underscore separation in all lower case are non-Pajdeg objects (used by the Pajdeg system), such as pd_btree. The exception to this is primitive objects, such as PDInteger, PDBool, etc., and PDType itself.Releasing and retaining is a method for structuring memory management, and is used e.g. in Objective-C and other languages. The concept is fairly straightforward:
There are also instances where an object will become invalid in the middle of a function body, if it is released and has no pending autorelease calls.
For example, the following code snippet shows how this works:
The PDPipe
object is retained because the function name has the word Create
in it, so it must be released.
The PDParser
is not retained, as we obtained it through a function whose name did not contain Create
– consequently, the parser
variable must not be released as we don't own a reference to it.
The meta
object must be released by us, as it has the word Create
.
void* PDAutorelease | ( | void * | pajdegObject | ) |
Autorelease a Pajdeg object.
Even if the caller was the last referrer, the object will not be destroyed until the PDPipeExecute() iteration for the current object has ended.
Thus, it is possible to return an object with a zero retain count by autoreleasing it.
pajdegObject | The object that should, at some point, be released once. |
const char* PDDescription | ( | void * | pajdegObject | ) |
Generate a description of the given object as a C string. The description is generated via the PDInstancePrinters entry for the resolved instance type of the object.
pajdegObject | Object whose C string description should be generated |
void PDRelease | ( | void * | pajdegObject | ) |
Release a Pajdeg object.
If the caller was the last referrer, the object will be destroyed immediately.
pajdegObject | A previously retained or created PD object. |
PDInstanceType PDResolve | ( | void * | pajdegObject | ) |
Resolve the PDInstanceType of the given object.
pajdegObject | The object whose type should be resolved |
void* PDRetain | ( | void * | pajdegObject | ) |
Retain a Pajdeg object.
pajdegObject | A PD object. |