int kgeom_define_primitive(
int primitive,
char *name,
int num_components,
kvalist)
Each component description should contain :
segment - string specifying the segment name in which the component will be stored.
required - TRUE if the component is required.
presentation - presentation function for this component. This function will be used to determine the size and data type of the component as determined by the current presentation attributes.
The presentation handler declaration is of the form :
int presentation_handler( kobject object, int primitive, char *segment, int **size, int *data_type)
Since all components are all considered to be at least two-dimensional, this routine should return a pointer to a static array of size two via the size argument. The second element of the size array is considered to be the number of "points" in the component, and the first element in the array is considered to be the size of the "point". The data type should be returned via the data_type argument. The object argument is passed from the calling get or put routine. The primitive and segment argument are carried down from this definition.
get - get function for this component. If NULL, a generic handler will be used which can cover most data handling. If special handling of the data is required, a customized function can be provided here for storing the data.
The get handler declaration is of the form :
kaddr get_handler( kobject obj, char *segment, int position, int component, int *pres_size, int data_type, int *size, int begin_point, kaddr data)
The object argument is passed from the calling get routine. The segment argument refers to the segment from which to retrieve the component data. The position argument is the current primitive's position in the primitive list. The component argument is the component number for this primitive. The pres_size and the data_type are the size and data type that was returned from the presentation function. The size and begin point reflect the stored manifest information showing where the component data is actually located in the segment. The begin point is the index marking the beginning a linear space along the dimension in which the points have been allocated. The generic handlers will assume this to be the second dimension. The data argument is an optionally pre-allocated array via which to return the data. If this argument is NULL, then the get_handler is responsible for allocating sufficient space. In either case, this handler should return the pointer to the retrieved data.
put - put function for this component. If NULL, a generic handler will be used which can cover most data handling. If special handling of the data is required, a customized function can be provided here for retrieving the data. This routine handles the allocation of the space in which to store the data.
The put handler declaration is of the form :
int put_handler( kobject object, char *segment, int position, int component, int *size, int data_type, int *begin_point) kaddr data)
The object argument is passed from the calling put routine. The segment argument refers to the segment in which to perform the allocation. The position argument is the primitive's position in the primitive list. The component argument is the component number for this primitive. The size and the data_type are the size and data type that was returned from the presentation function. The begin point returns the index marking the beginning a linear space along the dimension in which the points have been allocated. The generic handlers will assume this to be the second dimension. The data argument is the data being put. If the segment does not yet exist in the object, a kdms_create_segment call will be used.
none
none
none
$DATASERV/objects/library/koldgeom/src/geom_defin.c