From cf10cd648a2a63c05ab3ef8700c789d328d63421 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Thu, 4 Jan 2024 16:08:17 +0000 Subject: [PATCH 1/4] Inline `NcEnumType` ctor/dtor --- cxx4/ncEnumType.cpp | 25 ------------------------- cxx4/ncEnumType.h | 25 ++++--------------------- 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/cxx4/ncEnumType.cpp b/cxx4/ncEnumType.cpp index f3a3ad4..3670aca 100644 --- a/cxx4/ncEnumType.cpp +++ b/cxx4/ncEnumType.cpp @@ -20,13 +20,6 @@ using namespace netCDF::exceptions; // Class represents a netCDF variable. -// assignment operator -NcEnumType& NcEnumType::operator=(const NcEnumType& rhs) -{ - NcType::operator=(rhs); // assign base class parts - return *this; -} - // assignment operator NcEnumType& NcEnumType::operator=(const NcType& rhs) { @@ -39,24 +32,6 @@ NcEnumType& NcEnumType::operator=(const NcType& rhs) return *this; } -// The copy constructor. -NcEnumType::NcEnumType(const NcEnumType& rhs): - NcType(rhs) -{ -} - - -// Constructor generates a null object. -NcEnumType::NcEnumType() : - NcType() // invoke base class constructor -{} - -// constructor -NcEnumType::NcEnumType(const NcGroup& grp, const string& name): - NcType(grp,name) -{} - - // constructor NcEnumType::NcEnumType(const NcType& ncType): NcType(ncType) diff --git a/cxx4/ncEnumType.h b/cxx4/ncEnumType.h index c3e9fe1..ba1e620 100644 --- a/cxx4/ncEnumType.h +++ b/cxx4/ncEnumType.h @@ -28,17 +28,7 @@ namespace netCDF nc_UINT64 = NC_UINT64 //!< unsigned 8-byte int }; - /*! Constructor generates a \ref isNull "null object". */ - NcEnumType(); - - /*! - Constructor. - The enum Type must already exist in the netCDF file. New netCDF enum types can - be added using NcGroup::addNcEnumType(); - \param grp The parent group where this type is defined. - \param name Name of new type. - */ - NcEnumType(const NcGroup& grp, const std::string& name); + using NcType::NcType; /*! Constructor. @@ -47,22 +37,15 @@ namespace netCDF */ NcEnumType(const NcType& ncType); - /*! assignment operator */ - NcEnumType& operator=(const NcEnumType& rhs); + NcEnumType(const NcEnumType& rhs) = default; + NcEnumType& operator=(const NcEnumType& rhs) = default; /*! Assignment operator. This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of an Enum type. */ NcEnumType& operator=(const NcType& rhs); - - /*! The copy constructor. */ - NcEnumType(const NcEnumType& rhs); - - /*! Destructor */ - ~NcEnumType(){} - - + /*! Adds a new member to this NcEnumType type. \param name Name for this new Enum memebr. From c28ee8f38bd4f1c9c2f9fdd9998c08237141ab85 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Thu, 4 Jan 2024 16:09:43 +0000 Subject: [PATCH 2/4] Inline `NcCompoundType` ctor/dtors --- cxx4/ncCompoundType.cpp | 6 ------ cxx4/ncCompoundType.h | 16 +--------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/cxx4/ncCompoundType.cpp b/cxx4/ncCompoundType.cpp index c9ef42e..f230950 100644 --- a/cxx4/ncCompoundType.cpp +++ b/cxx4/ncCompoundType.cpp @@ -42,12 +42,6 @@ bool NcCompoundType::operator==(const NcCompoundType& rhs) return myId ==rhs.myId && groupId == rhs.groupId; } -// constructor -NcCompoundType::NcCompoundType(const NcGroup& grp, const string& name): - NcType(grp,name) -{ -} - // constructor // The copy constructor. NcCompoundType::NcCompoundType(const NcType& rhs): diff --git a/cxx4/ncCompoundType.h b/cxx4/ncCompoundType.h index bead2c7..e8a8f27 100644 --- a/cxx4/ncCompoundType.h +++ b/cxx4/ncCompoundType.h @@ -17,21 +17,7 @@ namespace netCDF class NcCompoundType : public NcType { public: - NcCompoundType() = default; - ~NcCompoundType() = default; - NcCompoundType(const NcCompoundType& rhs) = default; - NcCompoundType(NcCompoundType&& rhs) = default; - NcCompoundType& operator=(const NcCompoundType& rhs) = default; - NcCompoundType& operator=(NcCompoundType&& rhs) = default; - - /*! - Constructor. - The compound Type must already exist in the netCDF file. New netCDF compound types can be - added using NcGroup::addNcCompoundType(); - \param grp The parent group where this type is defined. - \param name Name of new type. - */ - NcCompoundType(const NcGroup& grp, const std::string& name); + using NcType::NcType; /*! Constructor. From ec6394cb0e57c4524b39618cf7df7a89491d39e4 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Thu, 4 Jan 2024 16:09:54 +0000 Subject: [PATCH 3/4] Remove unused private member from `NcCompoundType` --- cxx4/ncCompoundType.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cxx4/ncCompoundType.h b/cxx4/ncCompoundType.h index e8a8f27..f92305e 100644 --- a/cxx4/ncCompoundType.h +++ b/cxx4/ncCompoundType.h @@ -84,12 +84,6 @@ the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4). \return The size of the dimensions of the field. Non-array fields have 0 dimensions. */ std::vector getMemberShape(int memberIndex) const; - - - private: - - int myOffset; - }; } From 0a6d0f10035be9f39e974ded61b347d4f2fa1126 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Thu, 4 Jan 2024 15:44:42 +0000 Subject: [PATCH 4/4] Refactor classes for atomic types - make ctors all inline - use intermediate class `NcAtomic` to reduce duplication of equality operator - now classes are only a few lines each, move them all into `ncType.h` header --- cxx4/ncByte.cpp | 20 -------- cxx4/ncByte.h | 28 ----------- cxx4/ncChar.cpp | 18 ------- cxx4/ncChar.h | 24 --------- cxx4/ncCompoundType.cpp | 12 ----- cxx4/ncDouble.cpp | 18 ------- cxx4/ncDouble.h | 25 ---------- cxx4/ncEnumType.cpp | 12 ----- cxx4/ncFile.cpp | 1 - cxx4/ncFloat.cpp | 18 ------- cxx4/ncFloat.h | 24 --------- cxx4/ncGroup.cpp | 15 +----- cxx4/ncGroup.h | 2 +- cxx4/ncInt.cpp | 18 ------- cxx4/ncInt.h | 25 ---------- cxx4/ncInt64.cpp | 18 ------- cxx4/ncInt64.h | 25 ---------- cxx4/ncShort.cpp | 18 ------- cxx4/ncShort.h | 25 ---------- cxx4/ncString.cpp | 18 ------- cxx4/ncString.h | 25 ---------- cxx4/ncType.cpp | 13 +++++ cxx4/ncType.h | 106 ++++++++++++++++++++++++++++++++++++++++ cxx4/ncUbyte.cpp | 18 ------- cxx4/ncUbyte.h | 25 ---------- cxx4/ncUint.cpp | 18 ------- cxx4/ncUint.h | 25 ---------- cxx4/ncUint64.cpp | 18 ------- cxx4/ncUint64.h | 25 ---------- cxx4/ncUshort.cpp | 18 ------- cxx4/ncUshort.h | 25 ---------- cxx4/ncVar.h | 12 ----- cxx4/ncVlenType.cpp | 12 ----- cxx4/netcdf | 12 ----- 34 files changed, 122 insertions(+), 594 deletions(-) delete mode 100644 cxx4/ncByte.cpp delete mode 100644 cxx4/ncByte.h delete mode 100644 cxx4/ncChar.cpp delete mode 100644 cxx4/ncChar.h delete mode 100644 cxx4/ncDouble.cpp delete mode 100644 cxx4/ncDouble.h delete mode 100644 cxx4/ncFloat.cpp delete mode 100644 cxx4/ncFloat.h delete mode 100644 cxx4/ncInt.cpp delete mode 100644 cxx4/ncInt.h delete mode 100644 cxx4/ncInt64.cpp delete mode 100644 cxx4/ncInt64.h delete mode 100644 cxx4/ncShort.cpp delete mode 100644 cxx4/ncShort.h delete mode 100644 cxx4/ncString.cpp delete mode 100644 cxx4/ncString.h delete mode 100644 cxx4/ncUbyte.cpp delete mode 100644 cxx4/ncUbyte.h delete mode 100644 cxx4/ncUint.cpp delete mode 100644 cxx4/ncUint.h delete mode 100644 cxx4/ncUint64.cpp delete mode 100644 cxx4/ncUint64.h delete mode 100644 cxx4/ncUshort.cpp delete mode 100644 cxx4/ncUshort.h diff --git a/cxx4/ncByte.cpp b/cxx4/ncByte.cpp deleted file mode 100644 index c14dd1c..0000000 --- a/cxx4/ncByte.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "ncByte.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcByte called netCDF::ncByte -namespace netCDF { - NcByte ncByte; -} - -// constructor -NcByte::NcByte() : NcType(NC_BYTE){ -} - -int NcByte::sizeoff(){char a;return sizeof(a);}; - -// equivalence operator -bool NcByte::operator==(const NcByte & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncByte.h b/cxx4/ncByte.h deleted file mode 100644 index cb48979..0000000 --- a/cxx4/ncByte.h +++ /dev/null @@ -1,28 +0,0 @@ -#include "ncType.h" - -#ifndef NcByteClass -#define NcByteClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Byte type. */ - class NcByte : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcByte & rhs); - - /*! storage size */ - int sizeoff(); - - /*! Constructor */ - NcByte(); - }; - - /*! A global instance of the NcByte class within the netCDF namespace. */ - extern NcByte ncByte; - -} -#endif diff --git a/cxx4/ncChar.cpp b/cxx4/ncChar.cpp deleted file mode 100644 index fdd30a2..0000000 --- a/cxx4/ncChar.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncChar.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcChar called netCDF::ncChar -namespace netCDF { - NcChar ncChar; -} - -// constructor -NcChar::NcChar() : NcType(NC_CHAR){ -} - -// equivalence operator -bool NcChar::operator==(const NcChar & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncChar.h b/cxx4/ncChar.h deleted file mode 100644 index e6d3f33..0000000 --- a/cxx4/ncChar.h +++ /dev/null @@ -1,24 +0,0 @@ -#include "ncType.h" - -#ifndef NcCharClass -#define NcCharClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Char type. */ - class NcChar : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcChar & rhs); - - NcChar(); - }; - - /*! A global instance of the NcChar class within the netCDF namespace. */ - extern NcChar ncChar; - -} -#endif diff --git a/cxx4/ncCompoundType.cpp b/cxx4/ncCompoundType.cpp index f230950..cc88b68 100644 --- a/cxx4/ncCompoundType.cpp +++ b/cxx4/ncCompoundType.cpp @@ -1,18 +1,6 @@ #include "ncGroup.h" #include "ncCheck.h" #include "ncCompoundType.h" -#include "ncByte.h" -#include "ncUbyte.h" -#include "ncChar.h" -#include "ncShort.h" -#include "ncUshort.h" -#include "ncInt.h" -#include "ncUint.h" -#include "ncInt64.h" -#include "ncUint64.h" -#include "ncFloat.h" -#include "ncDouble.h" -#include "ncString.h" #include "ncException.h" using namespace std; diff --git a/cxx4/ncDouble.cpp b/cxx4/ncDouble.cpp deleted file mode 100644 index de2ee8e..0000000 --- a/cxx4/ncDouble.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncDouble.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcDouble called netCDF::ncDouble -namespace netCDF { - NcDouble ncDouble; -} - -// constructor -NcDouble::NcDouble() : NcType(NC_DOUBLE){ -} - -// equivalence operator -bool NcDouble::operator==(const NcDouble & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncDouble.h b/cxx4/ncDouble.h deleted file mode 100644 index d618f59..0000000 --- a/cxx4/ncDouble.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcDoubleClass -#define NcDoubleClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Double type. */ - class NcDouble : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcDouble & rhs); - - /*! Constructor */ - NcDouble(); - }; - - /*! A global instance of the NcDouble class within the netCDF namespace. */ - extern NcDouble ncDouble; - -} -#endif diff --git a/cxx4/ncEnumType.cpp b/cxx4/ncEnumType.cpp index 3670aca..8cbd18e 100644 --- a/cxx4/ncEnumType.cpp +++ b/cxx4/ncEnumType.cpp @@ -1,18 +1,6 @@ #include "ncEnumType.h" #include "ncGroup.h" #include "ncCheck.h" -#include "ncByte.h" -#include "ncUbyte.h" -#include "ncChar.h" -#include "ncShort.h" -#include "ncUshort.h" -#include "ncInt.h" -#include "ncUint.h" -#include "ncInt64.h" -#include "ncUint64.h" -#include "ncFloat.h" -#include "ncDouble.h" -#include "ncString.h" #include "ncException.h" using namespace std; using namespace netCDF; diff --git a/cxx4/ncFile.cpp b/cxx4/ncFile.cpp index 34367bf..1d9eff7 100644 --- a/cxx4/ncFile.cpp +++ b/cxx4/ncFile.cpp @@ -1,7 +1,6 @@ #include "ncFile.h" #include "ncCheck.h" #include "ncException.h" -#include "ncByte.h" #include #include #include diff --git a/cxx4/ncFloat.cpp b/cxx4/ncFloat.cpp deleted file mode 100644 index f09e1c5..0000000 --- a/cxx4/ncFloat.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncFloat.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcFloat called netCDF::ncFloat -namespace netCDF { - NcFloat ncFloat; -} - -// constructor -NcFloat::NcFloat() : NcType(NC_FLOAT){ -} - -// equivalence operator -bool NcFloat::operator==(const NcFloat & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncFloat.h b/cxx4/ncFloat.h deleted file mode 100644 index 2e08cf5..0000000 --- a/cxx4/ncFloat.h +++ /dev/null @@ -1,24 +0,0 @@ -#include "ncType.h" - -#ifndef NcFloatClass -#define NcFloatClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Float type. */ - class NcFloat : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcFloat & rhs); - /*! Constructor */ - NcFloat(); - }; - - /*! A global instance of the NcFloat class within the netCDF namespace. */ - extern NcFloat ncFloat; - -} -#endif diff --git a/cxx4/ncGroup.cpp b/cxx4/ncGroup.cpp index 9c06f27..965dd5f 100644 --- a/cxx4/ncGroup.cpp +++ b/cxx4/ncGroup.cpp @@ -5,18 +5,7 @@ #include "ncCompoundType.h" #include "ncOpaqueType.h" #include "ncGroupAtt.h" -#include "ncByte.h" -#include "ncUbyte.h" -#include "ncChar.h" -#include "ncShort.h" -#include "ncUshort.h" -#include "ncInt.h" -#include "ncUint.h" -#include "ncInt64.h" -#include "ncUint64.h" -#include "ncFloat.h" -#include "ncDouble.h" -#include "ncString.h" + #include #include #include "ncCheck.h" @@ -1237,7 +1226,7 @@ NcEnumType NcGroup::addEnumType(const string& name,NcEnumType::ncEnumType baseTy // Adds a new netCDF Vlen type. -NcVlenType NcGroup::addVlenType(const string& name,NcType& baseType) const { +NcVlenType NcGroup::addVlenType(const string& name, const NcType& baseType) const { ncCheckDefineMode(myId); nc_type typeId; ncCheck(nc_def_vlen(myId, name.c_str(), baseType.getId(),&typeId),__FILE__,__LINE__); diff --git a/cxx4/ncGroup.h b/cxx4/ncGroup.h index 1f7e211..cb034d0 100644 --- a/cxx4/ncGroup.h +++ b/cxx4/ncGroup.h @@ -511,7 +511,7 @@ namespace netCDF \param basetype A NcType object to be used for the basetype. \return The NcVlenType object for this new netCDF vlen type. */ - NcVlenType addVlenType(const std::string& name,NcType& basetype) const; + NcVlenType addVlenType(const std::string& name, const NcType& basetype) const; /*! diff --git a/cxx4/ncInt.cpp b/cxx4/ncInt.cpp deleted file mode 100644 index 67d7afc..0000000 --- a/cxx4/ncInt.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncInt.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcInt called netCDF::ncInt -namespace netCDF { - NcInt ncInt; -} - -// constructor -NcInt::NcInt() : NcType(NC_INT){ -} - -// equivalence operator -bool NcInt::operator==(const NcInt & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncInt.h b/cxx4/ncInt.h deleted file mode 100644 index e952ca3..0000000 --- a/cxx4/ncInt.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcIntClass -#define NcIntClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Int type. */ - class NcInt : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcInt & rhs); - - /*! Constructor */ - NcInt(); - }; - - /*! A global instance of the NcInt class within the netCDF namespace. */ - extern NcInt ncInt; - -} -#endif diff --git a/cxx4/ncInt64.cpp b/cxx4/ncInt64.cpp deleted file mode 100644 index b0125e3..0000000 --- a/cxx4/ncInt64.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncInt64.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcInt64 called netCDF::ncInt64 -namespace netCDF { - NcInt64 ncInt64; -} - -// constructor -NcInt64::NcInt64() : NcType(NC_INT64){ -} - -// equivalence operator -bool NcInt64::operator==(const NcInt64 & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncInt64.h b/cxx4/ncInt64.h deleted file mode 100644 index 1d1250e..0000000 --- a/cxx4/ncInt64.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcInt64Class -#define NcInt64Class - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Int64 type. */ - class NcInt64 : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcInt64 & rhs); - - /*! Constructor */ - NcInt64(); - }; - - /*! A global instance of the NcInt64 class within the netCDF namespace. */ - extern NcInt64 ncInt64; - -} -#endif diff --git a/cxx4/ncShort.cpp b/cxx4/ncShort.cpp deleted file mode 100644 index a27f469..0000000 --- a/cxx4/ncShort.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncShort.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcShort called netCDF::ncShort -namespace netCDF { - NcShort ncShort; -} - -// constructor -NcShort::NcShort() : NcType(NC_SHORT){ -} - -// equivalence operator -bool NcShort::operator==(const NcShort & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncShort.h b/cxx4/ncShort.h deleted file mode 100644 index 5ed8ca4..0000000 --- a/cxx4/ncShort.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcShortClass -#define NcShortClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Short type. */ - class NcShort : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcShort & rhs); - - /*! Constructor */ - NcShort(); - }; - - /*! A global instance of the NcShort class within the netCDF namespace. */ - extern NcShort ncShort; - -} -#endif diff --git a/cxx4/ncString.cpp b/cxx4/ncString.cpp deleted file mode 100644 index 8a1de41..0000000 --- a/cxx4/ncString.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncString.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcString called netCDF::ncString -namespace netCDF { - NcString ncString; -} - -// constructor -NcString::NcString() : NcType(NC_STRING){ -} - -// equivalence operator -bool NcString::operator==(const NcString & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncString.h b/cxx4/ncString.h deleted file mode 100644 index 4de9797..0000000 --- a/cxx4/ncString.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcStringClass -#define NcStringClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic String type. */ - class NcString : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcString & rhs); - - /*! Constructor */ - NcString(); - }; - - /*! A global instance of the NcString class within the netCDF namespace. */ - extern NcString ncString; - -} -#endif diff --git a/cxx4/ncType.cpp b/cxx4/ncType.cpp index bcb01a2..d607e87 100644 --- a/cxx4/ncType.cpp +++ b/cxx4/ncType.cpp @@ -19,6 +19,19 @@ namespace netCDF { { return true; } + + const NcByte ncByte{}; + const NcUbyte ncUbyte{}; + const NcChar ncChar{}; + const NcShort ncShort{}; + const NcUshort ncUshort{}; + const NcInt ncInt{}; + const NcUint ncUint{}; + const NcInt64 ncInt64{}; + const NcUint64 ncUint64{}; + const NcFloat ncFloat{}; + const NcDouble ncDouble{}; + const NcString ncString{}; } using namespace netCDF; diff --git a/cxx4/ncType.h b/cxx4/ncType.h index 37213f3..cd962df 100644 --- a/cxx4/ncType.h +++ b/cxx4/ncType.h @@ -147,5 +147,111 @@ namespace netCDF /*! the group Id */ int groupId{-1}; }; + + /// Intermediate base class for atomic types + class NcAtomic : public NcType { + public: + using NcType::NcType; + + bool operator==(const NcAtomic& rhs) { + return myId == rhs.myId; + } + }; + + /// netCDF atomic byte type + class NcByte : public NcAtomic { + public: + NcByte() : NcAtomic(NC_BYTE) {} + }; + + extern const NcByte ncByte; + + /// netCDF atomic unsigned byte type + class NcUbyte : public NcAtomic { + public: + NcUbyte() : NcAtomic(NC_UBYTE) {} + }; + + extern const NcUbyte ncUbyte; + + /// netCDF atomic char type + class NcChar : public NcAtomic { + public: + NcChar() : NcAtomic(NC_CHAR) {} + }; + + extern const NcChar ncChar; + + /// netCDF atomic short type + class NcShort : public NcAtomic { + public: + NcShort() : NcAtomic(NC_SHORT) {} + }; + + extern const NcShort ncShort; + + /// netCDF atomic unsigned short type + class NcUshort : public NcAtomic { + public: + NcUshort() : NcAtomic(NC_USHORT) {} + }; + + extern const NcUshort ncUshort; + + /// netCDF atomic int type + class NcInt : public NcAtomic { + public: + NcInt() : NcAtomic(NC_INT) {} + }; + + extern const NcInt ncInt; + + /// netCDF atomic unsigned int type + class NcUint : public NcAtomic { + public: + NcUint() : NcAtomic(NC_UINT) {} + }; + + extern const NcUint ncUint; + + /// netCDF atomic 64-bit int type + class NcInt64 : public NcAtomic { + public: + NcInt64() : NcAtomic(NC_INT64) {} + }; + + extern const NcInt64 ncInt64; + + /// netCDF atomic unsigned 64-bit int type + class NcUint64 : public NcAtomic { + public: + NcUint64() : NcAtomic(NC_UINT64) {} + }; + + extern const NcUint64 ncUint64; + + /// netCDF atomic float type + class NcFloat : public NcAtomic { + public: + NcFloat() : NcAtomic(NC_FLOAT) {} + }; + + extern const NcFloat ncFloat; + + /// netCDF atomic double type + class NcDouble : public NcAtomic { + public: + NcDouble() : NcAtomic(NC_DOUBLE) {} + }; + + extern const NcDouble ncDouble; + + /// netCDF atomic string type + class NcString : public NcAtomic { + public: + NcString() : NcAtomic(NC_STRING) {} + }; + + extern const NcString ncString; } #endif diff --git a/cxx4/ncUbyte.cpp b/cxx4/ncUbyte.cpp deleted file mode 100644 index e4ba043..0000000 --- a/cxx4/ncUbyte.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncUbyte.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcUbyte called netCDF::ncUbyte -namespace netCDF { - NcUbyte ncUbyte; -} - -// constructor -NcUbyte::NcUbyte() : NcType(NC_UBYTE){ -} - -// equivalence operator -bool NcUbyte::operator==(const NcUbyte & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncUbyte.h b/cxx4/ncUbyte.h deleted file mode 100644 index 4a5b876..0000000 --- a/cxx4/ncUbyte.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcUbyteClass -#define NcUbyteClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Ubyte type. */ - class NcUbyte : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcUbyte & rhs); - - /*! Constructor */ - NcUbyte(); - }; - - /*! A global instance of the NcUbyte class within the netCDF namespace. */ - extern NcUbyte ncUbyte; - -} -#endif diff --git a/cxx4/ncUint.cpp b/cxx4/ncUint.cpp deleted file mode 100644 index 843c4f6..0000000 --- a/cxx4/ncUint.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncUint.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcUint called netCDF::ncUint -namespace netCDF { - NcUint ncUint; -} - -// constructor -NcUint::NcUint() : NcType(NC_UINT){ -} - -// equivalence operator -bool NcUint::operator==(const NcUint & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncUint.h b/cxx4/ncUint.h deleted file mode 100644 index 8647205..0000000 --- a/cxx4/ncUint.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcUintClass -#define NcUintClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Uint type. */ - class NcUint : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcUint & rhs); - - /*! Constructor */ - NcUint(); - }; - - /*! A global instance of the NcUint class within the netCDF namespace. */ - extern NcUint ncUint; - -} -#endif diff --git a/cxx4/ncUint64.cpp b/cxx4/ncUint64.cpp deleted file mode 100644 index 085bb70..0000000 --- a/cxx4/ncUint64.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncUint64.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcUint64 called netCDF::ncUint64 -namespace netCDF { - NcUint64 ncUint64; -} - -// constructor -NcUint64::NcUint64() : NcType(NC_UINT64){ -} - -// equivalence operator -bool NcUint64::operator==(const NcUint64 & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncUint64.h b/cxx4/ncUint64.h deleted file mode 100644 index 0b51f85..0000000 --- a/cxx4/ncUint64.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcUint64Class -#define NcUint64Class - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Uint64 type.*/ - class NcUint64 : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcUint64 & rhs); - - /*! Constructor */ - NcUint64(); - }; - - /*! A global instance of the NcUint64 class within the netCDF namespace. */ - extern NcUint64 ncUint64; - -} -#endif diff --git a/cxx4/ncUshort.cpp b/cxx4/ncUshort.cpp deleted file mode 100644 index 4af5770..0000000 --- a/cxx4/ncUshort.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ncUshort.h" -#include "netcdf.h" -using namespace netCDF; - -// create an instance of NcUshort called netCDF::ncUshort -namespace netCDF { - NcUshort ncUshort; -} - -// constructor -NcUshort::NcUshort() : NcType(NC_USHORT){ -} - -// equivalence operator -bool NcUshort::operator==(const NcUshort & rhs) { - // simply check the netCDF id. - return myId == rhs.myId; -} diff --git a/cxx4/ncUshort.h b/cxx4/ncUshort.h deleted file mode 100644 index 9ae1a54..0000000 --- a/cxx4/ncUshort.h +++ /dev/null @@ -1,25 +0,0 @@ -#include "ncType.h" - -#ifndef NcUshortClass -#define NcUshortClass - -namespace netCDF -{ - - /*! Class represents a netCDF atomic Ushort type. */ - class NcUshort : public NcType - { - public: - - /*! equivalence operator */ - bool operator==(const NcUshort & rhs); - - /*! Constructor */ - NcUshort(); - }; - - // declare that the class instance ncUshort is known by all.... - extern NcUshort ncUshort; - -} -#endif diff --git a/cxx4/ncVar.h b/cxx4/ncVar.h index a964821..3388345 100644 --- a/cxx4/ncVar.h +++ b/cxx4/ncVar.h @@ -6,18 +6,6 @@ #include "netcdf.h" #include "ncVarAtt.h" #include "ncGroup.h" -#include "ncByte.h" -#include "ncUbyte.h" -#include "ncChar.h" -#include "ncShort.h" -#include "ncUshort.h" -#include "ncInt.h" -#include "ncUint.h" -#include "ncInt64.h" -#include "ncUint64.h" -#include "ncFloat.h" -#include "ncDouble.h" -#include "ncString.h" #ifndef NcVarClass #define NcVarClass diff --git a/cxx4/ncVlenType.cpp b/cxx4/ncVlenType.cpp index 8d32613..9c15795 100644 --- a/cxx4/ncVlenType.cpp +++ b/cxx4/ncVlenType.cpp @@ -2,18 +2,6 @@ #include "ncGroup.h" #include "ncCheck.h" #include "ncException.h" -#include "ncByte.h" -#include "ncUbyte.h" -#include "ncChar.h" -#include "ncShort.h" -#include "ncUshort.h" -#include "ncInt.h" -#include "ncUint.h" -#include "ncInt64.h" -#include "ncUint64.h" -#include "ncFloat.h" -#include "ncDouble.h" -#include "ncString.h" #include using namespace std; using namespace netCDF; diff --git a/cxx4/netcdf b/cxx4/netcdf index 18f7734..7ef4296 100644 --- a/cxx4/netcdf +++ b/cxx4/netcdf @@ -5,28 +5,16 @@ extern "C" { #include } #include -#include -#include #include #include #include -#include #include #include #include -#include #include #include -#include -#include #include -#include -#include #include -#include -#include -#include -#include #include #include #include