 
 
 
  
 
 
 
   
 
2008 Unidata NetCDF Workshop for Developers and Data Providers  > NetCDF APIs  
 
5.3 The C++ API
The C++ library provided the first object-oriented API for netCDF.
Strengths
  -  Object-oriented interface
-  Fairly well documented:  Users Guide is complete and up-to-date.
  
-  Type safety: better than the C interface.
-  Less code than an equivalent C program.
-  Short argument lists, because there are no IDs for variables,
  dimensions, or attributes.
-  Easier memory management, because space for blocks of data is allocated
  by the library.
Weaknesses
  -  Showing its age: written before C++ standards for templates,
  exceptions, and namespaces
-  No garbage collection: you have to delete blocks of data and
  NcAtt objects (attributes) allocated by the library when done with them.
-  Less tested than C, Fortran, and Java interfaces.
-  No ncgen support: ncgen cannot (yet) generate any C++ code.
-  Old-fashioned error handling: no C++ Exceptions used, so need to check
  return status from method calls.
  
Other Characteristics
  -  Implemented as a thin layer on top of C library
-  Not used in other Unidata libraries or applications.
Examples
Annotated examples of complete C++ netCDF programs are available from 
the program examples page.
NetCDF-4 note: 
Student assistant updated the C++ interface for netCDF-4,
but not complete yet.
 
 
 
 
 
 
 
 
 
2008 Unidata NetCDF Workshop for Developers and Data Providers  > NetCDF APIs