NetCDF-C++ 4.3.1
ncCompoundType.h
1#include <string>
2#include <vector>
3#include "ncType.h"
4#include "netcdf.h"
5
6#ifndef NcCompoundTypeClass
7#define NcCompoundTypeClass
8
9
10namespace netCDF
11{
12 class NcGroup; // forward declaration.
13
17 class NcCompoundType : public NcType
18 {
19 public:
20
23
31 NcCompoundType(const NcGroup& grp, const std::string& name);
32
39
42
47 NcCompoundType& operator=(const NcType& rhs);
48
51
53 bool operator==(const NcCompoundType & rhs);
54
57
58
66 void addMember(const std::string& memName, const NcType& newMemberType,size_t offset);
67
76 void addMember(const std::string& memName, const NcType& newMemberType, size_t offset, const std::vector<int>& shape);
77
78
80 size_t getMemberCount() const;
81
83 NcType getMember(int memberIndex) const;
84
86 std::string getMemberName(int memberIndex) const;
87
89 int getMemberIndex(const std::string& memberName) const;
90
92 size_t getMemberOffset(const int index) const;
93
99 int getMemberDimCount(int memberIndex) const;
100
101
107 std::vector<int> getMemberShape(int memberIndex) const;
108
109
110 private:
111
112 int myOffset;
113
114 };
115
116}
117
118
119#endif
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.
NcCompoundType(const NcGroup &grp, const std::string &name)
Constructor.
NcType getMember(int memberIndex) const
Returns a NcType object for a single member.
~NcCompoundType()
destructor
NcCompoundType & operator=(const NcCompoundType &rhs)
assignment operator
void addMember(const std::string &memName, const NcType &newMemberType, size_t offset, const std::vector< int > &shape)
Adds a named array field.
Class represents a netCDF group.
Definition: ncGroup.h:28
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
Definition: ncType.h:15
ncType
List of netCDF types that can be represented.
Definition: ncType.h:26
C++ API for netCDF4.
Definition: ncAtt.h:10

Return to the Main Unidata NetCDF page.
Generated on Wed Nov 10 2021 15:25:08 for NetCDF-C++. NetCDF is a Unidata library.