mirror of
https://github.com/Unidata/netcdf-cxx4.git
synced 2024-11-27 07:49:52 +08:00
Added NcCompoundType methods getMemberName and getMemberIndex
This commit is contained in:
parent
4f7d126ef6
commit
e1f300c5ae
@ -128,7 +128,21 @@ NcType NcCompoundType::getMember(int memberIndex) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns name of member field.
|
||||
std::string NcCompoundType::getMemberName(int memberIndex) const
|
||||
{
|
||||
char fieldName[NC_MAX_NAME];
|
||||
ncCheck(nc_inq_compound_fieldname(groupId,myId,memberIndex, fieldName),__FILE__,__LINE__);
|
||||
return std::string(fieldName);
|
||||
}
|
||||
|
||||
// Returns index of named member field.
|
||||
int NcCompoundType::getMemberIndex(const std::string& memberName) const{
|
||||
int memberIndex;
|
||||
ncCheck(nc_inq_compound_fieldindex(groupId,myId, memberName.c_str(),&memberIndex),__FILE__,__LINE__);
|
||||
return memberIndex;
|
||||
}
|
||||
|
||||
// Returns the number of dimensions of a member with the given index.
|
||||
int NcCompoundType::getMemberDimCount(int memberIndex) const
|
||||
{
|
||||
|
@ -80,8 +80,14 @@ the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4).
|
||||
size_t getMemberCount() const;
|
||||
|
||||
/*! Returns a NcType object for a single member. */
|
||||
NcType getMember(int memberIndex) const;
|
||||
|
||||
NcType getMember(int memberIndex) const;
|
||||
|
||||
/*! Returns name of member field. */
|
||||
std::string getMemberName(int memberIndex) const;
|
||||
|
||||
/*! Returns index of named member field. */
|
||||
int getMemberIndex(const std::string& memberName) const;
|
||||
|
||||
/*! Returns the offset of the member with given index. */
|
||||
size_t getMemberOffset(const int index) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user