cta_usr_obs_desc.h File Reference

In this file a description is given of the interface of user observation descriptor functions. When creating your own user observation descriptor class use the following as template. More...

Go to the source code of this file.

Functions

void usr_obsdescr_create_size (int *memsize, int *retval)
 Implementation that forms part of the create process.
void usr_obsdescr_create_init (CTA_ObsDescr myhandle, Usr_ObsDescr *objectdata, void *userdata, int *retval)
 Implementation that forms part of the create process.
void usr_obsdescr_free (Usr_ObsDescr *objectdata, int *retval)
 Implementation for freeing the object data and associated resources.
void usr_obsdescr_get_properties (Usr_ObsDescr *objectdata, const char *key, CTA_Vector *properties, CTA_Datatype *datatype, int *retval)
 Implementation for gettings properties associated with given key.
void usr_obsdescr_get_keys (Usr_ObsDescr *objectdata, CTA_Vector *keys, int *retval)
 Implementation for getting all key names of user observation descriptor.
void usr_obsdescr_count_observations (Usr_ObsDescr *objectdata, int *nobs, int *retval)
 Implementation for counting number of observations.
void usr_obsdescr_count_properties (Usr_ObsDescr *objectdata, int *nkeys, int *retval)
 Implementation for counting number of properties.
void usr_obsdescr_export (Usr_ObsDescr *objectdata, void *userdata, int *retval)
 Implementation for exporting user observation descriptor.
void usr_obsdescr_createsel (Usr_ObsDescr *descr, CTA_String *selection, CTA_RelTable reltab, CTA_ObsDescr myhandle_out, Usr_ObsDescr *descrout, int *retval)
 Create a new observation description that is subset of existing observation description.

Detailed Description

In this file a description is given of the interface of user observation descriptor functions. When creating your own user observation descriptor class use the following as template.

The CTA_Usr_ObsDescr to which is being referred in this template can be substituted by your own user observation descriptor object.

Step 1: for creating your own user model class call the function CTA_Model_DefineClass().

Example:

typedef CTA_Handle CTA_ObsDescrClass;

CTA_Func h_func[CTA_OBSDESCR_NUMFUNC];
CTA_ObsDescrClass my_own_obsdescr_class;

ierr=CTA_Func_Create(" ",&usr_obsdescr_create_size, hintf, &h_func[CTA_OBSDESCR_CREATE_SIZE]);
//...for all implementation functions...

CTA_ObsDescr_DefineClass("classname", h_func, &my_own_obsdescr_class);

Making a new observation descriptor class involves the implementation of the following functions:

CTA_OBSDESCR_CREATE_SIZE
CTA_OBSDESCR_CREATE_INIT
CTA_OBSDESCR_FREE
CTA_OBSDESCR_GET_PROPERTIES
CTA_OBSDESCR_GET_KEYS
CTA_OBSDESCR_COUNT_OBSERVATIONS
CTA_OBSDESCR_COUNT_PROPERTIES
CTA_OBSDESCR_EXPORT

For creating an implementation function see documentation of CTA_Func_Create().

Step 2: to create an object of the newly defined observation descriptor class call CTA_ObsDescr_Create() in the same way as creating a CTA_ObsDescr object but with a different class handle, i.e. the user class handle from step 1 above.

Example:

Usr_ObsDescr usrobsdescr; //user observation descriptor object
CTA_Handle userdata = CTA_NULL;
CTA_ObsDescr_Create(my_own_obsdescr_class, &userdata, &usrobsdescr);


Note 1: with object data is meant only the object itself including pointer(s) to its contents, but not the contents of the observation descriptor.

Definition in file cta_usr_obs_desc.h.


Function Documentation

void usr_obsdescr_count_observations ( Usr_ObsDescr *  objectdata,
int *  nobs,
int *  retval 
)

Implementation for counting number of observations.

Note:
At index CTA_OBSDESCR_COUNT_OBSERVATIONS in the function list of the class descriptor.
Parameters:
objectdata I pointer to object data of user stochastic observer
nobs O must receive number of observations
retval O must receive return value of user implementation function
Returns:
no return value
void usr_obsdescr_count_properties ( Usr_ObsDescr *  objectdata,
int *  nkeys,
int *  retval 
)

Implementation for counting number of properties.

Note:
At index CTA_OBSDESCR_COUNT_PROPERTIES in the function list of the class descriptor.
Parameters:
objectdata I pointer to object data of user stochastic observer
nkeys O must receive number of property keys
retval O must receive return value of user implementation function
Returns:
no return value
void usr_obsdescr_create_init ( CTA_ObsDescr  myhandle,
Usr_ObsDescr *  objectdata,
void *  userdata,
int *  retval 
)

Implementation that forms part of the create process.

The user observation descriptor object needs to be made ready for use.

Note:
At index CTA_OBSDESCR_CREATE_INIT in the function list of the class descriptor.
Parameters:
myhandle I Handle assigned by COSTA
objectdata I pointer to object data of user stochastic observer
userdata IO user data
retval O must receive return value of user implementation function
Returns:
no return value
void usr_obsdescr_create_size ( int *  memsize,
int *  retval 
)

Implementation that forms part of the create process.

Must give the memory size of a new object.

Example:

//in header file:
typedef struct {
   //your own user object data goes here...
}USR_OBSDESCR;

//user implementation:
void usr_obsdescr_create_size(...){
   *memsize = sizeof(USR_OBSDESCR);
   *retval = CTA_OK;
}
Note:
At index CTA_OBSDESCR_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 stochastic observer 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_obsdescr_createsel ( Usr_ObsDescr *  descr,
CTA_String selection,
CTA_RelTable  reltab,
CTA_ObsDescr  myhandle_out,
Usr_ObsDescr *  descrout,
int *  retval 
)

Create a new observation description that is subset of existing observation description.

Parameters:
objectdata I object data of observation description of the initial observation description insntance
selection I selection criterion (subset of SQL)
reltab O Relation table specifying the relation between the original and new observation description component. Note no relation table is created when reltab==CTA_NULL on enty
objectdata_out O new observation description created subset
retval O receives return value
void usr_obsdescr_export ( Usr_ObsDescr *  objectdata,
void *  userdata,
int *  retval 
)

Implementation for exporting user observation descriptor.

Note:
At index CTA_OBSDESCR_EXPORT in the function list of the class descriptor.
Parameters:
objectdata I pointer to object data of user stochastic observer
userdata IO user data
retval O must receive return value of user implementation function
Returns:
no return value
void usr_obsdescr_free ( Usr_ObsDescr *  objectdata,
int *  retval 
)

Implementation for freeing the object data and associated resources.

Note:
At index CTA_OBSDESCR_FREE in the function list of the class descriptor.
Parameters:
objectdata I pointer to object data of user stochastic observer
retval O must receive return value of user implementation function
Returns:
no return value
void usr_obsdescr_get_keys ( Usr_ObsDescr *  objectdata,
CTA_Vector keys,
int *  retval 
)

Implementation for getting all key names of user observation descriptor.

Note:
At index CTA_OBSDESCR_GET_KEYS in the function list of the class descriptor.
Parameters:
objectdata I pointer to object data of user stochastic observer
keys O handle vector that must receive key descriptions; must exist before calling
retval O must receive return value of user implementation function
Returns:
no return value
void usr_obsdescr_get_properties ( Usr_ObsDescr *  objectdata,
const char *  key,
CTA_Vector properties,
CTA_Datatype datatype,
int *  retval 
)

Implementation for gettings properties associated with given key.

Note:
At index CTA_OBSDESCR_GET_PROPERTIES in the function list of the class descriptor.
Parameters:
objectdata I pointer to object data of user stochastic observer
key I description of property key
properties O vector that must receive properties associated with given key; must exist before calling
datatype I data type of elements in properties vector
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