Next: , Previous: Auxiliary Classes, Up: Auxiliary Classes


Class NcValues

Class NcValues is an abstract base class for a block of typed values. The derived classes are NcValues_ncbyte, NcValues_char, NcValues_short, NcValues_int, NcValues_nclong (deprecated), and NcValues_long, NcValues_float, NcValues_double. These classes are used as the return type of the NcTypedComponent::values() member function, for typed-value arrays associated with variables and attributes.

Public Member Functions

NcValues( void )
Default constructor.


NcValues(NcType, long)
Constructor for a value block of the specified type and length.


~NcValues( void )
Destructor.


long num( void )
Returns the number of values in the value block.


ostream& print(ostream&) const
Used to print the comma-delimited sequence of values of the value block.


void* base( void ) const
Returns a bland pointer to the beginning of the value block.


int bytes_for_one( void ) const
Returns the number of bytes required for one value.


ncbyte as_ncbyte( int n ) const
char as_char( int n ) const
short as_short( int n ) const
int as_int( int n ) const
nclong as_nclong( int n ) const // deprecated
long as_long( int n ) const
float as_float( int n ) const
double as_double( int n ) const
char* as_string( int n ) const
Provide conversions for the nth value from the value type to a desired basic type. If the value is out of range, the default "fill-value" for the appropriate type is returned. The caller is responsible for eventually deleting memory allocated by the as_string method.