gplinkvar, gplinkext - TDF variable link functions

SYNOPSIS

#include <gp.h>

VARP gplinkvar(set, var, start, count, name)
SETP set;
VARP var;
int start[], count[];
char *name;

VARP gplinkext(set, name, type, ndims, dim,
        path, datastart, contig, reclen)
SETP set;
char *name;
int type, ndims;
DIMP dim[];
char *path;
int datastart, contig, reclen;

DESCRIPTION

The functions described here define link variables, i.e., a variable whose data resides in a file other than the dataset in which the variable is defined. Links can exist within the same file, or across files.

gplinkvar creates a link variable in the dataset set. The data for the link variable comes from a hypercube subset of the variable var. If a non-NULL name is supplied, it is used as the name of the link variable.

The hypercube is parameterized by start and count, where start gives the origin of the hypercube, and count gives the lengths of the edges of the hypercube. See gpio.

Dimensions with the same names as the dimensions of var, and with sizes compatible with count, must already be defined in set.

gplinkext creates a link variable in the dataset set. The data for the link variable comes from a file with pathname path, which is generally not another TDF dataset file. path can be NULL, in which case the stored values of the link variable are assumed to be 0.

gplinkext requires the same input arguments as gpdefvar. See gpvar. 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.

datastart is the offset in the file denoted by path to the first data element of the link variable.

If contig is true, the data for the link variable is assumed to be stored contiguously. If contig is false, then the data for the link variable is assumed to satisfy

The offset between link variable elements (i,0,...,0) and (i+1,0,...0) is equal to a constant reclen.

Data for each set of link variable elements (i,*,...*) is contiguous.

RETURN VALUES

gplinkvar and gplinkext all return variable pointers if successful. Otherwise they call *gperr() with the appropriate error code and return NULL.

ERRORS

gplinkext can encounter almost any of the error codes for the UNIX function open. In addition, the following error codes apply for gplinkvar and gplinkext:

Insufficient memory to define new variable.

Invalid variable datatype used to define link variable.

Invalid number of variable dimensions used to define link variable.

Attempt to create variable in one dataset with dimensions in another dataset.

Hypercube has a side with length < 1.

Hypercube extends beyond variable dimension bounds.

Hypercube size does not match dimensions sizes in the output dataset.

Negative offsets datastart or reclen passed to gplinkext.

Variable with the same name already exists in the output dataset.

Dataset does not have dimension with given name.

Invalid set pointer passed by application.

Invalid variable pointer passed by application.

FILES

include/gp.h, /usr/include/errno.h, lib/libcdf.a

SEE ALSO

gpatt, gpdim, gperr, gpio, gpname, gprel, gpset, gptype, gpvar, datasets

NOTES

None.


Last Update: $Date: 2001/12/14 21:22:14 $