summaryrefslogtreecommitdiffstats
path: root/c++/src/H5IdComponent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5IdComponent.cpp')
-rw-r--r--c++/src/H5IdComponent.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 9f96277..c60d05c 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -144,6 +144,8 @@ int IdComponent::getCounter() const
//--------------------------------------------------------------------------
H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
{
+ if (obj_id == 0)
+ return H5I_BADID; // invalid
H5I_type_t id_type = H5Iget_type(obj_id);
if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
return H5I_BADID; // invalid
@@ -269,7 +271,7 @@ IdComponent::IdComponent() {}
// Description:
// This function is protected so that the user applications can
// only have access to its code via allowable classes, namely,
-// H5File and H5Object subclasses.
+// Attribute and H5Location subclasses.
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
H5std_string IdComponent::p_get_file_name() const
@@ -314,6 +316,9 @@ H5std_string IdComponent::p_get_file_name() const
//--------------------------------------------------------------------------
bool IdComponent::p_valid_id(const hid_t obj_id)
{
+ if (obj_id == 0)
+ return false;
+
H5I_type_t id_type = H5Iget_type(obj_id);
if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
return false;
@@ -321,6 +326,14 @@ bool IdComponent::p_valid_id(const hid_t obj_id)
return true;
}
+// Notes about IdComponent::id
+// May 2008 - BMR
+// Class hierarchy is revised to address bugzilla 1068...
+// ...member IdComponent::id is moved into subclasses, and
+// IdComponent::getId now becomes pure virtual function.
+// (reasons: 1. encountered problems when adding H5Location;
+// 2. Scott Meyers, item 33)
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
#ifndef H5_NO_NAMESPACE