NetCDF4 C++ API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
netcdf::NcCompoundType Class Reference

Represents a netCDF compound type. More...

#include <NetCDF/cpp4/src/NcCompoundType.h>

+ Inheritance diagram for netcdf::NcCompoundType:

Detailed Description

Class represents a netCDF compound type

Copyright:
Original C++ API developed by Lynton Appel.
Portions of this software were developed by the Unidata Program at the
University Corporation for Atmospheric Research.
Modifications: Copyright 2013 Colorado State University. All rights reserved.
Organization:
Natural Resource Ecology Laboratory
Colorado State University, Fort Collins, CO 80523 USA
www.nrel.colostate.edu
Project:
IRC <www.nrel.colostate.edu/projects/irc/>
Author
Tom Hilinski tom.h.nosp@m.ilin.nosp@m.ski@c.nosp@m.olos.nosp@m.tate..nosp@m.edu
Date
2013Jan

Public Member Functions

 NcCompoundType ()
 
 NcCompoundType (int const useFileID, NcGroup const &grp, std::string const name, int const typeID)
 ID returned by "nc_def*". More...
 
 NcCompoundType (NcCompoundType const &rhs)
 
virtual std::string const getTypeClassName () const
 
void addMember (std::string const memName, NcType const &newMemberType, size_t const offset)
 
void addMember (std::string const memName, NcType const &newMemberType, size_t const offset, const std::vector< int > &shape)
 
size_t getMemberCount () const
 
NcType getMember (int const memberIndex) const
 
size_t getMemberOffset (const int index) const
 
int getMemberDimCount (int const memberIndex) const
 
std::vector< int > getMemberShape (int const memberIndex) const
 
NcCompoundTypeoperator= (NcCompoundType const &rhs)
 
bool operator== (NcCompoundType const &rhs) const
 
bool operator!= (NcCompoundType const &rhs) const
 
- Public Member Functions inherited from netcdf::NcTypeUserDef
 NcTypeUserDef (int const useFileID, NcGroup const &grp, std::string const &myClassName, ncType const classTypeID, int const typeID)
 ID returned by "nc_def*". More...
 
 NcTypeUserDef (NcTypeUserDef const &rhs)
 
int GetFileID () const
 file ID More...
 
int GetGroupID () const
 group ID More...
 
int GetTypeID () const
 type ID from nc_def* More...
 
virtual std::string GetName () const
 name of this type More...
 
virtual size_t Size () const
 size of type in bytes More...
 
NcGroup GetParentGroup () const
 parent group More...
 
virtual ncType getTypeClass () const
 return enum ncType More...
 
NcTypeUserDefoperator= (NcTypeUserDef const &rhs)
 
bool operator== (NcTypeUserDef const &rhs) const
 
bool operator!= (const NcTypeUserDef &rhs) const
 
bool operator< (NcTypeUserDef const &rhs) const
 
- Public Member Functions inherited from netcdf::NcType
 NcType ()
 
 NcType (std::string const myClassName, ncType const id)
 enumerated type value More...
 
 NcType (NcType const &rhs)
 
virtual ~NcType ()
 
NcTypeoperator= (NcType const &rhs)
 
bool operator== (NcType const &rhs) const
 
bool operator!= (NcType const &rhs) const
 
bool operator< (NcType const &rhs) const
 
ncType GetID () const
 
virtual ncType GetTypeClass () const
 
std::string const & getTypeClassName () const
 
std::string const & GetTypeClassName () const
 
bool IsNull () const
 
- Public Member Functions inherited from netcdf::NcTypeV4
virtual ~NcTypeV4 ()=0
 
void VerifyVersion4 (int const fileID)
 

Additional Inherited Members

- Public Types inherited from netcdf::NcType
enum  ncType {
  nc_NAT = NC_NAT, 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, nc_Unknown
}
 
- Protected Member Functions inherited from netcdf::NcType
void ErrorDimsAreZero (std::string const &className)
 
void ErrorArrayNcSizeMismatch (std::string const &className)
 
- Protected Member Functions inherited from netcdf::NcTypeV4
 NcTypeV4 (std::string const useTypeClassName)
 
 NcTypeV4 (NcTypeV4 const &rhs)
 
- Protected Attributes inherited from netcdf::NcType
bool nullObject
 
std::string myName
 enumerated type name More...
 
ncType myID
 enumerated type value More...
 
- Static Protected Attributes inherited from netcdf::NcType
static ncType const nullID = nc_NAT
 

Constructor & Destructor Documentation

netcdf::NcCompoundType::NcCompoundType ( )

Constructor generates a null object.

netcdf::NcCompoundType::NcCompoundType ( int const  useFileID,
NcGroup const &  grp,
std::string const  name,
int const  typeID 
)

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

Parameters
grpThe parent group where this type is defined.
nameName of new type.
Parameters
useFileIDnetCDF file ID number
grpparent group where this type is defined
nameName of new type
netcdf::NcCompoundType::NcCompoundType ( NcCompoundType const &  rhs)
inline

Member Function Documentation

void netcdf::NcCompoundType::addMember ( std::string const  memName,
NcType const &  newMemberType,
size_t const  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 ( std::string const  memName,
NcType const &  newMemberType,
size_t const  offset,
const std::vector< int > &  shape 
)

Adds a named array field.

Parameters
memNameName of new field.
newMemberTypeThe type of the new member.
offsetOffset 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).
shapeThe shape of the array field.
NcType netcdf::NcCompoundType::getMember ( int const  memberIndex) const

Returns a NcType object for a single member.

size_t netcdf::NcCompoundType::getMemberCount ( ) const

Returns number of members in this NcCompoundType object.

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

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

Parameters
Indexof member (numbering starts at zero).
Returns
The number of dimensions of the field. Non-array fields have 0 dimensions.
size_t netcdf::NcCompoundType::getMemberOffset ( const int  index) const

Returns the offset of the member with given index.

std::vector< int > netcdf::NcCompoundType::getMemberShape ( int const  memberIndex) const

Returns the shape of a given member.

Parameters
Indexof member (numbering starts at zero).
Returns
The size of the dimensions of the field. Non-array fields have 0 dimensions.
virtual std::string const netcdf::NcCompoundType::getTypeClassName ( ) const
inlinevirtual

Reimplemented from netcdf::NcTypeUserDef.

bool netcdf::NcCompoundType::operator!= ( NcCompoundType const &  rhs) const
inline
NcCompoundType & netcdf::NcCompoundType::operator= ( NcCompoundType const &  rhs)
bool netcdf::NcCompoundType::operator== ( NcCompoundType const &  rhs) const

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