NetCDF 4.10.1
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
38int
39nc_free_vlens(size_t nelems, nc_vlen_t vlens[])
40{
41 int ret;
42 size_t i;
43
44 for(i = 0; i < nelems; i++)
45 if ((ret = nc_free_vlen(&vlens[i])))
46 return ret;
47
48 return NC_NOERR;
49}
50
59int
61{
62 free(vl->p);
63 return NC_NOERR;
64}
65
91int
92nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
93{
94 NC* ncp;
95 int stat = NC_check_id(ncid,&ncp);
96 if(stat != NC_NOERR) return stat;
97 return ncp->dispatch->def_vlen(ncid,name,base_typeid,xtypep);
98}
99
119int
120nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
121{
122 int class = 0;
123 int stat = nc_inq_user_type(ncid,xtype,name,datum_sizep,base_nc_typep,NULL,&class);
124 if(stat != NC_NOERR) return stat;
125 if(class != NC_VLEN) stat = NC_EBADTYPE;
126 return stat;
127}
128 /* End of named group ...*/
129
149int
150nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, size_t len, const void *data)
151{
152 NC* ncp;
153 int stat = NC_check_id(ncid,&ncp);
154 if(stat != NC_NOERR) return stat;
155 return ncp->dispatch->put_vlen_element(ncid,typeid1,vlen_element,len,data);
156}
157
177int
178nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element,
179 size_t *len, void *data)
180{
181 NC *ncp;
182 int stat = NC_check_id(ncid,&ncp);
183 if(stat != NC_NOERR) return stat;
184 return ncp->dispatch->get_vlen_element(ncid, typeid1, vlen_element,
185 len, data);
186}
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:92
int nc_free_vlen(nc_vlen_t *vl)
Free memory in a single VLEN object.
Definition dvlen.c:60
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:120
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:39
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:459
void * p
Pointer to VL data.
Definition netcdf.h:811
#define NC_VLEN
vlen (variable-length) types
Definition netcdf.h:53
#define NC_NOERR
No Error.
Definition netcdf.h:417
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:809