summaryrefslogtreecommitdiffstats
path: root/src/H5Pocpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Pocpl.c')
-rwxr-xr-xsrc/H5Pocpl.c126
1 files changed, 115 insertions, 11 deletions
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index b454d08..974a6a0 100755
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -27,6 +27,7 @@
/****************/
/* Module Setup */
/****************/
+#define H5O_PACKAGE /*suppress error about including H5Opkg */
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
@@ -36,6 +37,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
#include "H5Ppkg.h" /* Property lists */
@@ -50,9 +52,8 @@
/* Definitions for the min. # of attributes to store densely */
#define H5O_CRT_ATTR_MIN_DENSE_SIZE sizeof(unsigned)
#define H5O_CRT_ATTR_MIN_DENSE_DEF 6
-/* Definitions for the min. # of attributes to store densely */
-#define H5O_CRT_OHDR_FLAGS_SIZE sizeof(unsigned)
-#define H5O_CRT_OHDR_FLAGS_DEF 0
+/* Definitions for object header flags */
+#define H5O_CRT_OHDR_FLAGS_SIZE sizeof(uint8_t)
/******************/
@@ -114,6 +115,7 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{
*
* Programmer: Quincey Koziol
* November 28, 2006
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -121,7 +123,7 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass)
{
unsigned attr_max_compact = H5O_CRT_ATTR_MAX_COMPACT_DEF; /* Default max. compact attribute storage settings */
unsigned attr_min_dense = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */
- unsigned ohdr_flags = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */
+ uint8_t ohdr_flags = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5P_ocrt_reg_prop)
@@ -249,13 +251,14 @@ done:
*
* Programmer: Quincey Koziol
* February 6, 2007
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags)
{
H5P_genplist_t *plist; /* Property list pointer */
- unsigned ohdr_flags; /* Object header flags */
+ uint8_t ohdr_flags; /* Object header flags */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Pset_attr_creation_order, FAIL)
@@ -274,11 +277,11 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
/* Mask off previous attribute creation order flag settings */
- ohdr_flags &= ~(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
+ ohdr_flags &= ~(H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED);
/* Update with new attribute creation order flags */
- ohdr_flags |= (crt_order_flags & H5P_CRT_ORDER_TRACKED);
- ohdr_flags |= (crt_order_flags & H5P_CRT_ORDER_INDEXED);
+ ohdr_flags |= (crt_order_flags & H5P_CRT_ORDER_TRACKED) ? H5O_HDR_ATTR_CRT_ORDER_TRACKED : 0;
+ ohdr_flags |= (crt_order_flags & H5P_CRT_ORDER_INDEXED) ? H5O_HDR_ATTR_CRT_ORDER_INDEXED : 0;
/* Set object header flags */
if(H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -298,7 +301,8 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * Ferbruary 6, 2007
+ * February 6, 2007
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -312,7 +316,7 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags)
/* Get values */
if(crt_order_flags) {
H5P_genplist_t *plist; /* Property list pointer */
- unsigned ohdr_flags; /* Object header flags */
+ uint8_t ohdr_flags; /* Object header flags */
/* Reset the value to return */
*crt_order_flags = 0;
@@ -326,10 +330,110 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
/* Set creation order flags to return */
- *crt_order_flags = ohdr_flags & (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
+ *crt_order_flags |= (ohdr_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? H5P_CRT_ORDER_TRACKED : 0;
+ *crt_order_flags |= (ohdr_flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? H5P_CRT_ORDER_INDEXED : 0;
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_attr_creation_order() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_obj_track_times
+ *
+ * Purpose: Set whether the birth, access, modification & change times for
+ * an object are stored.
+ *
+ * Birth time is the time the object was created. Access time is
+ * the last time that metadata or raw data was read from this
+ * object. Modification time is the last time the data for
+ * this object was changed (either writing raw data to a dataset
+ * or inserting/modifying/deleting a link in a group). Change
+ * time is the last time the metadata for this object was written
+ * (adding/modifying/deleting an attribute on an object, extending
+ * the size of a dataset, etc).
+ *
+ * If these times are not tracked, they will be reported as
+ * 12:00 AM UDT, Jan. 1, 1970 (i.e. 0 seconds past the UNIX
+ * epoch) when queried.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * March 1, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ uint8_t ohdr_flags; /* Object header flags */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_obj_track_times, FAIL)
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get object header flags */
+ if(H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
+
+ /* Mask off previous time tracking flag settings */
+ ohdr_flags &= ~H5O_HDR_STORE_TIMES;
+
+ /* Update with new time tracking flag */
+ ohdr_flags |= track_times ? H5O_HDR_STORE_TIMES : 0;
+
+ /* Set object header flags */
+ if(H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_obj_track_times() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_obj_track_times
+ *
+ * Purpose: Returns whether times are tracked for an object.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * March 1, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times)
+{
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_obj_track_times, FAIL)
+
+ /* Get values */
+ if(track_times) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ uint8_t ohdr_flags; /* Object header flags */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get object header flags */
+ if(H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
+
+ /* Set track times flag to return */
+ *track_times = (ohdr_flags & H5O_HDR_STORE_TIMES) ? TRUE : FALSE;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_obj_track_times() */
+