NetCDF  4.8.1
denum.c
Go to the documentation of this file.
1 
7 #include "ncdispatch.h"
8  /* All these functions are part of this named group... */
12 
42 int
43 nc_def_enum(int ncid, nc_type base_typeid, const char *name, nc_type *typeidp)
44 {
45  NC* ncp;
46  int stat = NC_check_id(ncid,&ncp);
47  if(stat != NC_NOERR) return stat;
48  return ncp->dispatch->def_enum(ncid,base_typeid,name,typeidp);
49 }
50 
70 int
71 nc_insert_enum(int ncid, nc_type xtype, const char *name,
72  const void *value)
73 {
74  NC *ncp;
75  int stat = NC_check_id(ncid, &ncp);
76  if(stat != NC_NOERR) return stat;
77  return ncp->dispatch->insert_enum(ncid, xtype, name,
78  value);
79 }
80 
106 int
107 nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep,
108  size_t *base_sizep, size_t *num_membersp)
109 {
110  int class = 0;
111  int stat = nc_inq_user_type(ncid, xtype, name, base_sizep,
112  base_nc_typep, num_membersp, &class);
113  if(stat != NC_NOERR) return stat;
114  if(class != NC_ENUM) stat = NC_EBADTYPE;
115  return stat;
116 }
117 
139 int
140 nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name,
141  void *value)
142 {
143  NC *ncp;
144  int stat = NC_check_id(ncid, &ncp);
145  if(stat != NC_NOERR) return stat;
146  return ncp->dispatch->inq_enum_member(ncid, xtype, idx, name, value);
147 }
148 
167 int
168 nc_inq_enum_ident(int ncid, nc_type xtype, long long value,
169  char *identifier)
170 {
171  NC* ncp;
172  int stat = NC_check_id(ncid,&ncp);
173  if(stat != NC_NOERR) return stat;
174  return ncp->dispatch->inq_enum_ident(ncid,xtype,value,identifier);
175 } /* End of named group ...*/
NC_NOERR
#define NC_NOERR
No Error.
Definition: netcdf.h:333
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_inq_enum_ident
int nc_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier)
Definition: denum.c:168
nc_inq_enum
int nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, size_t *base_sizep, size_t *num_membersp)
Definition: denum.c:107
nc_insert_enum
int nc_insert_enum(int ncid, nc_type xtype, const char *name, const void *value)
Definition: denum.c:71
nc_def_enum
int nc_def_enum(int ncid, nc_type base_typeid, const char *name, nc_type *typeidp)
Definition: denum.c:43
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_ENUM
#define NC_ENUM
enum types
Definition: netcdf.h:55
nc_inq_enum_member
int nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name, void *value)
Definition: denum.c:140