6 #ifndef NcEnumTypeClass 7 #define NcEnumTypeClass 71 template <
class T>
void addMember(
const std::string& name, T memberValue)
73 ncCheck(nc_insert_enum(
groupId,
myId, name.c_str(), (
void*) &memberValue),__FILE__,__LINE__);
84 char charName[NC_MAX_NAME+1];
85 ncCheck(nc_inq_enum_ident(
groupId,
myId,static_cast<long long>(memberValue),charName),__FILE__,__LINE__);
86 return std::string(charName);
97 ncCheck(nc_inq_enum_member(
groupId,
myId,index,charName,&memberValue),__FILE__,__LINE__);
void getMemberValue(int index, T &memberValue) const
Returns the value of a member with the given zero-based index.
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
std::string getMemberNameFromIndex(int index) const
Returns the member name for the given zero-based index.
Class represents a netCDF enum type.
Class represents a netCDF group.
ncType
List of netCDF types that can be represented.
void addMember(const std::string &name, T memberValue)
Adds a new member to this NcEnumType type.
std::string getMemberNameFromValue(const T memberValue) const
Returns the member name for the given NcEnumType value.
NcEnumType()
Constructor generates a null object.
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
size_t getMemberCount() const
Returns number of members in this NcEnumType object.
NcType getBaseType() const
Returns the base type.
ncEnumType
List of NetCDF-4 Enumeration types.
NcEnumType & operator=(const NcEnumType &rhs)
assignment operator