cta_usr_method.h File Reference

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.

Detailed Description

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.


Function Documentation

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.

Note:
At index CTA_METH_CREATE_INIT in the function list of the class descriptor.
Parameters:
objectdata I pointer to user method object data
userdata IO user data
retval O must receive return value of user implementation function
Returns:
no return value
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;
}
Note:
At index CTA_METH_CREATE_SIZE in the function list of the class descriptor.
Parameters:
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
Returns:
no return value
void usr_meth_free ( Usr_Meth *  objectdata,
int *  retval 
)

Implementation for freeing the object data and associated resources.

Note:
At index CTA_METH_FREE in the function list of the class descriptor.
Parameters:
objectdata I pointer to user method object data
retval O must receive return value of user implementation function
Returns:
no return value
void usr_meth_run ( Usr_Meth *  objectdata,
int *  retval 
)

Implementation for running user method.

Note:
At index CTA_METH_RUN in the function list of the class descriptor.
Parameters:
objectdata I pointer to user method object data
retval O must receive return value of user implementation function
Returns:
no return value

Generated on 4 Mar 2014 for OpenDA by  doxygen 1.6.1