NetCDF  4.5.0
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 
30 int
32 {
33  free(vl->p);
34  return NC_NOERR;
35 }
36 
51 int
52 nc_free_vlens(size_t len, nc_vlen_t vlens[])
53 {
54  int ret;
55  size_t i;
56 
57  for(i = 0; i < len; i++)
58  if ((ret = nc_free_vlen(&vlens[i])))
59  return ret;
60 
61  return NC_NOERR;
62 }
63 
89 int
90 nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
91 {
92  NC* ncp;
93  int stat = NC_check_id(ncid,&ncp);
94  if(stat != NC_NOERR) return stat;
95  return ncp->dispatch->def_vlen(ncid,name,base_typeid,xtypep);
96 }
97 
117 int
118 nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
119 {
120  int class = 0;
121  int stat = nc_inq_user_type(ncid,xtype,name,datum_sizep,base_nc_typep,NULL,&class);
122  if(stat != NC_NOERR) return stat;
123  if(class != NC_VLEN) stat = NC_EBADTYPE;
124  return stat;
125 } /* End of named group ...*/
127 
147 int
148 nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, size_t len, const void *data)
149 {
150  NC* ncp;
151  int stat = NC_check_id(ncid,&ncp);
152  if(stat != NC_NOERR) return stat;
153  return ncp->dispatch->put_vlen_element(ncid,typeid1,vlen_element,len,data);
154 }
155 
175 int
176 nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element,
177  size_t *len, void *data)
178 {
179  NC *ncp;
180  int stat = NC_check_id(ncid,&ncp);
181  if(stat != NC_NOERR) return stat;
182  return ncp->dispatch->get_vlen_element(ncid, typeid1, vlen_element,
183  len, data);
184 }
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:52
int nc_type
The nc_type type is just an int.
Definition: netcdf.h:24
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:118
#define NC_VLEN
vlen (variable-length) types
Definition: netcdf.h:52
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:350
void * p
Pointer to VL data.
Definition: netcdf.h:663
int nc_free_vlen(nc_vlen_t *vl)
Free memory in a VLEN object.
Definition: dvlen.c:31
This is the type of arrays of vlens.
Definition: netcdf.h:661
#define NC_NOERR
No Error.
Definition: netcdf.h:308
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:90
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:135

Return to the Main Unidata NetCDF page.
Generated on Thu Oct 26 2017 08:14:39 for NetCDF. NetCDF is a Unidata library.