summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5DataType.cpp25
-rw-r--r--c++/src/H5DataType.h3
-rw-r--r--c++/src/H5DcreatProp.cpp50
-rw-r--r--c++/src/H5DcreatProp.h5
-rw-r--r--c++/src/H5FaccProp.h6
-rw-r--r--c++/src/H5Group.cpp50
-rw-r--r--c++/src/H5Group.h7
-rw-r--r--c++/src/H5IdComponent.cpp21
-rw-r--r--c++/src/H5IdComponent.h4
-rw-r--r--c++/src/H5LaccProp.cpp49
-rw-r--r--c++/src/H5LaccProp.h7
11 files changed, 219 insertions, 8 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index ae48d16..1cfc259 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -744,6 +744,31 @@ bool DataType::isVariableStr() const
}
//--------------------------------------------------------------------------
+// Function: DataType::getCreatePlist
+///\brief Returns a copy of the property list, which is for datatype
+/// creation.
+///\return A property list object
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - March, 2017
+// Description
+// Currently, there is no datatype creation property list class
+// in the C++ API because there is no associated functionality.
+//--------------------------------------------------------------------------
+PropList DataType::getCreatePlist() const
+{
+ hid_t create_plist_id = H5Tget_create_plist(id);
+ if (create_plist_id < 0)
+ {
+ throw DataTypeIException(inMemFunc("getCreatePlist"),
+ "H5Tget_create_plist returns negative value");
+ }
+ // create and return the DSetCreatPropList object
+ PropList create_plist;
+ f_PropList_setId(&create_plist, create_plist_id);
+ return(create_plist);
+}
+
+//--------------------------------------------------------------------------
// Function: DataType::getId
///\brief Get the id of this datatype
///\return Datatype identifier
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index fd9c17d..6501bb9 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -113,6 +113,9 @@ class H5_DLLCPP DataType : public H5Object {
// Checks whether this datatype is a variable-length string.
bool isVariableStr() const;
+ // Returns a copy of the creation property list of a datatype.
+ PropList getCreatePlist() const;
+
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataType"); }
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 86d4d9c..e1be3c4 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -18,6 +18,7 @@
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
+#include "H5DataSpace.h"
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
@@ -740,6 +741,55 @@ void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name,
}
//--------------------------------------------------------------------------
+// Function: DSetCreatPropList::setVirtual
+///\brief Maps elements of a virtual dataset to elements of the source
+/// dataset.
+///\param vspace - IN: Dataspace the virtual dataset, possibly an
+/// unlimited selection
+///\param src_fname - IN: Name of the HDF5 file where the source dataset
+/// is located (\a char*)
+///\param src_fname - IN: Path to the dataset in the file specified by
+/// \a src_file_name (\a char*)
+///\param sspace - IN: Dataspace with a selection applied, possibly
+/// an unlimited selection
+///\exception H5::PropListIException
+///\par Description
+/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetVirtual
+// Programmer Binh-Minh Ribler - Mar, 2017
+//--------------------------------------------------------------------------
+void DSetCreatPropList::setVirtual(const DataSpace& vspace, const char *src_fname, const char *src_dsname, const DataSpace& sspace) const
+{
+ herr_t ret_value = H5Pset_virtual(id, vspace.getId(), src_fname, src_dsname, sspace.getId());
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setVirtual",
+ "H5Pset_virtual failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: DSetCreatPropList::setVirtual
+///\brief Maps elements of a virtual dataset to elements of the source
+/// dataset.
+///\param vspace - IN: Dataspace the virtual dataset, possibly an
+/// unlimited selection
+///\param src_fname - IN: Name of the HDF5 file where the source dataset
+/// is located (\a H5std_string)
+///\param src_fname - IN: Path to the dataset in the file specified by
+/// \a src_file_name (\a H5std_string)
+///\param sspace - IN: Dataspace with a selection applied, possibly
+/// an unlimited selection
+///\exception H5::PropListIException
+///\par Description
+/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetVirtual
+// Programmer Binh-Minh Ribler - Mar, 2017
+//--------------------------------------------------------------------------
+void DSetCreatPropList::setVirtual(const DataSpace& vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace& sspace) const
+{
+ setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace);
+}
+
+//--------------------------------------------------------------------------
// Function: DSetCreatPropList destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index b536709..5371e03 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -20,6 +20,7 @@
namespace H5 {
class DataType;
+class DataSpace;
/*! \class DSetCreatPropList
\brief Class DSetCreatPropList inherits from ObjCreatPropList and provides
@@ -116,6 +117,10 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
// Sets N-bit compression method.
void setNbit() const;
+ // Maps elements of a virtual dataset to elements of the source dataset.
+ void setVirtual(const DataSpace& vspace, const char *src_fname, const char *src_dsname, const DataSpace& sspace) const;
+ void setVirtual(const DataSpace& vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace& sspace) const;
+
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index ae7c7f9..586dcf8 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -117,6 +117,12 @@ class H5_DLLCPP FileAccPropList : public PropList {
// Returns the degree for the file close behavior.
H5F_close_degree_t getFcloseDegree() const;
+ // Sets file access property list to use the H5FD_DIRECT driver.
+ void setFileAccDirect(size_t boundary, size_t block_size, size_t cbuf_size) const;
+
+ // Retrieves information about the direct file access property list.
+ void getFileAccDirect(size_t &boundary, size_t &block_size, size_t &cbuf_size) const;
+
// Sets garbage collecting references flag.
void setGcReferences(unsigned gc_ref = 0) const;
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 6b143b5..6e5cdaa 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -64,8 +64,56 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
}
//--------------------------------------------------------------------------
+// Function: Group::getObjId
+///\brief Opens an object via object header.
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// This function opens an object in a group or file, using
+/// H5Oopen. Thus, an object can be opened without knowing
+/// the object's type.
+// Programmer Binh-Minh Ribler - March, 2017
+//--------------------------------------------------------------------------
+hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
+{
+ hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId());
+ if (ret_value < 0)
+ {
+ throwException("Group::getObjId", "H5Oopen failed");
+ }
+ return(ret_value);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjId
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c H5std_string for the object's name.
+///\param obj_name - IN: Path to the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - March, 2017
+//--------------------------------------------------------------------------
+hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
+{
+ return(getObjId(obj_name.c_str(), plist));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::closeObjId
+///\brief Closes an object, which was opened with Group::getObjId
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - March, 2017
+//--------------------------------------------------------------------------
+void Group::closeObjId(hid_t obj_id) const
+{
+ herr_t ret_value = H5Oclose(obj_id);
+ if (ret_value < 0)
+ {
+ throwException("Group::closeObjId", "H5Oclose failed");
+ }
+}
+
+//--------------------------------------------------------------------------
// Function: Group::getLocId
-// Purpose: Get the id of this group
+// Purpose: Get the id of this group
// Programmer Binh-Minh Ribler - 2000
// Description
// This function is a redefinition of CommonFG::getLocId. It
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 96dc5c1..3118aa7 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -54,6 +54,13 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
// Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Opens an object within a group or a file, i.e., root group.
+ hid_t getObjId(const char* name, const PropList& plist = PropList::DEFAULT) const;
+ hid_t getObjId(const H5std_string& name, const PropList& plist = PropList::DEFAULT) const;
+
+ // Closes an object opened by getObjId().
+ void closeObjId(hid_t obj_id) const;
+
// default constructor
Group();
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 574b28a..0bcc67a 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -194,6 +194,27 @@ hsize_t IdComponent::getNumMembers(H5I_type_t type)
}
//--------------------------------------------------------------------------
+// Function: isValid (static)
+///\brief Checks if the given ID is valid.
+///\return true if the given identifier is valid, and false, otherwise.
+///\Description
+/// A valid ID is one that is in use and has an application
+/// reference count of at least 1.
+// Programmer Binh-Minh Ribler - Mar 1, 2017
+//--------------------------------------------------------------------------
+bool IdComponent::isValid(hid_t an_id)
+{
+ // Call C function
+ htri_t ret_value = H5Iis_valid(an_id);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Iis_valid returns a negative value
+ throw IdComponentException("isValid", "H5Iis_valid failed");
+}
+
+//--------------------------------------------------------------------------
// Function: typeExists (static)
///\brief Queries if a given type is currently registered with the
/// library.
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 6f57364..b449d4a 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -19,7 +19,6 @@
namespace H5 {
-class DataSpace;
/*! \class IdComponent
\brief Class IdComponent provides wrappers of the C functions that
operate on an HDF5 identifier.
@@ -51,6 +50,9 @@ class H5_DLLCPP IdComponent {
// Returns the number of members in a type.
static hsize_t getNumMembers(H5I_type_t type);
+ // Checks if the given ID is valid.
+ static bool isValid(hid_t an_id);
+
// Determines if an type exists.
static bool typeExists(H5I_type_t type);
diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp
index e9adb12..e457e83 100644
--- a/c++/src/H5LaccProp.cpp
+++ b/c++/src/H5LaccProp.cpp
@@ -40,7 +40,7 @@ LinkAccPropList* LinkAccPropList::DEFAULT_ = 0;
// If LinkAccPropList::DEFAULT_ already points to an allocated
// object, throw a PropListIException. This scenario should not
// happen.
-// Programmer Binh-Minh Ribler - 2015
+// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
LinkAccPropList* LinkAccPropList::getConstant()
{
@@ -66,7 +66,7 @@ LinkAccPropList* LinkAccPropList::getConstant()
// Purpose: Deletes the constant object that LinkAccPropList::DEFAULT_
// points to.
// exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2015
+// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
void LinkAccPropList::deleteConstants()
{
@@ -84,7 +84,7 @@ const LinkAccPropList& LinkAccPropList::DEFAULT = *getConstant();
//--------------------------------------------------------------------------
// Function: Default Constructor
///\brief Creates a file access property list
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {}
@@ -92,7 +92,7 @@ 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
+// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
LinkAccPropList::LinkAccPropList(const LinkAccPropList& original) : PropList(original) {}
@@ -100,14 +100,51 @@ LinkAccPropList::LinkAccPropList(const LinkAccPropList& original) : PropList(ori
// Function: LinkAccPropList overloaded constructor
///\brief Creates a file access property list using the id of an
/// existing one.
-// Programmer Binh-Minh Ribler - 2000
+// 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 - 2000
+// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
LinkAccPropList::~LinkAccPropList() {}
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index 8bcdd64..1cb80f7 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -46,6 +46,13 @@ class H5_DLLCPP LinkAccPropList : public PropList {
// 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();