3#include "ncCompoundType.h"
16#include "ncException.h"
54 return nullObject == rhs.nullObject;
82 ncCheck(nc_insert_compound(
groupId,
myId,
const_cast<char*
>(memberName.c_str()),offset,newMemberType.
getId()),__FILE__,__LINE__);
91 ncCheck(nc_insert_array_compound(
groupId,
myId,
const_cast<char*
>(memberName.c_str()), offset, newMemberType.
getId(), shape.size(),
const_cast<int*
>(&shape[0])),__FILE__,__LINE__);
93 addMember(memberName, newMemberType, offset);
110 nc_type fieldtypeidp;
111 ncCheck(nc_inq_compound_fieldtype(
groupId,
myId,memberIndex,&fieldtypeidp),__FILE__,__LINE__);
112 switch (fieldtypeidp) {
113 case NC_BYTE :
return ncByte;
114 case NC_UBYTE :
return ncUbyte;
115 case NC_CHAR :
return ncChar;
116 case NC_SHORT :
return ncShort;
117 case NC_USHORT :
return ncUshort;
118 case NC_INT :
return ncInt;
119 case NC_UINT :
return ncUint;
120 case NC_INT64 :
return ncInt64;
122 case NC_FLOAT :
return ncFloat;
134 char fieldName[NC_MAX_NAME+1];
135 ncCheck(nc_inq_compound_fieldname(
groupId,
myId,memberIndex, fieldName),__FILE__,__LINE__);
136 return std::string(fieldName);
142 ncCheck(nc_inq_compound_fieldindex(
groupId,
myId, memberName.c_str(),&memberIndex),__FILE__,__LINE__);
150 ncCheck(nc_inq_compound_fieldndims(
groupId,
myId,memberIndex, &ndimsp),__FILE__,__LINE__);
158 vector<int> dim_size;
160 if(!dim_size.empty())
161 ncCheck(nc_inq_compound_fielddim_sizes(
groupId,
myId,memberIndex,&dim_size[0]),__FILE__,__LINE__);
Class represents a netCDF compound type.
bool operator==(const NcCompoundType &rhs)
equivalence operator
void addMember(const std::string &memName, const NcType &newMemberType, size_t offset)
int getMemberDimCount(int memberIndex) const
Returns the number of dimensions of a member with the given index.
std::vector< int > getMemberShape(int memberIndex) const
Returns the shape of a given member.
int getMemberIndex(const std::string &memberName) const
Returns index of named member field.
NcCompoundType()
Constructor generates a null object.
size_t getMemberCount() const
Returns number of members in this NcCompoundType object.
size_t getMemberOffset(const int index) const
Returns the offset of the member with given index.
std::string getMemberName(int memberIndex) const
Returns name of member field.
NcType getMember(int memberIndex) const
Returns a NcType object for a single member.
NcCompoundType & operator=(const NcCompoundType &rhs)
assignment operator
Class represents a netCDF group.
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
ncType getTypeClass() const
The type class returned as enumeration type.
netCDF::NcGroup getParentGroup() const
Gets parent group.
NcType()
Constructor generates a null object.
NcType & operator=(const NcType &rhs)
assignment operator
@ nc_COMPOUND
"NcCompound type"
nc_type getId() const
The netCDF Id of this type.
Base object is thrown if a netCDF exception is encountered.
NcShort ncShort
A global instance of the NcShort class within the netCDF namespace.
NcFloat ncFloat
A global instance of the NcFloat class within the netCDF namespace.
NcInt64 ncInt64
A global instance of the NcInt64 class within the netCDF namespace.
NcUint64 ncUint64
A global instance of the NcUint64 class within the netCDF namespace.
NcUint ncUint
A global instance of the NcUint class within the netCDF namespace.
NcString ncString
A global instance of the NcString class within the netCDF namespace.
NcInt ncInt
A global instance of the NcInt class within the netCDF namespace.
NcDouble ncDouble
A global instance of the NcDouble class within the netCDF namespace.
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
NcUbyte ncUbyte
A global instance of the NcUbyte class within the netCDF namespace.
NcChar ncChar
A global instance of the NcChar class within the netCDF namespace.
NcByte ncByte
A global instance of the NcByte class within the netCDF namespace.