Re: C++ interface and inq_var

Hi Matt,

> How does one query if a var is in a record using C++??  There does not 
> appear to be a call in the .hh file??  In addition, why does the c++ 
> interface not use exceptions but rather dies a horrible death??  Is 
> there any plans to implament exception handling??

The NcFile method

    NcVar* get_var( NcToken ) const;       // variable by name

returns a null pointer for nonexistent variables.  If you don't check
that the return value is non-null before using it, the same horrible
death that happens whenever a null pointer is dereferenced can be
expected.

The C++ interface was developed before standard conforming
implementations of exceptions and templates were widely available, so
it doesn't make use of them.  This interface is still being minimally
maintained in the sense that we fix bugs that are reported (some C++
fixes are in the current netcdf-3.5.1-beta10 release) and make sure
our simple C++ test works on new platforms.  The C++ interface is just
a thin layer on top of the C interface, so it benefits from the
maturity of the C software.  However, we're not actively developing or
enhancing the C++ interface.  It could use some updating with use of
templates and exceptions.  It's still not as widely used as the C,
Java, and Fortran interfaces, and no extensive test set has been
developed for it.

There are alternatives for C++ users, though I don't think these use
exceptions either.  Dave Pierce has developed a set of wrappers over
the existing C++ interface that improves provides some additional
functionality.  See

  http://www.unidata.ucar.edu/cgi-bin/msgout?/glimpse/netcdfgroup-list/1459

Charlie Zender has developed an alternate C++ interface for netCDF, libnco_c++,
that you may want to look at.  It comes with the CVS version of his
NCO software:

  http://www.unidata.ucar.edu/cgi-bin/msgout?/glimpse/netcdfgroup-list/1484

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
russ@xxxxxxxxxxxxxxxx                     http://www.unidata.ucar.edu



  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: