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

Re: 20040429: patch for netCDF C++ support



Arnaud,

> I have another patch for the C++ APIs. I sent it a while ago but it
> did not get included.  Are you interested ?

I found the attached email and have applied the patch.  It looks like
it "fell through the cracks" in April when we were trying to do too
many things at once ...  

Thanks, again!

--Russ

 To: address@hidden
 Subject: 20040429: patch for netCDF C++ support
 Reply-to: "Arnaud Desitter" <address@hidden>
 Date: Thu, 29 Apr 2004 10:27:00 -0600

 ------- Forwarded Message

 >To: <address@hidden>
 >From: "Arnaud Desitter" <address@hidden>
 >Subject: patch for C++ support
 >Organization: ?
 >Keywords: 200404291441.i3TEfLtK000442 netCDF C++

 This is a multi-part message in MIME format.

 ------=_NextPart_000_0289_01C42E00.6AFCB300
 Content-Type: text/plain;
         charset="iso-8859-1"
 Content-Transfer-Encoding: 7bit

 Hi,

 I attach a patch that fixes some bugs in the C++ support.
 The operator assignment and copy constructor did not call
 the corresponding function of their parent class.
 Hope it will make it in the next version of NetCDF.

 Regards,


 ------=_NextPart_000_0289_01C42E00.6AFCB300
 Content-Type: text/plain;
         name="patch-netcdf.txt"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
         filename="patch-netcdf.txt"

 Only in netcdf-3.5.1-new/src: config.cache=0A=
 Only in netcdf-3.5.1-new/src: config.log=0A=
 Only in netcdf-3.5.1-new/src: config.status=0A=
 diff -r -u netcdf-3.5.1/src/cxx/ncvalues.cpp =
 netcdf-3.5.1-new/src/cxx/ncvalues.cpp=0A=
 --- netcdf-3.5.1/src/cxx/ncvalues.cpp  2002-02-20 23:58:29.000000000 +0000=0A=
 +++ netcdf-3.5.1-new/src/cxx/ncvalues.cpp      2004-04-29 15:23:07.000000000 =
 +0100=0A=
 @@ -11,11 +11,11 @@=0A=
  =0A=
  #include "ncvalues.h"=0A=
  =0A=
 -NcValues::NcValues( void ) : the_number(0), the_type(ncNoType)=0A=
 +NcValues::NcValues( void ) : the_type(ncNoType), the_number(0)=0A=
  {}=0A=
  =0A=
  NcValues::NcValues(NcType type, long num)=0A=
 -      : the_number(num), the_type(type)=0A=
 +      : the_type(type), the_number(num)=0A=
  {}=0A=
  =0A=
  NcValues::~NcValues( void )=0A=
 diff -r -u netcdf-3.5.1/src/cxx/ncvalues.h =
 netcdf-3.5.1-new/src/cxx/ncvalues.h=0A=
 --- netcdf-3.5.1/src/cxx/ncvalues.h    2002-12-30 23:44:24.000000000 +0000=0A=
 +++ netcdf-3.5.1-new/src/cxx/ncvalues.h        2004-04-29 15:32:46.000000000 =
 +0100=0A=
 @@ -106,7 +106,8 @@=0A=
         : NcValues(NcTypeEnum(TYPE), num), the_values(new TYPE[num])         
\=0A=
  {}                                                                          
\=0A=
                                                                               
\=0A=
 -NcVal(TYPE)::NcVal(TYPE)(const NcVal(TYPE)& v)                                
      \=0A=
 +NcVal(TYPE)::NcVal(TYPE)(const NcVal(TYPE)& v) :                            
\=0A=
 +    NcValues(v)                                                               
      \=0A=
  {                                                                           
\=0A=
      delete[] the_values;                                                    
\=0A=
      the_values =3D new TYPE[v.the_number];                                  
\=0A=
 @@ -116,10 +117,13 @@=0A=
                                                                               
\=0A=
  NcVal(TYPE)& NcVal(TYPE)::operator=3D(const NcVal(TYPE)& v)                 
\=0A=
  {                                                                           
\=0A=
 -    delete[] the_values;                                                    
\=0A=
 -    the_values =3D new TYPE[v.the_number];                                  
\=0A=
 -    for(int i =3D 0; i < v.the_number; i++)                                 
\=0A=
 -      the_values[i] =3D v.the_values[i];                                      
      \=0A=
 +    if ( &v !=3D this) {                                                      
      \=0A=
 +      NcValues::operator=3D(v);                                               
        \=0A=
 +      delete[] the_values;                                                  
\=0A=
 +      the_values =3D new TYPE[v.the_number];                                
\=0A=
 +      for(int i =3D 0; i < v.the_number; i++)                               
\=0A=
 +        the_values[i] =3D v.the_values[i];                                  
\=0A=
 +    }                                                                       
\=0A=
      return *this;                                                           
\=0A=
  }                                                                           
\=0A=
                                                                               
\=0A=
 Only in netcdf-3.5.1-new/src/fortran: nfconfig.inc=0A=
 Only in netcdf-3.5.1-new/src/libsrc: ncconfig.h=0A=
 Only in netcdf-3.5.1-new/src: macros.make=0A=

 ------=_NextPart_000_0289_01C42E00.6AFCB300--

 --
 NOTE: All email exchanges with Unidata User Support are recorded in the
 Unidata inquiry tracking system and then made publically available
 through the web.  If you do not want to have your interactions made
 available in this way, you must let us know in each email you send to us.

 ------- End of Forwarded Message