summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-02-03 17:29:54 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-02-03 17:29:54 (GMT)
commit519b33c5b00b7cb81e7d1d6d808b0923ff16d18c (patch)
tree08585cfd99d214d18c0dd142c8a0d2290b134b2b /src
parent137bc83f7a8f1f552b53a97d21d89269c844a051 (diff)
downloadhdf5-519b33c5b00b7cb81e7d1d6d808b0923ff16d18c.zip
hdf5-519b33c5b00b7cb81e7d1d6d808b0923ff16d18c.tar.gz
hdf5-519b33c5b00b7cb81e7d1d6d808b0923ff16d18c.tar.bz2
[svn-r214] Changes since 19980203
---------------------- ./src/H5C.c ./src/H5Cprivate.h ./src/H5D.c ./src/H5Dpublic.h Added H5Dget_create_parms(), trying to stay one step ahead of Elena ;-)
Diffstat (limited to 'src')
-rw-r--r--src/H5C.c56
-rw-r--r--src/H5Cprivate.h2
-rw-r--r--src/H5D.c50
-rw-r--r--src/H5Dpublic.h1
4 files changed, 98 insertions, 11 deletions
diff --git a/src/H5C.c b/src/H5C.c
index dde8411..4c4f4fe 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -883,7 +883,6 @@ H5Ccopy(hid_t tid)
const void *tmpl = NULL;
void *new_tmpl = NULL;
H5C_class_t type;
- size_t size;
hid_t ret_value = FAIL;
group_t group;
@@ -896,6 +895,46 @@ H5Ccopy(hid_t tid)
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL,
"can't unatomize template");
}
+
+ /* Copy it */
+ if (NULL==(new_tmpl=H5C_copy (type, tmpl))) {
+ HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL,
+ "unable to copy template");
+ }
+
+ /* Register the atom for the new template */
+ if ((ret_value = H5A_register(group, new_tmpl)) < 0) {
+ HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL,
+ "unable to atomize template pointer");
+ }
+ FUNC_LEAVE(ret_value);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_copy
+ *
+ * Purpose: Creates a new template and initializes it with some other
+ * template.
+ *
+ * Return: Success: Ptr to new template
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, February 3, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5C_copy (H5C_class_t type, const void *src)
+{
+ size_t size;
+ void *dst = NULL;
+
+ FUNC_ENTER (H5C_copy, NULL);
+
/* How big is the template */
switch (type) {
case H5C_FILE_CREATE:
@@ -903,7 +942,7 @@ H5Ccopy(hid_t tid)
break;
case H5C_FILE_ACCESS:
- HRETURN_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL,
+ HRETURN_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL,
"file access properties are not implemented yet");
case H5C_DATASET_CREATE:
@@ -915,18 +954,13 @@ H5Ccopy(hid_t tid)
break;
default:
- HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
+ HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL,
"unknown template class");
}
/* Create the new template */
- new_tmpl = H5MM_xmalloc(size);
- HDmemcpy(new_tmpl, tmpl, size);
+ dst = H5MM_xmalloc(size);
+ HDmemcpy(dst, src, size);
- /* Register the atom for the new template */
- if ((ret_value = H5A_register(group, new_tmpl)) < 0) {
- HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL,
- "unable to atomize template pointer");
- }
- FUNC_LEAVE(ret_value);
+ FUNC_LEAVE (dst);
}
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index ffa93e7..2c24a5b 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -23,4 +23,6 @@
#include <H5Fprivate.h>
hid_t H5C_create (H5C_class_t type, void *tmpl);
+void *H5C_copy (H5C_class_t type, const void *src);
+
#endif
diff --git a/src/H5D.c b/src/H5D.c
index 86e7fdb..70d512c 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -409,6 +409,56 @@ H5Dget_type (hid_t dataset_id)
}
/*-------------------------------------------------------------------------
+ * Function: H5Dget_create_parms
+ *
+ * Purpose: Returns a copy of the dataset creation template.
+ *
+ * Return: Success: ID for a copy of the dataset creation
+ * template. The template should be released by
+ * calling H5Cclose().
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, February 3, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Dget_create_parms (hid_t dataset_id)
+{
+ H5D_t *dataset = NULL;
+ H5D_create_t *copied_parms = NULL;
+ hid_t ret_value = FAIL;
+
+ FUNC_ENTER (H5Dget_create_parms, FAIL);
+
+ /* Check args */
+ if (H5_DATASET!=H5A_group (dataset_id) ||
+ NULL==(dataset=H5A_object (dataset_id))) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
+ }
+
+ /* Copy the creation template */
+ if (NULL==(copied_parms=H5C_copy (H5C_DATASET_CREATE,
+ &(dataset->create_parms)))) {
+ HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to copy the creation template");
+ }
+
+ /* Create an atom */
+ if ((ret_value=H5A_register ((group_t)(H5_TEMPLATE_0+H5C_DATASET_CREATE),
+ copied_parms))<0) {
+ HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL,
+ "unable to register creation template");
+ }
+
+ FUNC_LEAVE (ret_value);
+}
+
+/*-------------------------------------------------------------------------
* Function: H5Dread
*
* Purpose: Reads (part of) a DATASET from the file into application
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 6067acc..80a1340 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -41,6 +41,7 @@ hid_t H5Dopen (hid_t file_id, const char *name);
herr_t H5Dclose (hid_t dataset_id);
hid_t H5Dget_space (hid_t dataset_id);
hid_t H5Dget_type (hid_t dataset_id);
+hid_t H5Dget_create_parms (hid_t dataset_id);
herr_t H5Dread (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t xfer_parms_id, void *buf/*out*/);
herr_t H5Dwrite (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,