[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with NcFile::add_var(NcToken, NcType, int, const NcDim*)



Tom,

> I'm currently in the midst of writing a facility to build a
> netCDF file from parameters defined in a configuration file.
> This morning I bumped into the NcFile::add_var problem where
> the compiler won't let you build an array of NcDims because the
> NcDim constructors are private.
> 
> Fortunately, I looked into it on the WWW and found that this bug
> had been discovered by Dan Schmitt, which is discussed in a mail
> message sent on October 14.
> 
> My question is this.  Has this bug been incorporated into a patch
> that is currently available or should I make the changes to our
> source?

No, sorry I haven't made a patch containing this yet.  I was in the middle
of trying to integrate Dan Schmitt's changes into the distribution and ran
into a problem with the way he implemented NcOldFile and NcNewFile classes
for which a simple solution wasn't obvious.  I set it aside for a while in
hopes that a fresh look later would help.

>          It looks like I just need to change the interface from
> NcDim* to NcDim** and modify line 166 from dimids[i] = dims[i].id()
> to dimids[i] = dims[i]->id().

That's about it, except you have to make the necessary changes in netcdf.hh
as well as netcdf.cc, of course.  Here's the current diffs I have:

% cvs diff
cvs diff: Diffing .
===================================================================
RCS file: /upc/new/CVS/netcdf/c++/netcdf.cc,v
retrieving revision 1.48
diff -r1.48 netcdf.cc
163c163
< NcVar* NcFile::add_var(NcToken name, NcType type, int ndims, const NcDim* 
dims)
---
> NcVar* NcFile::add_var(NcToken name, NcType type, int ndims, const NcDim** 
> dims)
169c169
<       dimids[i] = dims[i].id();
---
>       dimids[i] = dims[i]->id();
===================================================================
RCS file: /upc/new/CVS/netcdf/c++/netcdf.hh,v
retrieving revision 1.41
diff -r1.41 netcdf.hh
64c64
<                           int ndims, const NcDim* dims );
---
>                           int ndims, const NcDim** dims );
345c345
<                                  const NcDim* );
---
>                                  const NcDim** );


> While I've got your attention, any guesses as to when the "official"
> C++ interface will be released?  I'm getting a little nervous about
> our version diverging from yours.  Thanks!

No, sorry, I've gotten assigned to some other projects over the short term,
and am trying to learn perl5 and the C++ Standard Template Library as well
as upgrade some of my infrastructure.  I don't think there has been much
divergence yet.  However if I bite the bullet and really do what's required
with using templates instead of macros, there will be more differences.  I
hope to get back to the netCDF C++ interface implementation soon.

--Russ