#include <gp.h> VARP gpdefvar(set, name, type, ndims, dim) SETP set; char *name; int type, ndims; DIMP dim[]; VARP gpvar(set, name) SETP set; char *name; VARP gpclonevar(set, var, name) SETP set; VARP var; char *name; int gpdelvar(var) VARP var;
The functions described here manipulate TDF variables.
gpdefvar defines a variable in the dataset indicated by set. name must have length no greater than GP_MAX_NAME. If set already has a variable with the same name, an error occurs.
type must be any of the valid types defined in include/gp.h. ndims must be greater than 0, but no greater than GP_VAR_DIMS. dim[] is an array of dimensions for the new variable.
gpvar returns the pointer to a variable with a given name in a given dataset.
gpclonevar defines a new variable similar to the existing variable var in the dataset indicated by set. The new variable will have the same datatype, attributes, and named dimensions as var. If a non-NULL name is passed, it will be used as the name of the new variable.
The dimension sizes of the new variable do have to match the dimension sizes of var. The dimensions of the new variable must already be defined in set.
gpdelvar deletes a variable from the dataset to which it belongs. A variable cannot be deleted if it is involved in relations or is associated with a given dimension, i.e., dim->var = var.
gpdefvar, gpvar, and gpclonevar all return variable pointers if successful. Otherwise they call *gperr() with the appropriate error code and return NULL.
gpdelvar returns 0 if successful. Otherwise it calls *gperr() with the appropriate error code and returns -1.
Insufficient memory to define new variable.
Invalid variable datatype.
Invalid number of variable dimensions.
Attempt to create variable in one dataset with dimensions in another dataset.
Attempt to create variable with a growing dimension other than the leading dimension.
Variable with the same name already exists in the output dataset.
Variable still involved in relation or associated with dimension.
Dataset does not have variable with given name.
Invalid set pointer passed by application.
Invalid variable pointer passed by application.
include/gp.h, /usr/include/errno.h, lib/libcdf.a
gpatt, gpdim, gperr, gpio, gplink, gpname, gprel, gpset, gptype, datasets
None.
Last Update: $Date: 2001/12/14 21:23:29 $