summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-12-04 18:21:12 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-12-04 18:21:12 (GMT)
commite33d677636b860f8f6b95c0ee3736395541a2610 (patch)
treed70dd01c6e75aa27ef6d286c553de06625aa0b8d /c++/src
parentf116545ce465181928ca97214b9cfa87092a3ee9 (diff)
downloadhdf5-e33d677636b860f8f6b95c0ee3736395541a2610.zip
hdf5-e33d677636b860f8f6b95c0ee3736395541a2610.tar.gz
hdf5-e33d677636b860f8f6b95c0ee3736395541a2610.tar.bz2
Various code cleanup
Description: - Replaced H5Location::exists with H5Location::nameExists and marked H5Location::exists as deprecated. - Miscellaneous test cleanup for consistency. Platforms tested: Linux/32 2.6 (jam) Linux/64 (jelly) Darwin (osx1010test)
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5DataType.cpp2
-rw-r--r--c++/src/H5DataType.h11
-rw-r--r--c++/src/H5IntType.cpp2
-rw-r--r--c++/src/H5Location.cpp44
-rw-r--r--c++/src/H5Location.h5
5 files changed, 49 insertions, 15 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index d2bfbda..444a77a 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -899,7 +899,7 @@ hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const
// Call C function to open the named datatype at this location
hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT);
if (ret_value < 0)
- throw DataTypeIException("DataType constructor", "H5Topen2 failed");
+ throw DataTypeIException(inMemFunc("constructor"), "H5Topen2 failed");
return(ret_value);
}
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 5b8f924..906ccef 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -36,6 +36,10 @@ class H5_DLLCPP DataType : public H5Object {
// Creates a copy of a predefined type
DataType(const PredType& pred_type);
+ // Constructors to open a generic named datatype at a given location.
+ DataType(const H5Location& loc, const char* name);
+ DataType(const H5Location& loc, const H5std_string& name);
+
// Creates a datatype by way of dereference.
DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
// DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
@@ -124,13 +128,6 @@ class H5_DLLCPP DataType : public H5Object {
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataType"); }
-// From CommonFG then H5Location
- // Constructors to open a generic named datatype at a given location.
- DataType(const H5Location& loc, const char* name);
- DataType(const H5Location& loc, const H5std_string& name);
-
-// End of From CommonFG then H5Location
-
// Creates a copy of an existing DataType using its id
DataType(const hid_t type_id);
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index ef4e1a9..f68e858 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -117,7 +117,7 @@ IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
// Programmer Binh-Minh Ribler - Dec 2016
// Description
// In 1.10.1, this constructor was introduced and may replace the
-// existing function CommonFG::openArrayType(const H5std_string&)
+// existing function CommonFG::openIntType(const H5std_string&)
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index a00e181..d0b5f9d 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -76,15 +76,15 @@ H5Location::H5Location() : IdComponent() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::exists
+// Function: H5Location::nameExists
///\brief Checks if a link of a given name exists in a location
///\param name - IN: Searched name
///\param lapl - IN: Link access property list
///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Nov, 2016
// Modification
+// Renamed from exists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
+bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
{
htri_t ret_value = H5Lexists(getId(), name, lapl.getId());
if (ret_value > 0)
@@ -93,22 +93,54 @@ bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
return false;
else // Raise exception when H5Lexists returns a negative value
{
- throw LocationException(inMemFunc("exists"), "H5Lexists failed");
+ throw LocationException(inMemFunc("nameExists"), "H5Lexists failed");
}
}
//--------------------------------------------------------------------------
-// Function: H5Location::exists
+// Function: H5Location::nameExists
///\brief Checks if a link of a given name exists in a location
///\param name - IN: Searched name
///\param lapl - IN: Link access property list
///\exception H5::LocationException
+// Modification
+// Renamed from exists() in 1.10.2 -BMR
+//--------------------------------------------------------------------------
+bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ return(nameExists(name.c_str(), lapl));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::exists - Deprecated
+// Purpose Checks if a link of a given name exists in a location
+///\brief Deprecated in favor of nameExists
+///\param name - IN: Searched name
+///\param lapl - IN: Link access property list
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - Nov, 2016
+// Modification
+// Renamed to nameExists() in 1.10.2 -BMR
+//--------------------------------------------------------------------------
+bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
+{
+ return(nameExists(name, lapl));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::exists - Deprecated
+// Purpose Checks if a link of a given name exists in a location
+///\brief Deprecated in favor of nameExists
+///\param name - IN: Searched name
+///\param lapl - IN: Link access property list
+///\exception H5::LocationException
// Programmer Binh-Minh Ribler - Dec, 2016
// Modification
+// Renamed to nameExists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) const
{
- return(exists(name.c_str(), lapl));
+ return(nameExists(name.c_str(), lapl));
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 2631169..e5fbc84 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -31,6 +31,11 @@ namespace H5 {
class H5_DLLCPP H5Location : public IdComponent {
public:
// Checks if a link of a given name exists in a location
+ bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Checks if a link of a given name exists in a location
+ // Deprecated in favor of nameExists for better name.
bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;