cta_interface.h File Reference

Description of the COSTA interface componennt used for communication with user implementation classes. More...

#include "cta_system.h"
#include "cta_datatypes.h"
#include "cta_handles.h"

Go to the source code of this file.

Functions

CTAEXPORT int CTA_Intf_Create (const char *name, const CTA_Datatype *argtyp, const int narg, CTA_Intf *hintf)
 Create a new interface.
CTAEXPORT int CTA_Intf_Free (CTA_Intf *hintf)
 Free an interface.
CTAEXPORT int CTA_Intf_Match_aa (const CTA_Datatype *argtyp1, const int narg1, const CTA_Datatype *argtyp2, const int narg2, BOOL *flag)
 Match two interfaces for compatibility argumentlist-argumentlist.
CTAEXPORT int CTA_Intf_Match_ha (const CTA_Intf hintf1, const CTA_Datatype *argtyp2, const int narg2, BOOL *flag)
 Match two interfaces for compatibility handle-argumentlist.
CTAEXPORT int CTA_Intf_Match_hh (const CTA_Intf hintf1, const CTA_Intf hintf2, BOOL *flag)
 Match two interfaces for compatibility handle-handle.

Variables

CTAEXPORT typedef int CTA_Intf

Detailed Description

Description of the COSTA interface componennt used for communication with user implementation classes.

To create an object of your user implementation go through the following steps:

1: Create a new class (=implementation) of a COSTA component by calling the appropriate DefineClass() function providing the name of the class, a matrix with CTA_Function objects describing the user functions.

example:

void Usr_Object_initialise(CTA_MatClass *hmatcl){ CTA_Intf hintf=0;
CTA_Func h_func[CTA_MATRIX_NUMFUNC];
CTA_Func h_create_size;
CTA_Func h_Create_Init;
int ierr;

ierr=CTA_Func_Create(" ",&CTAI_Matrix_Create_Size, hintf,&h_func[CTA_MATRIX_CREATE_SIZE]);
ierr=CTA_Func_Create(" ",&CTAI_Matrix_Create_Init, hintf,&h_func[CTA_MATRIX_CREATE_INIT]);
ierr=CTA_Func_Create(" ",&CTAI_Matrix_getvals, hintf,&h_func[CTA_MATRIX_GETVALS] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_getval, hintf,&h_func[CTA_MATRIX_GETVAL] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_setcol, hintf,&h_func[CTA_MATRIX_SETCOL] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_setvals, hintf,&h_func[CTA_MATRIX_SETVALS] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_setval, hintf,&h_func[CTA_MATRIX_SETVAL] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_setconst, hintf,&h_func[CTA_MATRIX_SETCONST] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_Export, hintf,&h_func[CTA_MATRIX_EXPORT] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_Ger, hintf,&h_func[CTA_MATRIX_GER] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_Inv, hintf,&h_func[CTA_MATRIX_INV] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_Gemv, hintf,&h_func[CTA_MATRIX_GEMV] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_Gemm, hintf,&h_func[CTA_MATRIX_GEMM] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_Axpy, hintf,&h_func[CTA_MATRIX_AXPY] );
ierr=CTA_Func_Create(" ",&CTAI_Matrix_free, hintf,&h_func[CTA_MATRIX_FREE] );

ierr=CTA_Object_DefineClass("cta_matrix_blas",h_func,hmatcl);
}

2: use the resulting class object for creating the user object in following way:

int CTA_Matrix_Create(classobject, ..., *userdata, Usr_Object *usrObject);

Definition in file cta_interface.h.


Function Documentation

CTAEXPORT int CTA_Intf_Create ( const char *  name,
const CTA_Datatype argtyp,
const int  narg,
CTA_Intf hintf 
)

Create a new interface.

Parameters:
name I name of the new interface
argtyp I list with the data types of arguments
narg I number of arguments of interface
hintf O receives the new COSTA interface handle
Returns:
error status: CTA_OK
CTAEXPORT int CTA_Intf_Free ( CTA_Intf hintf  ) 

Free an interface.

Note:
Freeing CTA_NULL is allowed.
Parameters:
hintf IO handle of interface, replaced by CTA_NULL on return
Returns:
error status: CTA_OK, CTA_ILLEGAL_HANDLE, CTA_INCOMPATIBLE_HANDLE
CTAEXPORT int CTA_Intf_Match_aa ( const CTA_Datatype argtyp1,
const int  narg1,
const CTA_Datatype argtyp2,
const int  narg2,
BOOL *  flag 
)

Match two interfaces for compatibility argumentlist-argumentlist.

Note:
Two interfaces are compatible if all arguments have the same datatype, CTA_VOID is compatible with all other arguments except for CTA_FSTRING
Parameters:
argtyp1 I list with the data types of arguments of first interface
narg1 I number of arguments in first interface
argtyp2 I list with the data types of arguments of second interface
narg2 I number of arguments in second interface
flag O receives TRUE if interfaces are compatible FALSE ortherwise
Returns:
error status: CTA_OK
CTAEXPORT int CTA_Intf_Match_ha ( const CTA_Intf  hintf1,
const CTA_Datatype argtyp2,
const int  narg2,
BOOL *  flag 
)

Match two interfaces for compatibility handle-argumentlist.

Note:
Two interfaces are compatible if all arguments have the same datatype, CTA_VOID is compatible with all other arguments except for CTA_FSTRING
Parameters:
hintf1 I handle of first interface
argtyp2 I list with the data types of arguments of second interface
narg2 I number of arguments in second interface
flag O receives TRUE if interfaces are compatible FALSE ortherwise
Returns:
error status: CTA_OK, CTA_ILLEGAL_HANDLE, CTA_INCOMPATIBLE_HANDLE
CTAEXPORT int CTA_Intf_Match_hh ( const CTA_Intf  hintf1,
const CTA_Intf  hintf2,
BOOL *  flag 
)

Match two interfaces for compatibility handle-handle.

Note:
two interfaces are compatible if all arguments have the same datatype, CTA_VOID is compatible with all other arguments except for CTA_FSTRING
Parameters:
hintf1 I handle of first interface
hintf2 I handle of second interface
flag O receives TRUE if interfaces are compatible FALSE ortherwise
Returns:
error status: CTA_OK, CTA_ILLEGAL_HANDLE, CTA_INCOMPATIBLE_HANDLE

Variable Documentation

CTAEXPORT typedef int CTA_Intf

Definition at line 71 of file cta_interface.h.

Referenced by usr_SP_Model_CreateFunc().


Generated on 4 Mar 2014 for OpenDA by  doxygen 1.6.1