NcAtt Class Reference

#include <netcdfcpp.h>

Inheritance diagram for NcAtt:

Inheritance graph
[legend]
Collaboration diagram for NcAtt:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~NcAtt (void)
NcToken name (void) const
NcType type (void) const
NcBool is_valid (void) const
long num_vals (void) const
NcValuesvalues (void) const
NcBool rename (NcToken newname)
NcBool remove (void)

Private Member Functions

 NcAtt (NcFile *, const NcVar *, NcToken)
 NcAtt (NcFile *, NcToken)

Private Attributes

const NcVarthe_variable
char * the_name

Friends

class NcFile
NcAttNcVar::get_att (NcToken) const

Detailed Description

Definition at line 413 of file netcdfcpp.h.


Constructor & Destructor Documentation

NcAtt::~NcAtt void   )  [virtual]
 

Definition at line 1130 of file netcdf.cpp.

References the_name.

01131 {
01132     delete [] the_name;
01133 }

NcAtt::NcAtt NcFile ,
const NcVar ,
NcToken 
[private]
 

Definition at line 1116 of file netcdf.cpp.

References the_name.

01117    : NcTypedComponent(nc), the_variable(var)
01118 {
01119     the_name = new char[1 + strlen(name)];
01120     strcpy(the_name, name);
01121 }

NcAtt::NcAtt NcFile ,
NcToken 
[private]
 

Definition at line 1123 of file netcdf.cpp.

References the_name.

01124    : NcTypedComponent(nc), the_variable(NULL)
01125 {
01126     the_name = new char[1 + strlen(name)];
01127     strcpy(the_name, name);
01128 }


Member Function Documentation

NcBool NcAtt::is_valid void   )  const [virtual]
 

Implements NcTypedComponent.

Definition at line 1154 of file netcdf.cpp.

References NcFile::id(), NcVar::id(), NcVar::is_valid(), NcFile::is_valid(), NC_GLOBAL, ncattinq(), ncBad, NcTypedComponent::the_file, the_name, and the_variable.

Referenced by NcVar::get_att().

01155 {
01156     return the_file->is_valid() &&
01157       (the_variable->id() == NC_GLOBAL || the_variable->is_valid()) &&
01158         ncattinq(the_file->id(), the_variable->id(), the_name, 0, 0) != ncBad;
01159 }

NcToken NcAtt::name void   )  const [virtual]
 

Implements NcTypedComponent.

Definition at line 1135 of file netcdf.cpp.

References the_name.

Referenced by dumpatts(), and DumpableNcFile::dumpgatts().

01136 {
01137     return the_name;
01138 }

long NcAtt::num_vals void   )  const [virtual]
 

Implements NcTypedComponent.

Definition at line 1147 of file netcdf.cpp.

References NcVar::id(), NcFile::id(), len, ncattinq(), NcTypedComponent::the_file, the_name, and the_variable.

01148 {
01149     int len;
01150     ncattinq(the_file->id(), the_variable->id(), the_name, 0, &len);
01151     return len;
01152 }

NcBool NcAtt::remove void   ) 
 

Definition at line 1185 of file netcdf.cpp.

References NcFile::define_mode(), FALSE, NcVar::id(), NcFile::id(), ncattdel(), ncBad, NcTypedComponent::the_file, the_name, and the_variable.

01186 {
01187     if (! the_file->define_mode())
01188         return FALSE;
01189     return ncattdel(the_file->id(), the_variable->id(), the_name) != ncBad;
01190 }

NcBool NcAtt::rename NcToken  newname  )  [virtual]
 

Implements NcTypedComponent.

Definition at line 1175 of file netcdf.cpp.

References NcFile::define_mode(), FALSE, NcVar::id(), NcFile::id(), ncattrename(), ncBad, NcTypedComponent::the_file, the_name, and the_variable.

01176 {
01177     if (strlen(newname) > strlen(the_name)) {
01178         if (! the_file->define_mode())
01179             return FALSE;
01180     }
01181     return ncattrename(the_file->id(), the_variable->id(),
01182                        the_name, newname) != ncBad;
01183 }

NcType NcAtt::type void   )  const [virtual]
 

Implements NcTypedComponent.

Definition at line 1140 of file netcdf.cpp.

References NcVar::id(), NcFile::id(), ncattinq(), NcTypedComponent::the_file, the_name, and the_variable.

01141 {
01142     nc_type typ;
01143     ncattinq(the_file->id(), the_variable->id(), the_name, &typ, 0);
01144     return (NcType) typ;
01145 }

NcValues * NcAtt::values void   )  const [virtual]
 

Implements NcTypedComponent.

Definition at line 1161 of file netcdf.cpp.

References NcValues::base(), NcTypedComponent::get_space(), NcVar::id(), NcFile::id(), ncattget(), ncBad, NcTypedComponent::the_file, the_name, and the_variable.

Referenced by dumpatts(), and DumpableNcFile::dumpgatts().

01162 {
01163     NcValues* valp = get_space();
01164     if (ncattget(the_file->id(),
01165                  the_variable->id(),
01166                  the_name,
01167                  valp->base()) == ncBad) {
01168         delete valp;
01169         return 0;
01170     }
01171         
01172     return valp;
01173 }


Friends And Related Function Documentation

friend class NcFile [friend]
 

Definition at line 434 of file netcdfcpp.h.

NcAtt* NcVar::get_att NcToken   )  const [friend]
 


Member Data Documentation

char* NcAtt::the_name [private]
 

Definition at line 427 of file netcdfcpp.h.

Referenced by is_valid(), name(), NcAtt(), num_vals(), remove(), rename(), type(), values(), and ~NcAtt().

const NcVar* NcAtt::the_variable [private]
 

Definition at line 426 of file netcdfcpp.h.

Referenced by is_valid(), num_vals(), remove(), rename(), type(), and values().


The documentation for this class was generated from the following files:
Generated on Thu Mar 16 18:17:39 2006 for nco by  doxygen 1.4.4