In this file a description is given of the interface of user method functions. When creating your own user method class use the following as template. More...
Go to the source code of this file.
Functions | |
void | usr_meth_create_size (int *memsize, int *retval) |
Implementation that forms part of the create process. | |
void | usr_meth_create_init (Usr_Meth *objectdata, void *userdata, int *retval) |
Implementation that forms part of the create process. | |
void | usr_meth_run (Usr_Meth *objectdata, int *retval) |
Implementation for running user method. | |
void | usr_meth_free (Usr_Meth *objectdata, int *retval) |
Implementation for freeing the object data and associated resources. |
In this file a description is given of the interface of user method functions. When creating your own user method class use the following as template.
The Usr_Meth to which is being referred in this template can be substituted by your own user method object.
Step 1: for creating your own user method class call the function CTA_Meth_DefineClass().
Example:
typedef CTA_Handle CTA_MethClass; CTA_Func h_func[CTA_METH_NUMFUNC]; CTA_MethClass my_own_meth_class; ierr=CTA_Func_Create(" ",&usr_meth_create_size, hintf, &h_func[CTA_METH_CREATE_SIZE]); //...for all implementation functions... CTA_Meth_DefineClass("classname", h_func, &my_own_meth_class);
Making a user method class involves the implementation of the following functions:
CTA_METH_CREATE_SIZE
CTA_METH_CREATE_INIT
CTA_METH_RUN
CTA_METH_FREE
For creating an implementation function see documentation of CTA_Func_Create().
Step 2: to create an object of the newly defined method class call CTA_Meth_Create() in the same way as creating a CTA_Meth object but with a different class handle, i.e. the user class handle from step 1 above.
Example:
Usr_Meth usrmeth; //user method object CTA_Handle userdata = CTA_NULL; CTA_Meth_Create(my_own_meth_class, &userdata, &usrmeth);
Note 1: with object data is meant only the object itself including pointer(s) to its contents, but not the contents themselves.
Definition in file cta_usr_method.h.
void usr_meth_create_init | ( | Usr_Meth * | objectdata, | |
void * | userdata, | |||
int * | retval | |||
) |
Implementation that forms part of the create process.
The user method object needs to be made ready for use.
objectdata | I pointer to user method object data | |
userdata | IO user data | |
retval | O must receive return value of user implementation function |
void usr_meth_create_size | ( | int * | memsize, | |
int * | retval | |||
) |
Implementation that forms part of the create process.
Must give the memory size of a new method user object.
Example:
//in header file: typedef struct { //your own user object data goes here... }USR_METH; //user implementation: void usr_meth_create_size(...){ *memsize = sizeof(USR_METH); *retval = CTA_OK; }
memsize | O must receive the number of bytes which are necessary to store one user method class, with a pointer to the contents (data), but without the contents themselves | |
retval | O must receive return value of user implementation function |
void usr_meth_free | ( | Usr_Meth * | objectdata, | |
int * | retval | |||
) |
Implementation for freeing the object data and associated resources.
objectdata | I pointer to user method object data | |
retval | O must receive return value of user implementation function |
void usr_meth_run | ( | Usr_Meth * | objectdata, | |
int * | retval | |||
) |
Implementation for running user method.
objectdata | I pointer to user method object data | |
retval | O must receive return value of user implementation function |