NetCDF  4.8.1
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 
40 int
42 {
43  free(vl->p);
44  return NC_NOERR;
45 }
46 
71 int
72 nc_free_vlens(size_t len, nc_vlen_t vlens[])
73 {
74  int ret;
75  size_t i;
76 
77  for(i = 0; i < len; i++)
78  if ((ret = nc_free_vlen(&vlens[i])))
79  return ret;
80 
81  return NC_NOERR;
82 }
83 
109 int
110 nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
111 {
112  NC* ncp;
113  int stat = NC_check_id(ncid,&ncp);
114  if(stat != NC_NOERR) return stat;
115  return ncp->dispatch->def_vlen(ncid,name,base_typeid,xtypep);
116 }
117 
137 int
138 nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
139 {
140  int class = 0;
141  int stat = nc_inq_user_type(ncid,xtype,name,datum_sizep,base_nc_typep,NULL,&class);
142  if(stat != NC_NOERR) return stat;
143  if(class != NC_VLEN) stat = NC_EBADTYPE;
144  return stat;
145 } /* End of named group ...*/
147 
167 int
168 nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, size_t len, const void *data)
169 {
170  NC* ncp;
171  int stat = NC_check_id(ncid,&ncp);
172  if(stat != NC_NOERR) return stat;
173  return ncp->dispatch->put_vlen_element(ncid,typeid1,vlen_element,len,data);
174 }
175 
195 int
196 nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element,
197  size_t *len, void *data)
198 {
199  NC *ncp;
200  int stat = NC_check_id(ncid,&ncp);
201  if(stat != NC_NOERR) return stat;
202  return ncp->dispatch->get_vlen_element(ncid, typeid1, vlen_element,
203  len, data);
204 }
NC_NOERR
#define NC_NOERR
No Error.
Definition: netcdf.h:333
nc_vlen_t
This is the type of arrays of vlens.
Definition: netcdf.h:703
nc_def_vlen
int nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
Definition: dvlen.c:110
nc_inq_user_type
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)
Definition: dtype.c:146
NC_VLEN
#define NC_VLEN
vlen (variable-length) types
Definition: netcdf.h:53
nc_vlen_t::p
void * p
Pointer to VL data.
Definition: netcdf.h:705
nc_free_vlens
int nc_free_vlens(size_t len, nc_vlen_t vlens[])
Definition: dvlen.c:72
nc_type
int nc_type
The nc_type type is just an int.
Definition: netcdf.h:25
NC_EBADTYPE
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:375
nc_free_vlen
int nc_free_vlen(nc_vlen_t *vl)
Definition: dvlen.c:41
nc_inq_vlen
int nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
Definition: dvlen.c:138