NetCDF  4.9.2
dvlen.c
Go to the documentation of this file.
1 
7 #include "ncdispatch.h"
8  /* All these functions are part of this named group... */
13 
42 int
44 {
45  free(vl->p);
46  return NC_NOERR;
47 }
48 
76 int
77 nc_free_vlens(size_t len, nc_vlen_t vlens[])
78 {
79  int ret;
80  size_t i;
81 
82  for(i = 0; i < len; i++)
83  if ((ret = nc_free_vlen(&vlens[i])))
84  return ret;
85 
86  return NC_NOERR;
87 }
88 
114 int
115 nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
116 {
117  NC* ncp;
118  int stat = NC_check_id(ncid,&ncp);
119  if(stat != NC_NOERR) return stat;
120  return ncp->dispatch->def_vlen(ncid,name,base_typeid,xtypep);
121 }
122 
142 int
143 nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
144 {
145  int class = 0;
146  int stat = nc_inq_user_type(ncid,xtype,name,datum_sizep,base_nc_typep,NULL,&class);
147  if(stat != NC_NOERR) return stat;
148  if(class != NC_VLEN) stat = NC_EBADTYPE;
149  return stat;
150 } /* End of named group ...*/
152 
172 int
173 nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, size_t len, const void *data)
174 {
175  NC* ncp;
176  int stat = NC_check_id(ncid,&ncp);
177  if(stat != NC_NOERR) return stat;
178  return ncp->dispatch->put_vlen_element(ncid,typeid1,vlen_element,len,data);
179 }
180 
200 int
201 nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element,
202  size_t *len, void *data)
203 {
204  NC *ncp;
205  int stat = NC_check_id(ncid,&ncp);
206  if(stat != NC_NOERR) return stat;
207  return ncp->dispatch->get_vlen_element(ncid, typeid1, vlen_element,
208  len, data);
209 }
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:115
int nc_free_vlen(nc_vlen_t *vl)
Free memory in a VLEN object.
Definition: dvlen.c:43
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:143
int nc_free_vlens(size_t len, nc_vlen_t vlens[])
Free an array of vlens given the number of elements and an array.
Definition: dvlen.c:77
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:410
void * p
Pointer to VL data.
Definition: netcdf.h:748
#define NC_VLEN
vlen (variable-length) types
Definition: netcdf.h:53
#define NC_NOERR
No Error.
Definition: netcdf.h:368
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:746