NcDim Class Reference

#include <netcdfcpp.h>

Collaboration diagram for NcDim:

Collaboration graph
[legend]
List of all members.

Public Member Functions

NcToken name (void) const
long size (void) const
NcBool is_valid (void) const
NcBool is_unlimited (void) const
NcBool rename (NcToken newname)
int id (void) const
NcBool sync (void)

Private Member Functions

 NcDim (NcFile *, int num)
 NcDim (NcFile *, NcToken name, long sz)
virtual ~NcDim (void)

Private Attributes

NcFilethe_file
int the_id
char * the_name

Friends

class NcFile

Detailed Description

Definition at line 146 of file netcdfcpp.h.


Constructor & Destructor Documentation

NcDim::NcDim NcFile ,
int  num
[private]
 

Definition at line 446 of file netcdf.cpp.

References NcFile::id(), MAX_NC_NAME, ncBad, ncdiminq(), the_file, the_id, and the_name.

00447         : the_file(nc), the_id(id)
00448 {
00449     char nam[MAX_NC_NAME];
00450     if (the_file && ncdiminq(the_file->id(), the_id, nam, 0) != ncBad) {
00451         the_name = new char[strlen(nam) + 1]; 
00452         strcpy(the_name, nam);
00453     } else {
00454         the_name = 0;
00455     }
00456 }

NcDim::NcDim NcFile ,
NcToken  name,
long  sz
[private]
 

Definition at line 458 of file netcdf.cpp.

References NcFile::id(), ncBad, ncdimdef(), the_file, the_id, and the_name.

00459         : the_file(nc)
00460 {
00461     the_id = ncdimdef(the_file->id(), name, sz);
00462     if (the_id != ncBad) {
00463         the_name = new char[strlen(name) + 1];
00464         strcpy(the_name, name);
00465     } else {
00466         the_name = 0;
00467     }
00468 }

NcDim::~NcDim void   )  [private, virtual]
 

Definition at line 470 of file netcdf.cpp.

References the_name.

00471 {
00472     delete [] the_name;
00473 }


Member Function Documentation

int NcDim::id void   )  const
 

Definition at line 426 of file netcdf.cpp.

References the_id.

Referenced by NcFile::add_var().

00427 {
00428     return the_id;
00429 }

NcBool NcDim::is_unlimited void   )  const
 

Definition at line 402 of file netcdf.cpp.

References FALSE, NcFile::id(), ncinquire(), the_file, and the_id.

Referenced by DumpableNcFile::dumpdims().

00403 {
00404     if (!the_file)
00405       return FALSE;
00406     int recdim;
00407     ncinquire(the_file->id(), 0, 0, 0, &recdim);
00408     return the_id == recdim;
00409 }

NcBool NcDim::is_valid void   )  const
 

Definition at line 397 of file netcdf.cpp.

References NcFile::is_valid(), ncBad, the_file, and the_id.

00398 {
00399     return the_file->is_valid() && the_id != ncBad;
00400 }

NcToken NcDim::name void   )  const
 

Definition at line 384 of file netcdf.cpp.

References the_name.

Referenced by NcVar::dim_to_index(), DumpableNcFile::dumpdims(), and DumpableNcFile::dumpvars().

00385 {
00386     return the_name;
00387 }

NcBool NcDim::rename NcToken  newname  ) 
 

Definition at line 411 of file netcdf.cpp.

References NcFile::define_mode(), FALSE, NcFile::id(), ncBad, ncdimrename(), the_file, the_id, and the_name.

00412 {
00413     if (strlen(newname) > strlen(the_name)) {
00414         if (! the_file->define_mode())
00415             return FALSE;
00416     }
00417     NcBool ret = ncdimrename(the_file->id(), the_id, newname) != ncBad;
00418     if (ret) {
00419         delete [] the_name;
00420         the_name = new char[1 + strlen(newname)];
00421         strcpy(the_name, newname);
00422     }
00423     return ret;
00424 }

long NcDim::size void   )  const
 

Definition at line 389 of file netcdf.cpp.

References NcFile::id(), ncdiminq(), the_file, and the_id.

Referenced by DumpableNcFile::dumpdims(), NcVar::edges(), NcVar::num_vals(), and NcVar::values().

00390 {
00391     long sz = 0;
00392     if (the_file)
00393       ncdiminq(the_file->id(), the_id, (char*)0, &sz);
00394     return sz;
00395 }

NcBool NcDim::sync void   ) 
 

Definition at line 431 of file netcdf.cpp.

References FALSE, NcFile::id(), MAX_NC_NAME, ncBad, ncdiminq(), the_file, the_id, the_name, and TRUE.

Referenced by NcFile::sync().

00432 {    
00433     char nam[MAX_NC_NAME];
00434     if (the_name) {
00435         delete [] the_name;
00436     }
00437     if (the_file && ncdiminq(the_file->id(), the_id, nam, 0) != ncBad) {
00438         the_name = new char[strlen(nam) + 1]; 
00439         strcpy(the_name, nam);
00440         return TRUE;
00441     }
00442     the_name = 0;
00443     return FALSE;
00444 }


Friends And Related Function Documentation

friend class NcFile [friend]
 

Definition at line 167 of file netcdfcpp.h.


Member Data Documentation

NcFile* NcDim::the_file [private]
 

Definition at line 158 of file netcdfcpp.h.

Referenced by is_unlimited(), is_valid(), NcDim(), rename(), size(), and sync().

int NcDim::the_id [private]
 

Definition at line 159 of file netcdfcpp.h.

Referenced by id(), is_unlimited(), is_valid(), NcDim(), rename(), size(), and sync().

char* NcDim::the_name [private]
 

Definition at line 160 of file netcdfcpp.h.

Referenced by name(), NcDim(), rename(), sync(), and ~NcDim().


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