netCDF::NcCompoundType Class Reference

`#include <ncCompoundType.h>`

Inheritance diagram for netCDF::NcCompoundType:
[legend]

## Public Member Functions

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)
NcType | getMember (int memberIndex) const
size_t | getMemberCount () const
int | getMemberDimCount (int memberIndex) const
int | getMemberIndex (const std::string &memberName) const
std::string | getMemberName (int memberIndex) const
size_t | getMemberOffset (const int index) const
std::vector< int > | getMemberShape (int memberIndex) const
| NcCompoundType ()
| NcCompoundType (const NcCompoundType &rhs)
| NcCompoundType (const NcGroup &grp, const std::string &name)
| NcCompoundType (const NcType &ncType)
NcCompoundType & | operator= (const NcCompoundType &rhs)
NcCompoundType & | operator= (const NcType &rhs)
bool | operator== (const NcCompoundType &rhs)
| ~NcCompoundType ()
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

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 }
Protected Member Functions inherited from netCDF::NcType
NcType & | operator= (const NcType &rhs)
Protected Attributes inherited from netCDF::NcType
int | g_fileId
int | groupId
nc_type | myId

## Detailed Description

Class represents a netCDF compound type

## Constructor & Destructor Documentation

## NcCompoundType() [1/4]

NcCompoundType::NcCompoundType | ( |  | ) |

Constructor generates a null object.

## NcCompoundType() [2/4]

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

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

Parameters

  grp | The parent group where this type is defined.
  name | Name of new type.

## NcCompoundType() [3/4]

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.

Parameters

  ncType | A Nctype object.

## NcCompoundType() [4/4]

NcCompoundType::NcCompoundType | ( | const NcCompoundType & | rhs | ) |

The copy constructor.

## ~NcCompoundType()

netCDF::NcCompoundType::~NcCompoundType | ( |  | ) |

inline

destructor

## Member Function Documentation

## addMember() [1/2]

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).

## addMember() [2/2]

void netCDF::NcCompoundType::addMember | ( | const std::string & | memName,
|  | const NcType & | newMemberType,
|  | size_t | offset,
|  | const std::vector< int > & | shape )

Adds a named array field.

Parameters

  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.

## getMember()

NcType NcCompoundType::getMember | ( | int | memberIndex | ) | const

Returns a NcType object for a single member.

## getMemberCount()

size_t NcCompoundType::getMemberCount | ( |  | ) | const

Returns number of members in this NcCompoundType object.

## getMemberDimCount()

int NcCompoundType::getMemberDimCount | ( | int | memberIndex | ) | const

Returns the number of dimensions of a member with the given index.

Parameters

  Index | of member (numbering starts at zero).

Returns
  The number of dimensions of the field. Non-array fields have 0 dimensions.

## getMemberIndex()

int NcCompoundType::getMemberIndex | ( | const std::string & | memberName | ) | const

Returns index of named member field.

## getMemberName()

std::string NcCompoundType::getMemberName | ( | int | memberIndex | ) | const

Returns name of member field.

## getMemberOffset()

size_t NcCompoundType::getMemberOffset | ( | const int | index | ) | const

Returns the offset of the member with given index.

## getMemberShape()

vector< int > NcCompoundType::getMemberShape | ( | int | memberIndex | ) | const

Returns the shape of a given member.

Parameters

  Index | of member (numbering starts at zero).

Returns
  The size of the dimensions of the field. Non-array fields have 0 dimensions.

## operator=() [1/2]

NcCompoundType & NcCompoundType::operator= | ( | const NcCompoundType & | rhs | ) |

assignment operator

## operator=() [2/2]

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.

## operator==()

bool NcCompoundType::operator== | ( | const NcCompoundType & | rhs | ) |

equivalence operator

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

- ncCompoundType.h
- ncCompoundType.cpp