Difference between revisions of "DEFINE CLASS()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 58: Line 58:
 
DISPATCH_METHOD(clsMyClass, Destructor);
 
DISPATCH_METHOD(clsMyClass, Destructor);
 
}
 
}
 +
</code>
 +
  
 
==SEE ALSO==
 
==SEE ALSO==

Revision as of 12:52, 27 March 2009

PURPOSE

A macro to define a class


SYNONYM

None


SYNOPSIS

#include "dbapi.h"
 
DEFINE_CLASS(classname)
 
<input parameters>
constant		classname;	/* Class name 	*/
 
<output parameters>
none


DESCRIPTION

The DEFINE_CLASS() macro is used to define a class that can be accessed from the Recital 4GL. This class needs to be added to the API_SHARED_FUNCTION_TABLE data structure which is loaded dynamically when Recital is started.


EXAMPLE

The following example defines a class called clsMyClass and defines some dispatch methods.

Example Recital program:

// The constructor is called when the object is created
test = newobject("myclass") 
? type("test")

</code>

Example in 'C' object:

#include "dbapi.h"
 
static	struct	API_SHARED_FUNCTION_TABLE api_function_table[2] = {
	{"myclass", "clsMyClass",		API_CLASS},
	{NULL,		NULL,			-1}
} ;
 
DEFINE_CLASS(clsMyClass)
{
	/* Dispatch factory methods and return */
	DISPATCH_FACTORY();
 
	/* Dispatch constructor and return */
	DISPATCH_METHOD(clsMyClass, Constructor);
 
	/* Dispatch destructor and return */
	DISPATCH_METHOD(clsMyClass, Destructor);
}


SEE ALSO

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_GETOBJECT(), OBJECT_GETPARAMETER(), OBJECT_GETPROPERTY(), OBJECT_GETTYPE(), OBJECT_GETVALUE(), OBJECT_NEW(), OBJECT_RETERROR(), OBJECT_RETPROPERTY(), OBJECT_RETRESULT(), OBJECT_SETARG(), OBJECT_SETDATA(), OBJECT_SETPROPERTY()</code>