OBJECT ASSIGN()

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

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

PURPOSE

Assign a name to an instantiated object


SYNONYM

None


SYNOPSIS

#include "dbapi.h"
 
OBJECT_ASSIGN(objptr, objname)
 
<input parameters>
OBJECT	objptr;		/* Pointer to the object to assign name to	*/
char		*objname;	/* Name to assign to the object		*/
 
<output parameters>
none


DESCRIPTION

The OBJECT_ASSIGN() macro is used to assign a name to an instantiated object. You must assign a name to an object when it is passed as a value to set a property.


EXAMPLE

The following example instantiates an object from a system class EXCEPTION and assigns it to 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_DELETE(), 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()