NetCDF 4.9.3
Loading...
Searching...
No Matches
denum.c
Go to the documentation of this file.
1
6
7#include "ncdispatch.h"
8 /* All these functions are part of this named group... */
12
42int
43nc_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
70int
71nc_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
106int
107nc_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
139int
140nc_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
163int
164nc_inq_enum_ident(int ncid, nc_type xtype, long long value,
165 char *identifier)
166{
167 NC* ncp;
168 int stat = NC_check_id(ncid,&ncp);
169 if(stat != NC_NOERR) return stat;
170 return ncp->dispatch->inq_enum_ident(ncid,xtype,value,identifier);
171}
172 /* End of named group ...*/
int nc_def_enum(int ncid, nc_type base_typeid, const char *name, nc_type *typeidp)
Create an enum type.
Definition denum.c:43
int nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name, void *value)
Learn about a about a member of an enum type.
Definition denum.c:140
int nc_insert_enum(int ncid, nc_type xtype, const char *name, const void *value)
Insert a named member into a enum type.
Definition denum.c:71
int nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, size_t *base_sizep, size_t *num_membersp)
Learn about a user-define enumeration type.
Definition denum.c:107
int nc_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier)
Get the name which is associated with an enum member value.
Definition denum.c:164
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:420
#define NC_ENUM
enum types
Definition netcdf.h:55
#define NC_NOERR
No Error.
Definition netcdf.h:378
int nc_type
The nc_type type is just an int.
Definition netcdf.h:25