NetCDF 4.9.3
Loading...
Searching...
No Matches
dvlen.c
Go to the documentation of this file.
1
6
7#include "ncdispatch.h"
8 /* All these functions are part of this named group... */
13
39int
40nc_free_vlens(size_t nelems, nc_vlen_t vlens[])
41{
42 int ret;
43 size_t i;
44
45 for(i = 0; i < nelems; i++)
46 if ((ret = nc_free_vlen(&vlens[i])))
47 return ret;
48
49 return NC_NOERR;
50}
51
60int
62{
63 free(vl->p);
64 return NC_NOERR;
65}
66
92int
93nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
94{
95 NC* ncp;
96 int stat = NC_check_id(ncid,&ncp);
97 if(stat != NC_NOERR) return stat;
98 return ncp->dispatch->def_vlen(ncid,name,base_typeid,xtypep);
99}
100
120int
121nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
122{
123 int class = 0;
124 int stat = nc_inq_user_type(ncid,xtype,name,datum_sizep,base_nc_typep,NULL,&class);
125 if(stat != NC_NOERR) return stat;
126 if(class != NC_VLEN) stat = NC_EBADTYPE;
127 return stat;
128}
129 /* End of named group ...*/
130
150int
151nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, size_t len, const void *data)
152{
153 NC* ncp;
154 int stat = NC_check_id(ncid,&ncp);
155 if(stat != NC_NOERR) return stat;
156 return ncp->dispatch->put_vlen_element(ncid,typeid1,vlen_element,len,data);
157}
158
178int
179nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element,
180 size_t *len, void *data)
181{
182 NC *ncp;
183 int stat = NC_check_id(ncid,&ncp);
184 if(stat != NC_NOERR) return stat;
185 return ncp->dispatch->get_vlen_element(ncid, typeid1, vlen_element,
186 len, data);
187}
int nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
Use this function to define a variable length array type.
Definition dvlen.c:93
int nc_free_vlen(nc_vlen_t *vl)
Free memory in a single VLEN object.
Definition dvlen.c:61
int nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
Learn about a VLEN type.
Definition dvlen.c:121
int nc_free_vlens(size_t nelems, nc_vlen_t vlens[])
Free an array of vlens given the number of elements and an array.
Definition dvlen.c:40
EXTERNL int nc_inq_user_type(int ncid, nc_type xtype, char *name, size_t *size, nc_type *base_nc_typep, size_t *nfieldsp, int *classp)
Learn about a user defined type.
Definition dtype.c:146
#define NC_EBADTYPE
Not a netcdf data type.
Definition netcdf.h:420
void * p
Pointer to VL data.
Definition netcdf.h:763
#define NC_VLEN
vlen (variable-length) types
Definition netcdf.h:53
#define NC_NOERR
No Error.
Definition netcdf.h:378
int nc_type
The nc_type type is just an int.
Definition netcdf.h:25
This is the type of arrays of vlens.
Definition netcdf.h:761