summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1999-03-18 01:30:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1999-03-18 01:30:03 (GMT)
commitd8d31596b423c34d96a826f0d82188f55551bb14 (patch)
treea4d4cdb1aabe0e9668b907cfd16ec802b85ce891 /src
parentff5a1a9e29d4e1a6d93b35706e77a511a2fe5532 (diff)
downloadhdf5-d8d31596b423c34d96a826f0d82188f55551bb14.zip
hdf5-d8d31596b423c34d96a826f0d82188f55551bb14.tar.gz
hdf5-d8d31596b423c34d96a826f0d82188f55551bb14.tar.bz2
[svn-r1146] Added support for object references to named datatypes.
Diffstat (limited to 'src')
-rw-r--r--src/H5R.c12
-rw-r--r--src/H5T.c43
-rw-r--r--src/H5Tprivate.h1
3 files changed, 52 insertions, 4 deletions
diff --git a/src/H5R.c b/src/H5R.c
index 8662924..447b7cb 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -26,6 +26,7 @@ static char RcsId[] = "@(#)$Revision$";
#include <H5MMprivate.h> /* Memory Management */
#include <H5Rprivate.h> /* References */
#include <H5Sprivate.h> /* Dataspaces */
+#include <H5Tprivate.h> /* Datatypes */
/* Interface initialization */
#define PABLO_MASK H5R_mask
@@ -331,6 +332,7 @@ H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref)
{
H5D_t *dataset; /* Pointer to dataset to open */
H5G_t *group; /* Pointer to group to open */
+ H5T_t *datatype; /* Pointer to datatype to open */
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
intn oid_type; /* type of object being dereferenced */
@@ -415,6 +417,16 @@ H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref)
break;
case H5G_TYPE:
+ if ((datatype=H5T_open_oid(&ent)) == NULL) {
+ HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found");
+ }
+
+ /* Create an atom for the dataset */
+ if ((ret_value = H5I_register(H5I_DATATYPE, datatype)) < 0) {
+ H5T_close(datatype);
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL,
+ "can't register group");
+ }
break;
case H5G_DATASET:
diff --git a/src/H5T.c b/src/H5T.c
index 746afa6..28fe21c 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -4197,6 +4197,7 @@ H5T_isa(H5G_entry_t *ent)
* Monday, June 1, 1998
*
* Modifications:
+ * Changed to use H5T_open_oid - QAK - 3/17/99
*
*-------------------------------------------------------------------------
*/
@@ -4217,23 +4218,57 @@ H5T_open (H5G_entry_t *loc, const char *name)
if (H5G_find (loc, name, NULL, &ent/*out*/)<0) {
HRETURN_ERROR (H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found");
}
- if (H5O_open (&ent)<0) {
+ /* Open the datatype object */
+ if ((dt=H5T_open_oid(&ent)) ==NULL) {
+ HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found");
+ }
+
+ FUNC_LEAVE (dt);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_open_oid
+ *
+ * Purpose: Open a named data type.
+ *
+ * Return: Success: Ptr to a new data type.
+ *
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, March 17, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_t *
+H5T_open_oid (H5G_entry_t *ent)
+{
+ H5T_t *dt = NULL;
+
+ FUNC_ENTER (H5T_open_oid, NULL);
+ assert (ent);
+
+ if (H5O_open (ent)<0) {
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL,
"unable to open named data type");
}
- if (NULL==(dt=H5O_read (&ent, H5O_DTYPE, 0, NULL))) {
- H5O_close(&ent);
+ if (NULL==(dt=H5O_read (ent, H5O_DTYPE, 0, NULL))) {
+ H5O_close(ent);
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL,
"unable to load type message from object header");
}
/* Mark the type as named and open */
dt->state = H5T_STATE_OPEN;
- dt->ent = ent;
+ dt->ent = *ent;
FUNC_LEAVE (dt);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_copy
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index f37ebe9..8d59f40 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -65,6 +65,7 @@ __DLL__ herr_t H5T_native_open(void);
__DLL__ herr_t H5T_init(void);
__DLL__ htri_t H5T_isa(H5G_entry_t *ent);
__DLL__ H5T_t *H5T_open(H5G_entry_t *loc, const char *name);
+__DLL__ H5T_t *H5T_open_oid(H5G_entry_t *ent);
__DLL__ H5T_t *H5T_create(H5T_class_t type, size_t size);
__DLL__ H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
__DLL__ herr_t H5T_commit(H5G_entry_t *loc, const char *name, H5T_t *type);