summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataSpace.cpp
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-01 14:47:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-01 14:47:19 (GMT)
commit2ca10d0ace6b55408919d9561002df24b1bcfbe7 (patch)
treedbdae2f2615ebca19d3c75989ef258cc9cc4ac80 /c++/src/H5DataSpace.cpp
parent1ec351813bd999925e4d4ba2a93f28b3c84c405f (diff)
downloadhdf5-2ca10d0ace6b55408919d9561002df24b1bcfbe7.zip
hdf5-2ca10d0ace6b55408919d9561002df24b1bcfbe7.tar.gz
hdf5-2ca10d0ace6b55408919d9561002df24b1bcfbe7.tar.bz2
[svn-r8602] Purpose:
Code update Description: Update C++ wrappers to use new ID reference counting mechanisms. Platforms tested: FreeBSD 4.9 (sleipnir) w/C++ Too focused to require h5committest
Diffstat (limited to 'c++/src/H5DataSpace.cpp')
-rw-r--r--c++/src/H5DataSpace.cpp55
1 files changed, 16 insertions, 39 deletions
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index 46ee18c..12fb269 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -21,9 +21,7 @@
#include "H5Include.h"
#include "H5Exception.h"
-#include "H5RefCounter.h"
#include "H5IdComponent.h"
-#include "H5Idtemplates.h"
#include "H5DataSpace.h"
#ifndef H5_NO_NAMESPACE
@@ -103,22 +101,20 @@ void DataSpace::copy( const DataSpace& like_space )
{
// reset the identifier of this instance - send 'this' in so that
// H5Sclose can be called appropriately
- try {
- resetIdComponent( this ); }
- catch (Exception close_error) { // thrown by p_close
- throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
- }
+ if( id != H5S_ALL ) { // not a constant, should call H5Sclose
+ try {
+ decRefCount();
+ }
+ catch (Exception close_error) {
+ throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
+ }
+ }
// call C routine to copy the dataspace
id = H5Scopy( like_space.getId() );
- // new ref counter for this id
- ref_count = new RefCounter;
-
if( id <= 0 )
- {
throw DataSpaceIException("DataSpace::copy", "H5Scopy failed");
- }
}
//--------------------------------------------------------------------------
@@ -542,28 +538,6 @@ void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const h
}
//--------------------------------------------------------------------------
-// Function: DataSpace::p_close (private)
-///\brief Closes the dataspace if it is not a constant
-///\exception H5::FileIException
-///\note
-/// This function will be obsolete because its functionality
-/// is recently handled by the C library layer.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void DataSpace::p_close() const
-{
- hid_t space_id = id;
- if( space_id != H5S_ALL ) // not a constant, should call H5Sclose
- {
- herr_t ret_value = H5Sclose( space_id );
- if( ret_value < 0 )
- {
- throw DataSpaceIException(0, "H5Sclose failed");
- }
- }
-}
-
-//--------------------------------------------------------------------------
// Function: DataSpace destructor
///\brief Properly terminates access to this dataspace.
// Programmer Binh-Minh Ribler - 2000
@@ -571,11 +545,14 @@ void DataSpace::p_close() const
DataSpace::~DataSpace()
{
// The dataspace id will be closed properly
- try {
- resetIdComponent( this ); }
- catch (Exception close_error) { // thrown by p_close
- cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl;
- }
+ if( id != H5S_ALL ) { // not a constant, should call H5Sclose
+ try {
+ decRefCount();
+ }
+ catch (Exception close_error) {
+ cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl;
+ }
+ }
}
#ifndef H5_NO_NAMESPACE