1 #include "ncEnumType.h" 16 #include "ncException.h" 26 NcType::operator=(rhs);
35 if(getTypeClass() != NC_ENUM)
throw NcException(
"The NcType object must be the base of an Enum type.",__FILE__,__LINE__);
37 NcType::operator=(rhs);
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);
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
NcUint64 ncUint64
A global instance of the NcUint64 class within the netCDF namespace.
std::string getMemberNameFromIndex(int index) const
Returns the member name for the given zero-based index.
NcByte ncByte
A global instance of the NcByte class within the netCDF namespace.
Class represents a netCDF enum type.
NcFloat ncFloat
A global instance of the NcFloat class within the netCDF namespace.
Class represents a netCDF group.
ncType
List of netCDF types that can be represented.
NcUint ncUint
A global instance of the NcUint class within the netCDF namespace.
NcChar ncChar
A global instance of the NcChar class within the netCDF namespace.
NcEnumType()
Constructor generates a null object.
NcDouble ncDouble
A global instance of the NcDouble class within the netCDF namespace.
Base object is thrown if a netCDF exception is encountered.
NcType()
Constructor generates a null object.
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
NcShort ncShort
A global instance of the NcShort class within the netCDF namespace.
size_t getMemberCount() const
Returns number of members in this NcEnumType object.
NcType getBaseType() const
Returns the base type.
NcString ncString
A global instance of the NcString class within the netCDF namespace.
netCDF::NcGroup getParentGroup() const
Gets parent group.
NcInt ncInt
A global instance of the NcInt class within the netCDF namespace.
ncType getTypeClass() const
The type class returned as enumeration type.
NcUbyte ncUbyte
A global instance of the NcUbyte class within the netCDF namespace.
NcInt64 ncInt64
A global instance of the NcInt64 class within the netCDF namespace.