OBJECT GETOBJECT()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

Get an object passed to a method


SYNONYM

None


SYNOPSIS

#include "dbapi.h"
 
OBJECT_GETOBJECT()
 
<input parameters>
none
 
<output parameters>
none


DESCRIPTION

The OBJECT_GETOBJECT() macro is used to return an object pointer to an object passed to a method.


EXAMPLE

The following example gets a pointer to the instantiated object passed to the set property method of the ObjValue property in a class called clsMyClass.

Example Recital program:

test = newobject("myclass")
// Instantiate an EXCEPTION object and assign it to the property ObjValue 
test.objvalue=newobject("exception")

Example in 'C' object:

#include "dbapi.h"
 
/* define set property method */
DEFINE_PROPERTYSET(clsMyClass, ObjValue) 
{
	struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
	OBJECT	objvalue;
	int		rc = OBJECT_ERROR;
 
	if (OBJECT_GETTYPE() == 'O') {
		objvalue = OBJECT_GETOBJECT(); 
		objectData->prop_objvalue = OBJECT_ASSIGN(objvalue, objectData->object_name);
		rc = OBJECT_SUCCESS;
	}
 
	return(rc);
}


SEE ALSO

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