netcdf-C++
netCDF::NcEnumType Class Reference

#include <ncEnumType.h>

Inheritance diagram for netCDF::NcEnumType:

Public Types

enum  ncEnumType {
  nc_BYTE = NC_BYTE , nc_SHORT = NC_SHORT , nc_INT = NC_INT , nc_UBYTE = NC_UBYTE ,
  nc_USHORT = NC_USHORT , nc_UINT = NC_UINT , nc_INT64 = NC_INT64 , nc_UINT64 = NC_UINT64
}
Public Types inherited from netCDF::NcType
enum  ncType {
  nc_BYTE = NC_BYTE , nc_CHAR = NC_CHAR , nc_SHORT = NC_SHORT , nc_INT = NC_INT ,
  nc_FLOAT = NC_FLOAT , nc_DOUBLE = NC_DOUBLE , nc_UBYTE = NC_UBYTE , nc_USHORT = NC_USHORT ,
  nc_UINT = NC_UINT , nc_INT64 = NC_INT64 , nc_UINT64 = NC_UINT64 , nc_STRING = NC_STRING ,
  nc_VLEN = NC_VLEN , nc_OPAQUE = NC_OPAQUE , nc_ENUM = NC_ENUM , nc_COMPOUND = NC_COMPOUND
}

Public Member Functions

template<class T>
void addMember (const std::string &name, T memberValue)
NcType getBaseType () const
size_t getMemberCount () const
std::string getMemberNameFromIndex (int index) const
template<class T>
std::string getMemberNameFromValue (const T memberValue) const
template<class T>
void getMemberValue (int index, T &memberValue) const
 NcEnumType ()
 NcEnumType (const NcEnumType &rhs)
 NcEnumType (const NcGroup &grp, const std::string &name)
 NcEnumType (const NcType &ncType)
NcEnumTypeoperator= (const NcEnumType &rhs)
NcEnumTypeoperator= (const NcType &rhs)
 ~NcEnumType ()
Public Member Functions inherited from netCDF::NcType
nc_type getId () const
std::string getName () const
netCDF::NcGroup getParentGroup () const
size_t getSize () const
ncType getTypeClass () const
std::string getTypeClassName () const
bool isNull () const
 NcType ()
 NcType (const NcType &rhs)
 NcType (const netCDF::NcGroup &grp, const std::string &name)
 NcType (const netCDF::NcGroup &grp, nc_type id)
 NcType (nc_type id)
bool operator!= (const NcType &) const
bool operator== (const NcType &) const
virtual ~NcType ()

Additional Inherited Members

Protected Member Functions inherited from netCDF::NcType
NcTypeoperator= (const NcType &rhs)
Protected Attributes inherited from netCDF::NcType
int g_fileId
int groupId
nc_type myId

Detailed Description

Class represents a netCDF enum type

Member Enumeration Documentation

◆ ncEnumType

List of NetCDF-4 Enumeration types.

Enumerator
nc_BYTE 

signed 1 byte integer

nc_SHORT 

signed 2 byte integer

nc_INT 

signed 4 byte integer

nc_UBYTE 

unsigned 1 byte int

nc_USHORT 

unsigned 2-byte int

nc_UINT 

unsigned 4-byte int

nc_INT64 

signed 8-byte int

nc_UINT64 

unsigned 8-byte int

Constructor & Destructor Documentation

◆ NcEnumType() [1/4]

NcEnumType::NcEnumType ( )

Constructor generates a null object.

◆ NcEnumType() [2/4]

netCDF::NcEnumType::NcEnumType ( const NcGroup & grp,
const std::string & name )

Constructor. The enum Type must already exist in the netCDF file. New netCDF enum types can be added using NcGroup::addNcEnumType();

Parameters
grpThe parent group where this type is defined.
nameName of new type.

◆ NcEnumType() [3/4]

NcEnumType::NcEnumType ( const NcType & ncType)

Constructor. Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of an Enum type.

Parameters
ncTypeA Nctype object.

◆ NcEnumType() [4/4]

NcEnumType::NcEnumType ( const NcEnumType & rhs)

The copy constructor.

◆ ~NcEnumType()

netCDF::NcEnumType::~NcEnumType ( )
inline

Destructor

Member Function Documentation

◆ addMember()

template<class T>
void netCDF::NcEnumType::addMember ( const std::string & name,
T memberValue )
inline

Adds a new member to this NcEnumType type.

Parameters
nameName for this new Enum memebr.
memberValueMember value, must be of the correct NcType.

◆ getBaseType()

NcType NcEnumType::getBaseType ( ) const

Returns the base type.

◆ getMemberCount()

size_t NcEnumType::getMemberCount ( ) const

Returns number of members in this NcEnumType object.

◆ getMemberNameFromIndex()

string NcEnumType::getMemberNameFromIndex ( int index) const

Returns the member name for the given zero-based index.

◆ getMemberNameFromValue()

template<class T>
std::string netCDF::NcEnumType::getMemberNameFromValue ( const T memberValue) const
inline

Returns the member name for the given NcEnumType value.

◆ getMemberValue()

template<class T>
void netCDF::NcEnumType::getMemberValue ( int index,
T & memberValue ) const
inline

Returns the value of a member with the given zero-based index.

Parameters
nameName for this new Enum member.
memberValueMember value, returned by this routine.

◆ operator=() [1/2]

NcEnumType & NcEnumType::operator= ( const NcEnumType & rhs)

assignment operator

◆ operator=() [2/2]

NcEnumType & NcEnumType::operator= ( const NcType & rhs)

Assignment operator. This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of an Enum type.


The documentation for this class was generated from the following files: