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__);
Class represents a netCDF enum type.
NcType getBaseType() const
Returns the base type.
void getMemberValue(int index, T &memberValue) const
Returns the value of a member with the given zero-based index.
size_t getMemberCount() const
Returns number of members in this NcEnumType object.
NcEnumType(const NcGroup &grp, const std::string &name)
Constructor.
NcEnumType()
Constructor generates a null object.
std::string getMemberNameFromIndex(int index) const
Returns the member name for the given zero-based index.
void addMember(const std::string &name, T memberValue)
Adds a new member to this NcEnumType type.
ncEnumType
List of NetCDF-4 Enumeration types.
@ nc_USHORT
unsigned 2-byte int
@ nc_INT
signed 4 byte integer
@ nc_UINT
unsigned 4-byte int
@ nc_SHORT
signed 2 byte integer
@ nc_UBYTE
unsigned 1 byte int
@ nc_BYTE
signed 1 byte integer
@ nc_UINT64
unsigned 8-byte int
@ nc_INT64
signed 8-byte int
NcEnumType & operator=(const NcEnumType &rhs)
assignment operator
std::string getMemberNameFromValue(const T memberValue) const
Returns the member name for the given NcEnumType value.
Class represents a netCDF group.
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
ncType
List of netCDF types that can be represented.
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.