16#include "ncException.h"
35 if(
getTypeClass() != NC_ENUM)
throw NcException(
"The NcType object must be the base of an Enum type.",__FILE__,__LINE__);
65 if(
getTypeClass() != NC_ENUM)
throw NcException(
"The NcType object must be the base of an Enum type.",__FILE__,__LINE__);
71 char charName[NC_MAX_NAME+1];
72 nc_type base_nc_typep;
73 size_t *base_sizep=NULL;
74 size_t *num_membersp=NULL;
75 ncCheck(nc_inq_enum(
groupId,
myId,charName,&base_nc_typep,base_sizep,num_membersp),__FILE__,__LINE__);
76 switch (base_nc_typep) {
77 case NC_BYTE :
return ncByte;
79 case NC_CHAR :
return ncChar;
81 case NC_USHORT :
return ncUshort;
82 case NC_INT :
return ncInt;
83 case NC_UINT :
return ncUint;
98 char charName[NC_MAX_NAME+1];
99 nc_type* base_nc_typep=NULL;
100 size_t* base_sizep=NULL;
102 ncCheck(nc_inq_enum(
groupId,
myId,charName,base_nc_typep,base_sizep,&num_membersp),__FILE__,__LINE__);
109 char charName[NC_MAX_NAME+1];
111 return static_cast<string> (charName);
Class represents a netCDF enum type.
NcType getBaseType() const
Returns the base type.
size_t getMemberCount() const
Returns number of members in this NcEnumType object.
NcEnumType()
Constructor generates a null object.
std::string getMemberNameFromIndex(int index) const
Returns the member name for the given zero-based index.
NcEnumType & operator=(const NcEnumType &rhs)
assignment operator
Class represents a netCDF group.
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
ncType getTypeClass() const
The type class returned as enumeration type.
netCDF::NcGroup getParentGroup() const
Gets parent group.
NcType()
Constructor generates a null object.
NcType & operator=(const NcType &rhs)
assignment operator
ncType
List of netCDF types that can be represented.
Base object is thrown if a netCDF exception is encountered.
NcShort ncShort
A global instance of the NcShort class within the netCDF namespace.
NcFloat ncFloat
A global instance of the NcFloat class within the netCDF namespace.
NcInt64 ncInt64
A global instance of the NcInt64 class within the netCDF namespace.
NcUint64 ncUint64
A global instance of the NcUint64 class within the netCDF namespace.
NcUint ncUint
A global instance of the NcUint class within the netCDF namespace.
NcString ncString
A global instance of the NcString class within the netCDF namespace.
NcInt ncInt
A global instance of the NcInt class within the netCDF namespace.
NcDouble ncDouble
A global instance of the NcDouble class within the netCDF namespace.
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
NcUbyte ncUbyte
A global instance of the NcUbyte class within the netCDF namespace.
NcChar ncChar
A global instance of the NcChar class within the netCDF namespace.
NcByte ncByte
A global instance of the NcByte class within the netCDF namespace.