summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-24 17:19:49 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-24 17:19:49 (GMT)
commitefd9b6e5257c5fecc78ca768c3e0067864f4e698 (patch)
tree07f76a4721ba126350cd5bb964e7c7936e3862cc
parent7b7ae438f722517017247b522e2848c645d96aa3 (diff)
downloadhdf5-efd9b6e5257c5fecc78ca768c3e0067864f4e698.zip
hdf5-efd9b6e5257c5fecc78ca768c3e0067864f4e698.tar.gz
hdf5-efd9b6e5257c5fecc78ca768c3e0067864f4e698.tar.bz2
[svn-r374] ./src/H5A.c
./src/H5D.c ./src/H5Dprivate.h ./src/H5Dpkg.h [REMOVED] ./src/H5Tpkg.h ./src/H5Tprivate.h Rearranged some header stuff so H5A doesn't have to include the package-private header files that don't belong to it. ./src/H5E.c Added the H5E_ATTR message to the major error struct.
-rw-r--r--src/H5A.c53
-rw-r--r--src/H5Apkg.h4
-rw-r--r--src/H5D.c22
-rw-r--r--src/H5Dpkg.h40
-rw-r--r--src/H5Dprivate.h1
-rw-r--r--src/H5E.c1
-rw-r--r--src/H5Tpkg.h9
-rw-r--r--src/H5Tprivate.h11
8 files changed, 69 insertions, 72 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 7d449fe..9d2cc41 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -17,17 +17,14 @@ static char RcsId[] = "$Revision$";
/* $Id$ */
#define H5A_PACKAGE /*suppress error about including H5Apkg */
-#define H5D_PACKAGE /*suppress error about including H5Dpkg */
-#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#define H5G_PACKAGE /*suppress error about including H5Gpkg */
/* Private header files */
#include <H5private.h> /* Generic Functions */
#include <H5Iprivate.h> /* IDs */
#include <H5Bprivate.h> /* B-tree subclass names */
-#include <H5Dpkg.h> /* Datasets */
-#include <H5Gpkg.h> /* Groups */
-#include <H5Tpkg.h> /* Datatypes */
+#include <H5Dprivate.h> /* Datasets */
+#include <H5Gprivate.h> /* Groups */
+#include <H5Tprivate.h> /* Datatypes */
#include <H5Eprivate.h> /* Error handling */
#include <H5MMprivate.h> /* Memory management */
#include <H5Pprivate.h> /* Property lists */
@@ -187,9 +184,9 @@ H5Acreate(hid_t loc_id, const char *name, hid_t datatype, hid_t dataspace,
if(NULL == (obj = H5I_object(loc_id)))
HRETURN_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom");
if (H5_DATASET == H5I_group(loc_id))
- ent=&(((H5D_t *)obj)->ent);
+ ent = H5D_entof ((H5D_t*)obj);
else
- ent=&(((H5G_t *)obj)->ent);
+ ent = H5G_entof ((H5G_t*)obj);
/* Go do the real work for attaching the attribute to the dataset */
ret_value=H5A_create(ent,name,type,space);
@@ -384,9 +381,9 @@ H5Aopen_name(hid_t loc_id, const char *name)
/* Copy the object header entry for the object */
if (H5_DATASET == H5I_group(loc_id))
- ent=&(((H5D_t *)obj)->ent);
+ ent = H5D_entof ((H5D_t*)obj);
else
- ent=&(((H5G_t *)obj)->ent);
+ ent = H5G_entof ((H5G_t*)obj);
/* Look up the attribute for the object */
if((idx=H5A_get_index(ent,name))<0)
@@ -441,9 +438,9 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
/* Copy the object header entry for the object */
if (H5_DATASET == H5I_group(loc_id))
- ent=&(((H5D_t *)obj)->ent);
+ ent = H5D_entof ((H5D_t*)obj);
else
- ent=&(((H5G_t *)obj)->ent);
+ ent = H5G_entof ((H5G_t*)obj);
/* Go do the real work for opening the attribute */
ret_value=H5A_open(ent, idx);
@@ -599,6 +596,9 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
size_t buf_size; /* desired buffer size */
int idx; /* index of attribute in object header */
herr_t ret_value = FAIL;
+#ifdef H5T_DEBUG
+ H5_timer_t timer;
+#endif
FUNC_ENTER(H5A_write, FAIL);
@@ -636,12 +636,17 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
}
/* Perform data type conversion. */
+#ifdef H5T_DEBUG
+ H5T_timer_begin (&timer, cdata);
+#endif
cdata->command = H5T_CONV_CONV;
- cdata->stats->ncalls++;
if ((tconv_func) (src_id, dst_id, cdata, nelmts, tconv_buf, NULL)<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}
+#ifdef H5T_DEBUG
+ H5T_timer_end (&timer, cdata, nelmts);
+#endif
/* Free the previous attribute data buffer, if there is one */
if(attr->data)
@@ -756,6 +761,9 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
size_t dst_type_size; /* size of destination type*/
size_t buf_size; /* desired buffer size */
herr_t ret_value = FAIL;
+#ifdef H5T_DEBUG
+ H5_timer_t timer;
+#endif
FUNC_ENTER(H5A_read, FAIL);
@@ -793,12 +801,17 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
}
/* Perform data type conversion. */
+#ifdef H5T_DEBUG
+ H5T_timer_begin (&timer, cdata);
+#endif
cdata->command = H5T_CONV_CONV;
- cdata->stats->ncalls++;
if ((tconv_func) (src_id, dst_id, cdata, nelmts, tconv_buf, NULL)<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}
+#ifdef H5T_DEBUG
+ H5T_timer_end (&timer, cdata, nelmts);
+#endif
/* Copy the converted data into the user's buffer */
HDmemcpy(buf,tconv_buf,dst_type_size*nelmts);
@@ -1011,9 +1024,9 @@ H5Anum_attrs(hid_t loc_id)
/* Copy the object header entry for the object */
if (H5_DATASET == H5I_group(loc_id))
- ent=&(((H5D_t *)obj)->ent);
+ ent = H5D_entof ((H5D_t*)obj);
else
- ent=&(((H5G_t *)obj)->ent);
+ ent = H5G_entof ((H5G_t*)obj);
/* Look up the attribute for the object */
ret_value=H5O_count(ent, H5O_ATTR);
@@ -1086,9 +1099,9 @@ H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, void *op_data)
/* Copy the object header entry for the object */
if (H5_DATASET == H5I_group(loc_id))
- ent=&(((H5D_t *)obj)->ent);
+ ent = H5D_entof ((H5D_t*)obj);
else
- ent=&(((H5G_t *)obj)->ent);
+ ent = H5G_entof ((H5G_t*)obj);
/* Look up the attribute for the object */
if((int)*attr_num<H5O_count(ent, H5O_ATTR)) /* Make certain the start point is reasonable */
@@ -1149,9 +1162,9 @@ H5Adelete(hid_t loc_id, const char *name)
/* Copy the object header entry for the object */
if (H5_DATASET == H5I_group(loc_id))
- ent=&(((H5D_t *)obj)->ent);
+ ent = H5D_entof ((H5D_t*)obj);
else
- ent=&(((H5G_t *)obj)->ent);
+ ent = H5G_entof ((H5G_t*)obj);
/* Look up the attribute for the object */
idx=0;
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index b6f1a24..780a876 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -2,8 +2,8 @@
* Copyright (C) 1997 NCSA
* All rights reserved.
*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Monday, December 8, 1997
+ * Programmer: Quincey Koziol
+ * Monday, Apr 20
*
* Purpose: This file contains declarations which are visible only within
* the H5A package. Source files outside the H5A package should
diff --git a/src/H5D.c b/src/H5D.c
index 8461abf..5027844 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1746,3 +1746,25 @@ H5D_extend (H5D_t *dataset, const hsize_t *size)
FUNC_LEAVE (SUCCEED);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_entof
+ *
+ * Purpose: Returns a pointer to the entry for a dataset.
+ *
+ * Return: Success: Ptr to entry
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Friday, April 24, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5G_entry_t *
+H5D_entof (H5D_t *dataset)
+{
+ return dataset ? &(dataset->ent) : NULL;
+}
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
deleted file mode 100644
index e57f6ab..0000000
--- a/src/H5Dpkg.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 1997 NCSA
- * All rights reserved.
- *
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Monday, December 8, 1997
- *
- * Purpose: This file contains declarations which are visible only within
- * the H5D package. Source files outside the H5D package should
- * include H5Dprivate.h instead.
- */
-#ifndef H5D_PACKAGE
-#error "Do not include this file outside the H5D package!"
-#endif
-
-#ifndef _H5Dpkg_H
-#define _H5Dpkg_H
-
-/*
- * Define this to enable debugging.
- */
-#ifdef NDEBUG
-# undef H5D_DEBUG
-#endif
-
-#include <H5Dprivate.h>
-
-/*
- * A dataset is the following struct.
- */
-struct H5D_t {
- H5G_entry_t ent; /*cached object header stuff */
- H5T_t *type; /*datatype of this dataset */
- H5S_t *space; /*dataspace of this dataset */
- H5D_create_t *create_parms; /*creation parameters */
- H5O_layout_t layout; /*data layout */
-};
-
-
-#endif
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index e437ce7..f144d30 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -77,5 +77,6 @@ herr_t H5D_write (H5D_t *dataset, const H5T_t *mem_type,
const H5D_xfer_t *xfer_parms, const void *buf);
hid_t H5D_find_name (hid_t file_id, H5I_group_t UNUSED, const char *name);
herr_t H5D_extend (H5D_t *dataset, const hsize_t *size);
+H5G_entry_t *H5D_entof (H5D_t *dataset);
#endif
diff --git a/src/H5E.c b/src/H5E.c
index 5062d77..75318b3 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -54,6 +54,7 @@ static const H5E_major_mesg_t H5E_major_mesg_g[] = {
{H5E_DATASET, "Dataset interface"},
{H5E_STORAGE, "Data storage layer"},
{H5E_TEMPLATE, "Property list interface"},
+ {H5E_ATTR, "Attribute layer"},
{H5E_COMP, "Data compression layer"},
{H5E_EFL, "External file list"},
};
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 64d0fba..bb2bc2b 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -102,15 +102,6 @@ typedef struct H5T_soft_t {
H5T_conv_t func; /*the conversion function */
} H5T_soft_t;
-/* Statistics about a conversion function */
-typedef struct H5T_stats_t {
- uintn ncalls; /*num calls to conversion function */
-#ifdef H5T_DEBUG
- hsize_t nelmts; /*total data points converted */
- H5_timer_t timer; /*total time for conversion */
-#endif
-} H5T_stats_t;
-
/* Function prototypes for H5T package scope */
H5T_path_t *H5T_path_find (const char *name, const H5T_t *src,
const H5T_t *dst, hbool_t create, H5T_conv_t func);
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index a9241d6..0a1178a 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -25,9 +25,18 @@
#define H5T_RESERVED_ATOMS 8
typedef struct H5T_t H5T_t;
-herr_t H5T_init (void);
+/* Statistics about a conversion function */
+typedef struct H5T_stats_t {
+ uintn ncalls; /*num calls to conversion function */
+#ifdef H5T_DEBUG
+ hsize_t nelmts; /*total data points converted */
+ H5_timer_t timer; /*total time for conversion */
+#endif
+} H5T_stats_t;
+
/* Private functions */
+herr_t H5T_init (void);
herr_t H5T_init_interface (void);
H5T_t *H5T_create (H5T_class_t type, size_t size);
H5T_t *H5T_copy (const H5T_t *old_dt);