Commit 492cd48d authored by Jan Kotanski's avatar Jan Kotanski
Browse files

add close degree

parent 4c302eb8
From: Jan Kotanski <jankotan@gmail.com>
Date: Tue, 26 Jun 2018 11:53:06 +0200
Subject: add close_degree
---
src/h5cpp/property/file_access.cpp | 28 ++++++++++++++++++++++++++++
src/h5cpp/property/file_access.hpp | 25 +++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/src/h5cpp/property/file_access.cpp b/src/h5cpp/property/file_access.cpp
index 9d34ce3..8836b9f 100644
--- a/src/h5cpp/property/file_access.cpp
+++ b/src/h5cpp/property/file_access.cpp
@@ -22,6 +22,7 @@
// Authors:
// Eugen Wintersberger <eugen.wintersberger@desy.de>
// Martin Shetty <martin.shetty@esss.se>
+// Jan Kotanski <jan.kotanski@desy.de>
// Created on: Aug 17, 2017
//
@@ -40,6 +41,16 @@ std::ostream &operator<<(std::ostream &stream, const LibVersion &version) {
}
}
+std::ostream &operator<<(std::ostream &stream, const CloseDegree &version) {
+ switch (version) {
+ case CloseDegree::WEAK: return stream << "WEAK";
+ case CloseDegree::SEMI: return stream << "SEMI";
+ case CloseDegree::STRONG: return stream << "STRONG";
+ case CloseDegree::DEFAULT: return stream << "DEFAULT";
+ default:return stream;
+ }
+}
+
FileAccessList::FileAccessList() :
List(kFileAccess) {}
@@ -82,6 +93,23 @@ LibVersion FileAccessList::library_version_bound_low() const {
return static_cast<LibVersion>(low);
}
+void FileAccessList::close_degree(CloseDegree degree) const {
+ if (0 > H5Pset_fclose_degree(static_cast<hid_t>(*this),
+ static_cast<H5F_close_degree_t>(degree))) {
+ error::Singleton::instance().throw_with_stack("Failure setting the file close degree!");
+ }
+}
+
+CloseDegree FileAccessList::close_degree() const {
+ H5F_close_degree_t degree;
+
+ if (0 > H5Pget_fclose_degree(static_cast<hid_t>(*this), &degree)) {
+ error::Singleton::instance().throw_with_stack("Failure retrieving the file close degree!");
+ }
+
+ return static_cast<CloseDegree>(degree);
+}
+
void FileAccessList::driver(const file::Driver &file_driver) const {
file_driver(*this);
}
diff --git a/src/h5cpp/property/file_access.hpp b/src/h5cpp/property/file_access.hpp
index b745de5..20f602d 100644
--- a/src/h5cpp/property/file_access.hpp
+++ b/src/h5cpp/property/file_access.hpp
@@ -22,6 +22,7 @@
// Authors:
// Eugen Wintersberger <eugen.wintersberger@desy.de>
// Martin Shetty <martin.shetty@esss.se>
+// Jan Kotanski <jan.kotanski@desy.de>
// Created on: Aug 18, 2017
//
#pragma once
@@ -41,10 +42,24 @@ enum class LibVersion : std::underlying_type<H5F_libver_t>::type {
EARLIEST = H5F_LIBVER_EARLIEST
};
+//!
+//! \brief close degree enumeration
+//!
+enum class CloseDegree : std::underlying_type<H5F_close_degree_t>::type {
+ WEAK = H5F_CLOSE_WEAK,
+ SEMI = H5F_CLOSE_SEMI,
+ STRONG = H5F_CLOSE_STRONG,
+ DEFAULT = H5F_CLOSE_DEFAULT
+};
+
using LibVersionBase = std::underlying_type<LibVersion>::type;
+using CloseDegreeBase = std::underlying_type<CloseDegree>::type;
+
DLL_EXPORT std::ostream &operator<<(std::ostream &stream, const LibVersion &version);
+DLL_EXPORT std::ostream &operator<<(std::ostream &stream, const CloseDegree &version);
+
//!
//! \brief file access property list
//!
@@ -79,6 +94,16 @@ class DLL_EXPORT FileAccessList : public List {
//!
LibVersion library_version_bound_low() const;
+ //!
+ //! \brief set file close degree
+ //!
+ void close_degree(CloseDegree degree) const;
+
+ //!
+ //! \brief get lfile close degree
+ //!
+ CloseDegree close_degree() const;
+
//!
//! \brief set the file driver
//!
0001-add-close_degree.patch
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment