Class NcTypedComponent
NcTypedComponent is an abstract base class for NcVar and
NcAtt that captures the similarities between netCDF variables and
attributes. We list here the member functions that variables and
attributes inherit from NcTypedComponent, but these member
functions are also documented under the NcVar and NcAtt
classes for convenience.
Public Member Functions
NcToken name( void ) const-
Returns the name of the variable or attribute.
NcType type( void ) const-
Returns the type of the variable or attribute. The type will be one of
ncByte, ncChar, ncShort, ncInt,
ncFloat, or ncDouble.
NcBool is_valid( void ) const-
Returns
TRUE if the component is valid, FALSE otherwise.
long num_vals( void ) const-
Returns the number of values for an attribute or variable. For an
attribute, this is just 1 for a scalar attribute, the number of values
for a vector-valued attribute, and the number of characters for a
string-valued attribute. For a variable, this is the product of the
dimension sizes for all the variable's dimensions.
NcBool rename( NcToken newname )-
Renames the variable or attribute.
NcValues* values( void ) const-
Returns a pointer to the block of all values for the variable or
attribute. The caller is responsible for deleting this block of values
when no longer needed, as well as the pointer returned by the
values method. Note that this is not a good way to read
selected values of a variable; use the get member function
instead, to get single values or selected cross-sections of values.
ncbyte as_ncbyte( int n ) constchar as_char( int n ) constshort as_short( int n ) constint as_int( int n ) constnclong as_nclong( int n ) const // deprecatedlong as_long( int n ) constfloat as_float( int n ) constdouble as_double( int n ) constchar* as_string( int n ) const-
Get the n-th value of the attribute or variable. These member functions
provide conversions from the value type of the variable or attribute to
the specified type. If the value is out-of-range, the
fill-value of the appropriate type is returned.