NetCDF-C++ 4.3.1
|
Class represents a netCDF compound type. More...
#include "ncCompoundType.h"
Public Types | |
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 } |
List of netCDF types that can be represented. More... | |
Public Member Functions | |
NcCompoundType () | |
Constructor generates a null object. More... | |
NcCompoundType (const NcCompoundType &rhs) | |
The copy constructor. More... | |
NcCompoundType (const NcGroup &grp, const std::string &name) | |
Constructor. More... | |
NcCompoundType (const NcType &ncType) | |
Constructor. More... | |
~NcCompoundType () | |
destructor More... | |
void | addMember (const std::string &memName, const NcType &newMemberType, size_t offset) |
void | addMember (const std::string &memName, const NcType &newMemberType, size_t offset, const std::vector< int > &shape) |
Adds a named array field. More... | |
nc_type | getId () const |
The netCDF Id of this type. More... | |
NcType | getMember (int memberIndex) const |
Returns a NcType object for a single member. More... | |
size_t | getMemberCount () const |
Returns number of members in this NcCompoundType object. More... | |
int | getMemberDimCount (int memberIndex) const |
Returns the number of dimensions of a member with the given index. More... | |
int | getMemberIndex (const std::string &memberName) const |
Returns index of named member field. More... | |
std::string | getMemberName (int memberIndex) const |
Returns name of member field. More... | |
size_t | getMemberOffset (const int index) const |
Returns the offset of the member with given index. More... | |
std::vector< int > | getMemberShape (int memberIndex) const |
Returns the shape of a given member. More... | |
std::string | getName () const |
The name of this type. More... | |
netCDF::NcGroup | getParentGroup () const |
Gets parent group. More... | |
size_t | getSize () const |
The size in bytes. More... | |
ncType | getTypeClass () const |
The type class returned as enumeration type. More... | |
std::string | getTypeClassName () const |
Return a string containing the name of the enumerated type. More... | |
bool | isNull () const |
Returns true if this object is null (i.e. More... | |
bool | operator!= (const NcType &) const |
!= operator More... | |
NcCompoundType & | operator= (const NcCompoundType &rhs) |
assignment operator More... | |
NcCompoundType & | operator= (const NcType &rhs) |
Assignment operator. More... | |
bool | operator== (const NcCompoundType &rhs) |
equivalence operator More... | |
bool | operator== (const NcType &) const |
equivalence operator More... | |
Protected Attributes | |
int | g_fileId |
An ncid associated with a particular open file (returned from nc_open). More... | |
int | groupId |
the group Id More... | |
nc_type | myId |
the type Id More... | |
bool | nullObject |
Class represents a netCDF compound type.
Definition at line 17 of file ncCompoundType.h.
|
inherited |
List of netCDF types that can be represented.
The enumeration list contains the complete set of netCDF variable types. In addition, the type NC_TYPE is included. This enables the user to instantiate a netCDF type object without explcitly needing to know it precise type.
NcCompoundType::NcCompoundType | ( | ) |
Constructor generates a null object.
Definition at line 60 of file ncCompoundType.cpp.
netCDF::NcCompoundType::NcCompoundType | ( | const NcGroup & | grp, |
const std::string & | name | ||
) |
NcCompoundType::NcCompoundType | ( | const NcType & | ncType | ) |
Constructor.
Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of a Compound type.
ncType | A Nctype object. |
Definition at line 72 of file ncCompoundType.cpp.
NcCompoundType::NcCompoundType | ( | const NcCompoundType & | rhs | ) |
The copy constructor.
Definition at line 44 of file ncCompoundType.cpp.
|
inline |
destructor
Definition at line 56 of file ncCompoundType.h.
void netCDF::NcCompoundType::addMember | ( | const std::string & | memName, |
const NcType & | newMemberType, | ||
size_t | offset | ||
) |
Adds a named field. \param memName Name of new field. \param newMemberType The type of the new member. \param offset Offset of this member in bytes, obtained by a call to offsetof. For example
the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4).
void netCDF::NcCompoundType::addMember | ( | const std::string & | memName, |
const NcType & | newMemberType, | ||
size_t | offset, | ||
const std::vector< int > & | shape | ||
) |
Adds a named array field.
memName | Name of new field. |
newMemberType | The type of the new member. |
offset | Offset of this member in bytes, obtained by a call to offsetof. For example the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4). |
shape | The shape of the array field. |
|
inlineinherited |
NcType NcCompoundType::getMember | ( | int | memberIndex | ) | const |
Returns a NcType object for a single member.
Definition at line 108 of file ncCompoundType.cpp.
size_t NcCompoundType::getMemberCount | ( | ) | const |
Returns number of members in this NcCompoundType object.
Definition at line 99 of file ncCompoundType.cpp.
int NcCompoundType::getMemberDimCount | ( | int | memberIndex | ) | const |
Returns the number of dimensions of a member with the given index.
Index | of member (numbering starts at zero). |
Definition at line 147 of file ncCompoundType.cpp.
int NcCompoundType::getMemberIndex | ( | const std::string & | memberName | ) | const |
Returns index of named member field.
Definition at line 140 of file ncCompoundType.cpp.
std::string NcCompoundType::getMemberName | ( | int | memberIndex | ) | const |
Returns name of member field.
Definition at line 132 of file ncCompoundType.cpp.
size_t NcCompoundType::getMemberOffset | ( | const int | index | ) | const |
Returns the offset of the member with given index.
Definition at line 167 of file ncCompoundType.cpp.
vector< int > NcCompoundType::getMemberShape | ( | int | memberIndex | ) | const |
Returns the shape of a given member.
Index | of member (numbering starts at zero). |
Definition at line 156 of file ncCompoundType.cpp.
|
inherited |
The name of this type.
For atomic types, the CDL type names are returned. These are as follows:
Definition at line 94 of file ncType.cpp.
|
inherited |
Gets parent group.
For an atomic type, returns a Null object.
Definition at line 89 of file ncType.cpp.
|
inherited |
The size in bytes.
This function will work on any type, including atomic and any user defined type, whether compound, opaque, enumeration, or variable length array.
Definition at line 108 of file ncType.cpp.
|
inherited |
The type class returned as enumeration type.
Valid for all types, whether atomic or user-defined. User-defined types are returned as one of the following enumeration types: nc_VLEN, nc_OPAQUE, nc_ENUM, or nc_COMPOUND.
Definition at line 116 of file ncType.cpp.
|
inherited |
Return a string containing the name of the enumerated type.
(ie one of the following strings: "nc_BYTE", "nc_CHAR", "nc_SHORT", "nc_INT", "nc_FLOAT", "nc_DOUBLE", "nc_UBYTE", "nc_USHORT", "nc_UINT", "nc_INT64", "nc_UINT64", "nc_STRING", "nc_VLEN", "nc_OPAQUE", "nc_ENUM", "nc_COMPOUND"
Definition at line 144 of file ncType.cpp.
|
inlineinherited |
|
inherited |
!= operator
Definition at line 83 of file ncType.cpp.
NcCompoundType & NcCompoundType::operator= | ( | const NcCompoundType & | rhs | ) |
assignment operator
Definition at line 25 of file ncCompoundType.cpp.
NcCompoundType & NcCompoundType::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 a Compound type.
Definition at line 32 of file ncCompoundType.cpp.
bool NcCompoundType::operator== | ( | const NcCompoundType & | rhs | ) |
equivalence operator
Definition at line 51 of file ncCompoundType.cpp.
|
inherited |
equivalence operator
Definition at line 74 of file ncType.cpp.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |