OBJECT DELETE()

From Recital Documentation Wiki
Revision as of 12:44, 27 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PURPOSE

Deletes an instantiated object


SYNONYM

None


SYNOPSIS

#include "dbapi.h"
 
OBJECT_DELETE(objptr)
 
<input parameters>
OBJECT	objptr;		/* Pointer to the object to be deleted	*/
 
<output parameters>
none


DESCRIPTION

The OBJECT_DELETE() macro is used to delete an instantiated object. The object must have been first instantiated with OBJECT_NEW() or assigned with OBJECT_ASSIGN().


EXAMPLE

The following example deletes an object that was assigned to the ObjValue property from the destructor method for the class clsMyClass.

Example Recital program:

test = newobject("myclass")
// The destructor is called when the object is released
release test

Example in 'C' object:

#include "dbapi.h"
 
DEFINE_METHOD(clsMyClass, Destructor) 
{
	struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
 
	if (objectData != NULL) {
		if (objectData->prop_objvalue != NULL) OBJECT_DELETE(objectData->prop_objvalue);
		free(objectData);
		objectData = NULL;
	}
	return(0);
}


SEE ALSO

DEFINE_CLASS(), DEFINE_METHOD(), DEFINE_PROPERTYGET(), DEFINE_PROPERTYSET(), DISPATCH_FACTORY(), DISPATCH_METHOD(), DISPATCH_PROPGET(), DISPATCH_PROPSET(), OBJECT_ASSIGN(), OBJECT_GETARG(), OBJECT_GETARGC(), OBJECT_GETDATA(), OBJECT_GETOBJECT(), OBJECT_GETPARAMETER(), OBJECT_GETPROPERTY(), OBJECT_GETTYPE(), OBJECT_GETVALUE(), OBJECT_NEW(), OBJECT_RETERROR(), OBJECT_RETPROPERTY(), OBJECT_RETRESULT(), OBJECT_SETARG(), OBJECT_SETDATA(), OBJECT_SETPROPERTY()