diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-12-28 14:44:01 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-12-28 14:44:01 (GMT) |
commit | cd3bd5576f048ce1ca413921c76dcacf137d2110 (patch) | |
tree | 164e5f59fae1b339018f518560f89cd1c90a584b /c++/src | |
parent | b00962ac8694b14b74382f77d1cf849b93383fb5 (diff) | |
download | hdf5-cd3bd5576f048ce1ca413921c76dcacf137d2110.zip hdf5-cd3bd5576f048ce1ca413921c76dcacf137d2110.tar.gz hdf5-cd3bd5576f048ce1ca413921c76dcacf137d2110.tar.bz2 |
Purpose: Add new wrappers
Description:
Added wrappers H5Location::exists() for H5Lexists.
Added wrapper H5Object::objVersion() to return the header version
of an HDF5 object.
Added new class LinkAccPropList to be used by H5Location::exists()
Added new exception: ObjHeaderIException for H5Object::objVersion()
Rearranged source files in Makefile.am
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5AbstractDs.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5ArrayType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5AtomType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5Attribute.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5Classes.h | 1 | ||||
-rw-r--r-- | c++/src/H5CommonFG.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5CompType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5Cpp.h | 1 | ||||
-rw-r--r-- | c++/src/H5DataSet.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5DataType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5DcreatProp.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5EnumType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5Exception.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5Exception.h | 3 | ||||
-rw-r--r-- | c++/src/H5File.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5FloatType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5Group.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5IntType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5LaccProp.cpp | 114 | ||||
-rw-r--r-- | c++/src/H5LaccProp.h | 67 | ||||
-rw-r--r-- | c++/src/H5Library.cpp | 14 | ||||
-rw-r--r-- | c++/src/H5Location.cpp | 8 | ||||
-rw-r--r-- | c++/src/H5Location.h | 12 | ||||
-rw-r--r-- | c++/src/H5Object.cpp | 34 | ||||
-rw-r--r-- | c++/src/H5Object.h | 21 | ||||
-rw-r--r-- | c++/src/H5PredType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5StrType.cpp | 1 | ||||
-rw-r--r-- | c++/src/H5VarLenType.cpp | 1 | ||||
-rw-r--r-- | c++/src/Makefile.am | 35 |
29 files changed, 286 insertions, 44 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 49de4bb..9e76b55 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -24,6 +24,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataSpace.h" diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 46ac021..ecce591 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -21,6 +21,7 @@ #include "H5PropList.h" #include "H5OcreatProp.h" #include "H5DcreatProp.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 fa47e0c..22b163a 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -21,6 +21,7 @@ #include "H5PropList.h" #include "H5OcreatProp.h" #include "H5DcreatProp.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 c71c035..dfd2b28 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/H5Classes.h b/c++/src/H5Classes.h index bed0cae..03faa1a 100644 --- a/c++/src/H5Classes.h +++ b/c++/src/H5Classes.h @@ -25,6 +25,7 @@ namespace H5 { class PropList; class FileCreatPropList; class FileAccPropList; + class LinkAccPropList; class DSetCreatPropList; class DSetMemXferPropList; class DTypePropList; diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 018d3a2..5f7971f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -24,6 +24,7 @@ #include "H5DxferProp.h" #include "H5OcreatProp.h" #include "H5DcreatProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5Alltypes.h" diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index 0562e75..babda34 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -22,6 +22,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.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 90f0a2a..b86e0f3 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -27,6 +27,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.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 d3bf017..7c5b994 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -30,6 +30,7 @@ #include "H5OcreatProp.h" #include "H5DxferProp.h" #include "H5DcreatProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 3955ebf..372b2c9 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -30,6 +30,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index b307bde..8ab38dc 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -21,6 +21,7 @@ #include "H5PropList.h" #include "H5OcreatProp.h" #include "H5DcreatProp.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 a9f0b41..5e1f0bd 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -24,6 +24,7 @@ #include "H5DcreatProp.h" #include "H5DxferProp.h" #include "H5DataSpace.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 9c383a2..335bb20 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -424,7 +424,7 @@ DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_str //-------------------------------------------------------------------------- DataTypeIException::~DataTypeIException() throw() {} - /* //-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- // Subclass: ObjHeaderIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -446,7 +446,6 @@ ObjHeaderIException::ObjHeaderIException(const H5std_string& func, const H5std_s ///\brief Noop destructor. //-------------------------------------------------------------------------- ObjHeaderIException::~ObjHeaderIException() throw() {} - */ //-------------------------------------------------------------------------- // Subclass: PropListIException diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 81068f5..7112995 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -120,13 +120,12 @@ class H5_DLLCPP DataTypeIException : public Exception { virtual ~DataTypeIException() throw(); }; - /* class H5_DLLCPP ObjHeaderIException : public Exception { +class H5_DLLCPP ObjHeaderIException : public Exception { public: ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); ObjHeaderIException(); virtual ~ObjHeaderIException() throw(); }; - */ class H5_DLLCPP PropListIException : public Exception { public: diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 79f5471..fcf4e1c 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -29,6 +29,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/H5FloatType.cpp b/c++/src/H5FloatType.cpp index abc382d..73e8072 100644 --- a/c++/src/H5FloatType.cpp +++ b/c++/src/H5FloatType.cpp @@ -22,6 +22,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 4325a68..c976b00 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -29,6 +29,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.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 a60bcf3..38e2a7d 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -22,6 +22,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.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..e225b36 --- /dev/null +++ b/c++/src/H5LaccProp.cpp @@ -0,0 +1,114 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 <string> + +#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 - 2015 +//-------------------------------------------------------------------------- +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 - 2015 +//-------------------------------------------------------------------------- +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 - 2000 +//-------------------------------------------------------------------------- +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 - 2000 +//-------------------------------------------------------------------------- +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 - 2000 +//-------------------------------------------------------------------------- +LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) {} + +//-------------------------------------------------------------------------- +// Function: LinkAccPropList destructor +///\brief Noop destructor +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +LinkAccPropList::~LinkAccPropList() {} + +} // end namespace diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h new file mode 100644 index 0000000..2a84ffb --- /dev/null +++ b/c++/src/H5LaccProp.h @@ -0,0 +1,67 @@ +// 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); + + // 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 + +}; +} +#endif // __H5LinkAccPropList_H diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index 30be367..0ee6b4d 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -26,6 +26,7 @@ #include "H5OcreatProp.h" #include "H5DxferProp.h" #include "H5DcreatProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" @@ -185,28 +186,27 @@ void H5Library::initH5cpp() if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating PropList::deleteConstants failed"); - /* ret_value = std::atexit(LinkAccPropList::deleteConstants); + ret_value = std::atexit(LinkAccPropList::deleteConstants); if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating LinkAccPropList::deleteConstants failed"); - */ - ret_value = std::atexit(FileAccPropList::deleteConstants); + ret_value = std::atexit(FileAccPropList::deleteConstants); if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating FileAccPropList::deleteConstants failed"); - ret_value = std::atexit(FileCreatPropList::deleteConstants); + ret_value = std::atexit(FileCreatPropList::deleteConstants); if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating FileCreatPropList::deleteConstants failed"); - ret_value = std::atexit(DSetMemXferPropList::deleteConstants); + ret_value = std::atexit(DSetMemXferPropList::deleteConstants); if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating DSetMemXferPropList::deleteConstants failed"); - ret_value = std::atexit(DSetCreatPropList::deleteConstants); + ret_value = std::atexit(DSetCreatPropList::deleteConstants); if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating DSetCreatPropList::deleteConstants failed"); - ret_value = std::atexit(ObjCreatPropList::deleteConstants); + ret_value = std::atexit(ObjCreatPropList::deleteConstants); if (ret_value != 0) throw LibraryIException("H5Library::initH5cpp", "Registrating ObjCreatPropList::deleteConstants failed"); diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 91de0f5..a3e6738 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -26,6 +26,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" @@ -76,7 +77,7 @@ H5Location::H5Location() : IdComponent() {} #endif // DOXYGEN_SHOULD_SKIP_THIS - /* //-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- // Function: H5Location::exists ///\brief Checks if a link of a given name exists in a location ///\param name - IN: Searched name @@ -96,11 +97,9 @@ bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const { throwException("exists", "H5Lexists failed"); } - return false; // warning: control reaches end of non-void function } - */ - /* //-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- // Function: H5Location::exists ///\brief Checks if a link of a given name exists in a location ///\param name - IN: Searched name @@ -113,7 +112,6 @@ bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) c { return(exists(name.c_str(), lapl)); } - */ //-------------------------------------------------------------------------- // Function: H5Location::flush diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 795e7a7..6a449dc 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -33,15 +33,13 @@ namespace H5 { */ // Class forwarding class H5_DLLCPP ArrayType; - /* class H5_DLLCPP LinkAccPropList; // remove when done - */ +class H5_DLLCPP LinkAccPropList; class H5_DLLCPP VarLenType; class H5_DLLCPP H5Location : public IdComponent { public: - /* // Checks if a link of a given name exists in a location + // Checks if a link of a given name exists in a location bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; bool exists(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; @@ -213,9 +211,9 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; - // Sets the identifier of this object to a new value. - this one - // doesn't increment reference count - //virtual void p_setId(const hid_t new_id); + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + //virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index d656ccf..48d81f8 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -25,6 +25,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.h" +#include "H5LaccProp.h" #include "H5Location.h" #include "H5Object.h" #include "H5DataType.h" @@ -257,6 +258,39 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da } //-------------------------------------------------------------------------- +// Function: H5Object::objVersion +///\brief Returns the header version of this HDF5 object. +///\return Object version, which can have the following values: +/// \li \c H5O_VERSION_1 +/// \li \c H5O_VERSION_2 +///\exception H5::ObjHeaderIException +/// Exception will be thrown when: +/// - an error returned by the C API +/// - version number is not one of the valid values above +// Programmer Binh-Minh Ribler - December, 2016 +//-------------------------------------------------------------------------- +unsigned H5Object::objVersion() const +{ + H5O_info_t objinfo; + unsigned version = 0; + + // Use C API to get information of the object + herr_t ret_value = H5Oget_info(getId(), &objinfo); + + // Throw exception if C API returns failure + if (ret_value < 0) + throw Exception(inMemFunc("objVersion"), "H5Oget_info failed"); + // Return a valid version or throw an exception for invalid value + else + { + version = objinfo.hdr.version; + if (version != H5O_VERSION_1 && version != H5O_VERSION_2) + throw ObjHeaderIException("objVersion", "Invalid version for object"); + } + return(version); +} + +//-------------------------------------------------------------------------- // Function: H5Object::getNumAttrs ///\brief Returns the number of attributes attached to this HDF5 object. ///\return Number of attributes diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 72a9f50..5ea8937 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -77,6 +77,9 @@ class H5_DLLCPP H5Object : public H5Location { // Iterate user's function over the attributes of this object. int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL); + // Returns the object header version of an object + unsigned objVersion() const; + // Determines the number of attributes belong to this object. int getNumAttrs() const; @@ -106,12 +109,12 @@ class H5_DLLCPP H5Object : public H5Location { // Default constructor H5Object(); - // *** Deprecation warning *** - // The following two constructors are no longer appropriate after the - // data member "id" had been moved to the sub-classes. - // The copy constructor is a noop and is removed in 1.8.15 and the - // other will be removed from 1.10 release, and then from 1.8 if its - // removal does not raise any problems in two 1.10 releases. + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. // Creates a copy of an existing object giving the object id H5Object( const hid_t object_id ); @@ -119,9 +122,9 @@ class H5_DLLCPP H5Object : public H5Location { // Copy constructor: makes copy of an H5Object object. // H5Object(const H5Object& original); - // Sets the identifier of this object to a new value. - this one - // doesn't increment reference count - virtual void p_setId(const hid_t new_id) = 0; + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + virtual void p_setId(const hid_t new_id) = 0; // Noop destructor. virtual ~H5Object(); diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 0711020..e2eed18 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -21,6 +21,7 @@ #include "H5PropList.h" #include "H5OcreatProp.h" #include "H5DcreatProp.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 ca0ad56..50c9e45 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -22,6 +22,7 @@ #include "H5OcreatProp.h" #include "H5DcreatProp.h" #include "H5DxferProp.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 e14e1ce..5ecc39b 100644 --- a/c++/src/H5VarLenType.cpp +++ b/c++/src/H5VarLenType.cpp @@ -21,6 +21,7 @@ #include "H5PropList.h" #include "H5OcreatProp.h" #include "H5DcreatProp.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..6a3092e 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -33,25 +33,36 @@ 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 + +#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 # 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 \ + 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 + 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. |