summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataType.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2001-03-25 04:37:22 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2001-03-25 04:37:22 (GMT)
commitba6cba5d30f35b2b75e36477041f8c82df68ea30 (patch)
treed9c731155c569f7b4a1870bfa682969faf19b920 /c++/src/H5DataType.cpp
parent4432a558f91d7eb81a3eea9b0c6155b62b4ce342 (diff)
downloadhdf5-ba6cba5d30f35b2b75e36477041f8c82df68ea30.zip
hdf5-ba6cba5d30f35b2b75e36477041f8c82df68ea30.tar.gz
hdf5-ba6cba5d30f35b2b75e36477041f8c82df68ea30.tar.bz2
[svn-r3707] Purpose: Bug fixes and code clean up
Description and Solution: - Predefined type objects become outdated when the application calls H5close and then H5open to use the library again. Solution: + Reimplemented PredType using enum type to obtain up-to-date values for predefined types, i.e. H5T_xxx_yyy's, when they are used. + Added to PredType its own version of getId() to return the appropriate predefined type id according to the enum value. + Made IdComponent::getId() a virtual function - Since Albert already fixed the "multiply defined RcsId" problem, removed the now become unnessary "#undef RCSID" from H5Include.h - Added a check for func_name != NULL in one of the Exception constructors because seg. fault. might occur in some situations. - It is more convenient to make a copy of a datatype, dataspace, or property list by using assignment operator Solution: + Added assignment operator to DataType, DataSpace, and PropList so that they will invoke H5Tcopy, H5Scopy, and H5Pcopy, respectively, instead of just simply copying the data members as for other classes. So, now a type, space, or property list can be copied by either : mytype = original_type, or mytype.copy(original_type) Note that copy constructors are still just copying the data members. + Added an assignment operator to DataType that takes a predefined type. + Made IdComponent::operator= a virtual function Platforms tested: arabica (sparc-sun-solaris 2.7)
Diffstat (limited to 'c++/src/H5DataType.cpp')
-rw-r--r--c++/src/H5DataType.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index e8c00eb..a7de20b 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -68,6 +68,22 @@ void DataType::copy( const DataType& like_type )
}
}
+// Makes a copy of the type on the right hand side and stores the new
+// id in the left hand side object.
+DataType& DataType::operator=( const DataType& rhs )
+{
+ copy(rhs);
+ return(*this);
+}
+
+// Makes a copy of the predefined type and stores the new
+// id in the left hand side object.
+DataType& DataType::operator=( const PredType& rhs )
+{
+ copy(rhs);
+ return(*this);
+}
+
// Determines whether two datatypes refer to the same actual datatype.
bool DataType::operator==(const DataType& compared_type ) const
{