The main requirements for the design of the C++ interface are:
- to provide the functionality of the C interface;
- to provide type safety by eliminating all use of
void* pointers; and
- to provide an interface that is simpler to use than the C interface.
Some of the features of the C++ interface are:
- No IDs needed for netCDF's variables, dimensions, or attributes.
- No explicit open or close calls needed for netCDF files; a constructor
opens and a destructor closes a file.
- No need to specify types for creating attributes; they will have the
type of the value provided.
- No use of
void*: values are type-checked.
- Less indirection is needed for dimensions and dimension sizes than with
the C interface. A variable's dimensions can be provided as arguments
when defining a variable.
- Code for data types is isolated to make the addition of new
- No explicit
ncendef calls are needed for
switching between define and data modes. Whenever a mode switch is
required, it happens implicitly.
The header file netcdfcpp.h must be included in source code files
using this interface.
This release provides some of the functionality of netCDF version 4,
but not for the enhanced data model introduced with netCDF-4.
This manual assumes familiarity with the netCDF User's Guide, where
the concepts of netCDF dimensions, variables, and attributes are