From 8b1a53896565cafca3795d139a37148f89bf928d Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sat, 13 May 2017 06:00:33 -0500 Subject: Add H5Lexists wrappers Description: Added wrappers H5Location::exists() for H5Lexists. Added new class LinkAccPropList to be used by H5Location::exists() Rearranged source files in Makefile.am Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- MANIFEST | 2 + c++/src/H5AbstractDs.cpp | 1 + c++/src/H5ArrayType.cpp | 1 + c++/src/H5AtomType.cpp | 1 + c++/src/H5Attribute.cpp | 1 + c++/src/H5CommonFG.cpp | 1 + c++/src/H5CompType.cpp | 1 + c++/src/H5Cpp.h | 1 + c++/src/H5DataSet.cpp | 1 + c++/src/H5DataType.cpp | 1 + c++/src/H5DcreatProp.cpp | 1 + c++/src/H5EnumType.cpp | 1 + c++/src/H5File.cpp | 1 + c++/src/H5FloatType.cpp | 1 + c++/src/H5Group.cpp | 1 + c++/src/H5IntType.cpp | 1 + c++/src/H5LaccProp.cpp | 151 +++++++++++++++++++++++++++++++++++++++++++++++ c++/src/H5LaccProp.h | 75 +++++++++++++++++++++++ c++/src/H5Library.cpp | 6 ++ c++/src/H5Location.cpp | 37 ++++++++++++ c++/src/H5Location.h | 4 ++ c++/src/H5Object.cpp | 1 + c++/src/H5PredType.cpp | 1 + c++/src/H5StrType.cpp | 1 + c++/src/H5VarLenType.cpp | 1 + c++/src/Makefile.am | 29 +++++---- c++/src/Makefile.in | 44 +++++++------- c++/test/tattr.cpp | 11 +++- c++/test/tlinks.cpp | 8 +-- 29 files changed, 348 insertions(+), 38 deletions(-) create mode 100644 c++/src/H5LaccProp.cpp create mode 100644 c++/src/H5LaccProp.h diff --git a/MANIFEST b/MANIFEST index 24e00a8..8436591 100644 --- a/MANIFEST +++ b/MANIFEST @@ -392,6 +392,8 @@ ./c++/src/H5IntType.h ./c++/src/H5Library.cpp ./c++/src/H5Library.h +./c++/src/H5LaccProp.cpp +./c++/src/H5LaccProp.h ./c++/src/H5Location.cpp ./c++/src/H5Location.h ./c++/src/H5Object.cpp diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 4763bf2..4536afb 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5Alltypes.h" diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 4dc0a74..018eed5 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 0e57676..c9c1b46 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 55ccfe7..353a15c 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -29,6 +29,7 @@ #include "H5FcreatProp.h" #include "H5OcreatProp.h" #include "H5DcreatProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index d9a66e2..f1e45b8 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -25,6 +25,7 @@ #include "H5OcreatProp.h" #include "H5DxferProp.h" #include "H5DcreatProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5CommonFG.h" diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index 96fabd4..aff89f2 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5Alltypes.h" diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index 4e82ee3..42f925a 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -22,6 +22,7 @@ #include "H5IdComponent.h" #include "H5DataSpace.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 75d45b4..7b449d8 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -25,6 +25,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5OcreatProp.h" diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 625feaf..84e59e8 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -24,6 +24,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DxferProp.h" diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 53a96d1..0cd9458 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 9403cb8..acfae4e 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -20,6 +20,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 768ac5e..4d7177a 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -28,6 +28,7 @@ #include "H5FcreatProp.h" #include "H5OcreatProp.h" #include "H5DcreatProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5CommonFG.h" diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp index 9e64972..0a0bc1d 100644 --- a/c++/src/H5FloatType.cpp +++ b/c++/src/H5FloatType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 16a715c..a5d052c 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -26,6 +26,7 @@ #include "H5PropList.h" #include "H5OcreatProp.h" #include "H5DcreatProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index a9bb146..673bd7a 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp new file mode 100644 index 0000000..e457e83 --- /dev/null +++ b/c++/src/H5LaccProp.cpp @@ -0,0 +1,151 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +#include "H5Include.h" +#include "H5Exception.h" +#include "H5IdComponent.h" +#include "H5PropList.h" +#include "H5LaccProp.h" + +namespace H5 { + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control +// the order of creation and deletion of the global constants. See Design Notes +// in "H5PredType.cpp" for information. + +// Initialize a pointer for the constant +LinkAccPropList* LinkAccPropList::DEFAULT_ = 0; + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList::getConstant +// Creates a LinkAccPropList object representing the HDF5 constant +// H5P_LINK_ACCESS, pointed to by LinkAccPropList::DEFAULT_ +// exception H5::PropListIException +// Description +// If LinkAccPropList::DEFAULT_ already points to an allocated +// object, throw a PropListIException. This scenario should not +// happen. +// Programmer Binh-Minh Ribler - December, 2016 +//-------------------------------------------------------------------------- +LinkAccPropList* LinkAccPropList::getConstant() +{ + // Tell the C library not to clean up, H5Library::termH5cpp will call + // H5close - more dependency if use H5Library::dontAtExit() + if (!IdComponent::H5dontAtexit_called) + { + (void) H5dont_atexit(); + IdComponent::H5dontAtexit_called = true; + } + + // If the constant pointer is not allocated, allocate it. Otherwise, + // throw because it shouldn't be. + if (DEFAULT_ == 0) + DEFAULT_ = new LinkAccPropList(H5P_LINK_ACCESS); + else + throw PropListIException("LinkAccPropList::getConstant", "LinkAccPropList::getConstant is being invoked on an allocated DEFAULT_"); + return(DEFAULT_); +} + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList::deleteConstants +// Purpose: Deletes the constant object that LinkAccPropList::DEFAULT_ +// points to. +// exception H5::PropListIException +// Programmer Binh-Minh Ribler - December, 2016 +//-------------------------------------------------------------------------- +void LinkAccPropList::deleteConstants() +{ + if (DEFAULT_ != 0) + delete DEFAULT_; +} + +//-------------------------------------------------------------------------- +// Purpose: Constant for default property +//-------------------------------------------------------------------------- +const LinkAccPropList& LinkAccPropList::DEFAULT = *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +//-------------------------------------------------------------------------- +// Function: Default Constructor +///\brief Creates a file access property list +// Programmer Binh-Minh Ribler - December, 2016 +//-------------------------------------------------------------------------- +LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {} + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList copy constructor +///\brief Copy Constructor: makes a copy of the original +///\param original - IN: LinkAccPropList instance to copy +// Programmer Binh-Minh Ribler - December, 2016 +//-------------------------------------------------------------------------- +LinkAccPropList::LinkAccPropList(const LinkAccPropList& original) : PropList(original) {} + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList overloaded constructor +///\brief Creates a file access property list using the id of an +/// existing one. +// Programmer Binh-Minh Ribler - December, 2016 +//-------------------------------------------------------------------------- +LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) {} + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList::setNumLinks +///\brief Set the number of soft or user-defined link traversals allowed +/// before the library assumes it has found a cycle and aborts the +/// traversal. +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - March 1, 2017 +//-------------------------------------------------------------------------- +void LinkAccPropList::setNumLinks(size_t nlinks) const +{ + herr_t ret_value = H5Pset_nlinks(id, nlinks); + // Throw exception if H5Pset_nlinks returns failure + if (ret_value < 0) + { + throw PropListIException("setNumLinks", "H5Pset_nlinks failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList::getNumLinks +///\brief Gets the number of soft or user-defined links that can be +/// traversed before a failure occurs. +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - March 1, 2017 +//-------------------------------------------------------------------------- +size_t LinkAccPropList::getNumLinks() const +{ + size_t nlinks = 0; + herr_t ret_value = H5Pget_nlinks(id, &nlinks); + // Throw exception if H5Pget_nlinks returns failure + if (ret_value < 0) + { + throw PropListIException("getNumLinks", "H5Pget_nlinks failed"); + } + return(nlinks); +} + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList destructor +///\brief Noop destructor +// Programmer Binh-Minh Ribler - December, 2016 +//-------------------------------------------------------------------------- +LinkAccPropList::~LinkAccPropList() {} + +} // end namespace diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h new file mode 100644 index 0000000..f31c3fc --- /dev/null +++ b/c++/src/H5LaccProp.h @@ -0,0 +1,75 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +// Class LinkAccPropList represents the HDF5 file access property list and +// inherits from DataType. + +#ifndef __H5LinkAccPropList_H +#define __H5LinkAccPropList_H + +namespace H5 { + +/*! \class LinkAccPropList + \brief Class LinkAccPropList inherits from PropList and provides + wrappers for the HDF5 file access property list. + + Inheritance: PropList -> IdComponent +*/ +class H5_DLLCPP LinkAccPropList : public PropList { + public: + ///\brief Default file access property list. + static const LinkAccPropList& DEFAULT; + + // Creates a file access property list. + LinkAccPropList(); + + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("LinkAccPropList"); } + + // Copy constructor: creates a copy of a LinkAccPropList object. + LinkAccPropList(const LinkAccPropList& original); + + // Creates a copy of an existing file access property list + // using the property list id. + LinkAccPropList (const hid_t plist_id); + + // Sets the number of soft or user-defined links that can be + // traversed before a failure occurs. + void setNumLinks(size_t nlinks) const; + + // Gets the number of soft or user-defined link traversals allowed + size_t getNumLinks() const; + + // Noop destructor + virtual ~LinkAccPropList(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static LinkAccPropList* DEFAULT_; + + // Creates the global constant, should only be used by the library + static LinkAccPropList* getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of LinkAccPropList +} // namespace H5 + +#endif // __H5LinkAccPropList_H diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index b25dc90..7adc508 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -26,6 +26,8 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.h" +#include "H5LaccProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" @@ -185,6 +187,10 @@ void H5Library::initH5cpp() if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating PropList::deleteConstants failed"); + ret_value = std::atexit(LinkAccPropList::deleteConstants); + if (ret_value != 0) + throw LibraryIException("H5Library::initH5cpp", "Registrating LinkAccPropList::deleteConstants failed"); + ret_value = std::atexit(FileAccPropList::deleteConstants); if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating FileAccPropList::deleteConstants failed"); diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 60f9c3b..f10ad0d 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -20,6 +20,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" @@ -353,6 +354,42 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new } //-------------------------------------------------------------------------- +// 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 +//-------------------------------------------------------------------------- +bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const +{ + htri_t ret_value = H5Lexists(getId(), name, lapl.getId()); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Lexists returns a negative value + { + throw LocationException(inMemFunc("nameExists"), "H5Lexists failed"); + } +} + +//-------------------------------------------------------------------------- +// 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 - Dec, 2016 +// Modification +//-------------------------------------------------------------------------- +bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const +{ + return(nameExists(name.c_str(), lapl)); +} + +//-------------------------------------------------------------------------- // Function: H5Location::flush ///\brief Flushes all buffers associated with a location to disk. ///\param scope - IN: Specifies the scope of the flushing action, diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index edc2b53..11f8f87 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -57,6 +57,10 @@ class H5_DLLCPP H5Location : public IdComponent { // this location. virtual Attribute openAttribute(const unsigned int idx) const; + // Checks if a link of a given name exists in this location + bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + // Flushes all buffers associated with this location to disk. void flush(H5F_scope_t scope) const; diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 933e8ec..91d0f82 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -22,6 +22,7 @@ #include "H5PropList.h" #include "H5DataSpace.h" #include "H5AbstractDs.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Attribute.h" #include "H5Object.h" diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 52334ef..109f221 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index 4335ea7..e5355ff 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp index 32a5bd8..fc6d2ba 100644 --- a/c++/src/H5VarLenType.cpp +++ b/c++/src/H5VarLenType.cpp @@ -19,6 +19,7 @@ #include "H5Exception.h" #include "H5IdComponent.h" #include "H5PropList.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 6cd4768..f06b801 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -33,25 +33,28 @@ libhdf5_cpp_la_LDFLAGS= -version-info $(LT_CXX_VERS_INTERFACE):$(LT_CXX_VERS_REV bin_SCRIPTS=h5c++ # Source files for the library -libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ - H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \ - H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \ - H5OcreatProp.cpp H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp \ - H5AtomType.cpp H5PredType.cpp H5EnumType.cpp H5IntType.cpp \ - H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp \ - H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp +libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp \ + H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5LaccProp.cpp \ + H5DxferProp.cpp H5DcreatProp.cpp H5Location.cpp \ + H5AbstractDs.cpp H5Attribute.cpp H5Object.cpp \ + H5OcreatProp.cpp H5DataType.cpp H5AtomType.cpp \ + H5PredType.cpp H5EnumType.cpp H5IntType.cpp \ + H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp \ + H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \ + H5CommonFG.cpp H5Group.cpp H5File.cpp # HDF5 C++ library depends on HDF5 Library. libhdf5_cpp_la_LIBADD=$(LIBHDF5) # Public headers include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ - H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ - H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \ - H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \ - H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5Library.h \ - H5Location.h H5Object.h H5PredType.h H5PropList.h H5StrType.h \ - H5CppDoc.h H5ArrayType.h H5VarLenType.h + H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ + H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \ + H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \ + H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5LaccProp.h \ + H5Library.h H5Location.h H5Object.h H5PredType.h H5PropList.h \ + H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h # h5c++ and libhdf5.settings are generated during configure. Remove only when # distclean. diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 669a33d..cc6682e 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -152,13 +152,13 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5) am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \ - H5Library.lo H5Attribute.lo H5Location.lo H5Object.lo \ - H5PropList.lo H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo \ - H5DxferProp.lo H5OcreatProp.lo H5DataType.lo H5DataSpace.lo \ - H5AbstractDs.lo H5AtomType.lo H5PredType.lo H5EnumType.lo \ - H5IntType.lo H5FloatType.lo H5StrType.lo H5ArrayType.lo \ - H5VarLenType.lo H5CompType.lo H5DataSet.lo H5CommonFG.lo \ - H5Group.lo H5File.lo + H5DataSpace.lo H5PropList.lo H5Library.lo H5FaccProp.lo \ + H5FcreatProp.lo H5LaccProp.lo H5DxferProp.lo H5DcreatProp.lo \ + H5Location.lo H5AbstractDs.lo H5Attribute.lo H5Object.lo \ + H5OcreatProp.lo H5DataType.lo H5AtomType.lo H5PredType.lo \ + H5EnumType.lo H5IntType.lo H5FloatType.lo H5StrType.lo \ + H5ArrayType.lo H5VarLenType.lo H5CompType.lo H5DataSet.lo \ + H5CommonFG.lo H5Group.lo H5File.lo libhdf5_cpp_la_OBJECTS = $(am_libhdf5_cpp_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -712,13 +712,16 @@ libhdf5_cpp_la_LDFLAGS = -version-info $(LT_CXX_VERS_INTERFACE):$(LT_CXX_VERS_RE bin_SCRIPTS = h5c++ # Source files for the library -libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ - H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \ - H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \ - H5OcreatProp.cpp H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp \ - H5AtomType.cpp H5PredType.cpp H5EnumType.cpp H5IntType.cpp \ - H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp \ - H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp +libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp \ + H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5LaccProp.cpp \ + H5DxferProp.cpp H5DcreatProp.cpp H5Location.cpp \ + H5AbstractDs.cpp H5Attribute.cpp H5Object.cpp \ + H5OcreatProp.cpp H5DataType.cpp H5AtomType.cpp \ + H5PredType.cpp H5EnumType.cpp H5IntType.cpp \ + H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp \ + H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \ + H5CommonFG.cpp H5Group.cpp H5File.cpp # HDF5 C++ library depends on HDF5 Library. @@ -726,12 +729,12 @@ libhdf5_cpp_la_LIBADD = $(LIBHDF5) # Public headers include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ - H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ - H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \ - H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \ - H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5Library.h \ - H5Location.h H5Object.h H5PredType.h H5PropList.h H5StrType.h \ - H5CppDoc.h H5ArrayType.h H5VarLenType.h + H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ + H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \ + H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \ + H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5LaccProp.h \ + H5Library.h H5Location.h H5Object.h H5PredType.h H5PropList.h \ + H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h # h5c++ and libhdf5.settings are generated during configure. Remove only when @@ -896,6 +899,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Group.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IdComponent.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IntType.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LaccProp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Library.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Location.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Object.Plo@am__quote@ diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index bb33b2b..70c4003 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1561,11 +1561,20 @@ static void test_attr_exists() // Open a group. Group group = fid1.openGroup(GROUP1_NAME); - // Check for existence of attribute + // Check for existence of attribute, Group::attrExists attr_exists = group.attrExists(ATTR2_NAME); if (attr_exists == false) throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not"); + // Open attribute + Attribute attr = group.openAttribute(ATTR2_NAME); + + // Test the existence of a name using attribute as location, + // Attribute::nameExists + bool name_exists = attr.nameExists(GROUP1_NAME); + if (name_exists == false) + throw InvalidActionException("Attribute::nameExists", "group GROUP1_NAME should exist but does not"); + PASSED(); } // end try block diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index bb1ea17..0786bb5 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -422,10 +422,10 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); // Verify link existence - if(H5Lexists(file.getId(), "dset1", H5P_DEFAULT) != TRUE) - throw InvalidActionException("H5Lexists", "dset1 doesn't exist"); - if(H5Lexists(file.getId(), "grp1/soft", H5P_DEFAULT) != TRUE) - throw InvalidActionException("H5Lexists", "grp1/soft doesn't exist"); + if(file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist"); + if(file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist"); // Verify link values H5std_string softlink_val = file.getLinkval("grp1/soft"); -- cgit v0.12