diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2015-03-15 06:47:56 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2015-03-15 06:47:56 (GMT) |
commit | a382658282915afb7c288ef80b4d583a8ecc94fb (patch) | |
tree | 224facc01094af994eada1ba1535058b5c22539a /c++ | |
parent | 66a7cc1289bcae4d2ad91d500b8b1f636cc7ffd6 (diff) | |
download | hdf5-a382658282915afb7c288ef80b4d583a8ecc94fb.zip hdf5-a382658282915afb7c288ef80b4d583a8ecc94fb.tar.gz hdf5-a382658282915afb7c288ef80b4d583a8ecc94fb.tar.bz2 |
[svn-r26457] Purpose: Fix warnings HDFFV-8658
Description:
The following two constructors of classes: AbstractDs, IdComponent,
H5Location, and H5Object are no longer appropriate after the data member
"id" had been moved from IdComponent to the sub-classes.
The copy constructors are noop and will be generated by the compilers if
needed so they can be removed in 1.8.15 without effecting applications. The
other constructors will be removed from 1.10 release, and then from 1.8 if
their removal does not raise any problems in at least two 1.10 releases.
<Classname>(const hid_t h5_id);
<Classname>(const <Classname>& original);
Deprecation warnings are added to each of these classes.
The other classes are changed to call the default constructor instead of
one of the constructors above.
Platforms tested:
Linux/64 (platypus)
Linux/32 2.6 (jam)
SunOS 5.11 (emu)
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/H5AbstractDs.cpp | 13 | ||||
-rw-r--r-- | c++/src/H5AbstractDs.h | 16 | ||||
-rw-r--r-- | c++/src/H5DataSpace.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5DataType.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5IdComponent.cpp | 20 | ||||
-rw-r--r-- | c++/src/H5IdComponent.h | 9 | ||||
-rw-r--r-- | c++/src/H5Location.cpp | 19 | ||||
-rw-r--r-- | c++/src/H5Location.h | 10 | ||||
-rw-r--r-- | c++/src/H5Object.cpp | 29 | ||||
-rw-r--r-- | c++/src/H5Object.h | 13 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 2 |
11 files changed, 104 insertions, 31 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index e6cacf9..0e6ac00 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -40,6 +40,12 @@ AbstractDs::AbstractDs(){} // Function: AbstractDs default constructor ///\brief Creates an AbstractDs instance using an existing id. // Programmer Binh-Minh Ribler - 2000 +// +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It will be removed in 1.10 release. If its +// removal does not raise any problems in 1.10, it will be removed from 1.8 in +// subsequent releases. //-------------------------------------------------------------------------- AbstractDs::AbstractDs(const hid_t ds_id){} @@ -47,8 +53,13 @@ AbstractDs::AbstractDs(const hid_t ds_id){} // Function: AbstractDs copy constructor ///\brief Copy constructor: makes a copy of the original AbstractDs object. // Programmer Binh-Minh Ribler - 2000 +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It is removed from 1.8.15 because it is +// a noop and it can be generated by the compiler if needed. //-------------------------------------------------------------------------- -AbstractDs::AbstractDs(const AbstractDs& original){} +//-------------------------------------------------------------------------- +// AbstractDs::AbstractDs(const AbstractDs& original){} //-------------------------------------------------------------------------- // Function: AbstractDs::getTypeClass diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 01d05b8..8ed7967 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -70,9 +70,6 @@ class H5_DLLCPP AbstractDs { ///\brief Returns this class name. virtual H5std_string fromClass() const = 0; - // Copy constructor - AbstractDs( const AbstractDs& original ); - // Destructor virtual ~AbstractDs(); @@ -80,8 +77,17 @@ class H5_DLLCPP AbstractDs { // Default constructor AbstractDs(); - // Constructor that takes an attribute id or a dataset id. - AbstractDs( const hid_t ds_id ); + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. + + AbstractDs(const hid_t h5_id); + + // Copy constructor + // AbstractDs( const AbstractDs& original ); private: // This member function is implemented by DataSet and Attribute. diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 20b4e5e..761a454 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -93,7 +93,7 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent() ///\param original - IN: DataSpace object to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSpace::DataSpace(const DataSpace& original) : IdComponent(original) +DataSpace::DataSpace(const DataSpace& original) : IdComponent() { id = original.getId(); incRefCount(); // increment number of references to this id diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index a435b4e..c4b1694 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -134,7 +134,7 @@ DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, ///\brief Copy constructor: makes a copy of the original DataType object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType::DataType(const DataType& original) : H5Object(original) +DataType::DataType(const DataType& original) : H5Object() { id = original.getId(); incRefCount(); // increment number of references to this id diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 4a9dcac..54813ea 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -37,16 +37,28 @@ namespace H5 { ///\param h5_id - IN: Id of an existing object ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 +// +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It will be removed in 1.10 release. If its +// removal does not raise any problems in 1.10, it will be removed from 1.8 in +// subsequent releases. //-------------------------------------------------------------------------- IdComponent::IdComponent(const hid_t h5_id) {} //-------------------------------------------------------------------------- // Function: IdComponent copy constructor -///\brief Copy constructor: makes a copy of the original IdComponent object. -///\param original - IN: IdComponent instance to copy +// Purpose: This noop copy constructor is removed as a result of the data +// member "id" being moved down to sub-classes. (Mar 2015) +// Parameters: original - IN: IdComponent instance to copy // Programmer Binh-Minh Ribler - 2000 +// +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It is removed from 1.8.15 because it is +// a noop and it can be generated by the compiler if needed. //-------------------------------------------------------------------------- -IdComponent::IdComponent( const IdComponent& original ) {} +// IdComponent::IdComponent(const IdComponent& original) {} //-------------------------------------------------------------------------- // Function: IdComponent::incRefCount @@ -82,12 +94,14 @@ void IdComponent::decRefCount(const hid_t obj_id) const { if (p_valid_id(obj_id)) if (H5Idec_ref(obj_id) < 0) + { if (H5Iget_ref(obj_id) <= 0) throw IdComponentException(inMemFunc("decRefCount"), "object ref count is 0 or negative"); else throw IdComponentException(inMemFunc("decRefCount"), "decrementing object ref count failed"); + } } //-------------------------------------------------------------------------- diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 3208a39..f9fd56e 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -60,11 +60,18 @@ class H5_DLLCPP IdComponent { // Sets the identifier of this object to a new value. void setId(const hid_t new_id); + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. + // Creates an object to hold an HDF5 identifier. IdComponent( const hid_t h5_id ); // Copy constructor: makes copy of the original IdComponent object. - IdComponent( const IdComponent& original ); + // IdComponent( const IdComponent& original ); #ifndef DOXYGEN_SHOULD_SKIP_THIS // Pure virtual function for there are various H5*close for the diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index cd733c4..5cece19 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -70,17 +70,28 @@ H5Location::H5Location() : IdComponent() {} // object. // Parameters object_id - IN: Id of an existing HDF5 object // Programmer Binh-Minh Ribler - 2000 + +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It will be removed in 1.10 release. If its +// removal does not raise any problems in 1.10, it will be removed from 1.8 in +// subsequent releases. //-------------------------------------------------------------------------- -H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} +H5Location::H5Location(const hid_t object_id) : IdComponent() {} //-------------------------------------------------------------------------- // Function: H5Location copy constructor -///\brief Copy constructor: makes a copy of the original H5Location -/// instance. +// Purpose: This noop copy constructor is removed as a result of the data +// member "id" being moved down to sub-classes. (Mar 2015) ///\param original - IN: H5Location instance to copy // Programmer Binh-Minh Ribler - 2000 +// +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It is removed from 1.8.15 because it is +// a noop and it can be generated by the compiler if needed. //-------------------------------------------------------------------------- -H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} +// H5Location::H5Location(const H5Location& original) : IdComponent() {} #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index e015825..15b9ffd 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -138,13 +138,21 @@ class H5_DLLCPP H5Location : public IdComponent { // Default constructor H5Location(); +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. + // Creates a copy of an existing object giving the location id. H5Location(const hid_t loc_id); // Copy constructor. H5Location(const H5Location& original); -#ifndef DOXYGEN_SHOULD_SKIP_THIS // Creates a reference to an HDF5 object or a dataset region. void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 94b03ab..df3f565 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -50,8 +50,26 @@ H5Object::H5Object() : H5Location() {} // object. // Parameters object_id - IN: Id of an existing HDF5 object // Programmer Binh-Minh Ribler - 2000 +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It will be removed in 1.10 release. If its +// removal does not raise any problems in 1.10, it will be removed from 1.8 in +// subsequent releases. //-------------------------------------------------------------------------- -H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} +H5Object::H5Object(const hid_t object_id) : H5Location() {} + +//-------------------------------------------------------------------------- +// Function: H5Object copy constructor +///\brief Copy constructor: makes a copy of the original H5Object +/// instance. +///\param original - IN: H5Object instance to copy +// Programmer Binh-Minh Ribler - 2000 +// *** Deprecation warning *** +// This constructor is no longer appropriate because the data member "id" had +// been moved to the sub-classes. It is removed from 1.8.15 because it is +// a noop and it can be generated by the compiler if needed. +//-------------------------------------------------------------------------- +// H5Object::H5Object(const H5Object& original) : H5Location() {} //-------------------------------------------------------------------------- // Function: getObjName @@ -165,15 +183,6 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const } //-------------------------------------------------------------------------- -// Function: H5Object copy constructor -///\brief Copy constructor: makes a copy of the original H5Object -/// instance. -///\param original - IN: H5Object instance to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5Object::H5Object( const H5Object& original ) : H5Location( original ) {} - -//-------------------------------------------------------------------------- // Function: H5Object destructor ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 5576d13..f8ac792 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -47,9 +47,6 @@ namespace H5 { class H5_DLLCPP H5Object : public H5Location { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Copy constructor: makes copy of an H5Object object. - H5Object(const H5Object& original); - // Gets the name of this HDF5 object, i.e., Group, DataSet, or // DataType. ssize_t getObjName(char *obj_name, size_t buf_size = 0) const; @@ -63,9 +60,19 @@ class H5_DLLCPP H5Object : public H5Location { // Default constructor H5Object(); + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. + // Creates a copy of an existing object giving the object id H5Object( const hid_t object_id ); + // Copy constructor: makes copy of an H5Object object. + // H5Object(const H5Object& original); + #endif // DOXYGEN_SHOULD_SKIP_THIS }; /* end class H5Object */ diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 5afe80f..1d7d1ba 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -54,7 +54,7 @@ PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {} ///\param original - IN: The original property list to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList::PropList(const PropList& original) : IdComponent(original) +PropList::PropList(const PropList& original) : IdComponent() { id = original.getId(); incRefCount(); // increment number of references to this id |