summaryrefslogtreecommitdiff
path: root/c++/src/H5LaccProp.cpp
diff options
context:
space:
mode:
authorTae-Young Chung <ty83.chung@samsung.com>2018-03-13 17:04:17 +0900
committerTae-Young Chung <ty83.chung@samsung.com>2018-03-13 17:06:54 +0900
commit45032639c6c5ee11b79d2d3faaca6e9be6e4be3b (patch)
tree1d636d696c1f1ea6d79fb469758c465f27a3d37c /c++/src/H5LaccProp.cpp
parent125c0b85df1bf388ae210fc7a87872984f865769 (diff)
downloadhdf5-master.tar.gz
hdf5-master.tar.bz2
hdf5-master.zip
Import upstream hdf5-1.10.1HEADupstream/1.10.1upstreammaster
Upstream repository is https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.1/src/ Change-Id: I4ec4c291940b7bb75722ea16813fbe55736374a6 Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
Diffstat (limited to 'c++/src/H5LaccProp.cpp')
-rw-r--r--c++/src/H5LaccProp.cpp149
1 files changed, 149 insertions, 0 deletions
diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp
new file mode 100644
index 0000000..1267286
--- /dev/null
+++ b/c++/src/H5LaccProp.cpp
@@ -0,0 +1,149 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * 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 - 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