summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5D.c6
-rw-r--r--src/H5M.c87
-rw-r--r--src/H5Mprivate.h5
3 files changed, 95 insertions, 3 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 84bf955..e6c7789 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -91,15 +91,15 @@ hatom_t H5D_create(hatom_t owner_id, hobjtype_t type, const char *name)
/* Clear errors and check args and all the boring stuff. */
H5ECLEAR;
- /* Allocate space for the new data-type */
+ /* Allocate space for the new dataset */
if((new_dset=HDmalloc(sizeof(H5D_dataset_t)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL);
- /* Initialize the dimensionality object */
+ /* Initialize the dataset object */
if(H5Aatom_group(owner_id)==H5_FILE)
new_dset->file=owner_id;
else
- new_dset->file=owner_id;
+ new_dset->file=H5Mget_file(owner_id);
new_dset->parent=owner_id; /* set the owner's ID */
new_dset->name=HDstrdup(name); /* make a copy of the dataset name */
new_dset->modified=BTRUE; /* Yep, we're new... */
diff --git a/src/H5M.c b/src/H5M.c
index 101adbc..57a042e 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -25,6 +25,7 @@ static char RcsId[] = "@(#)$Revision$";
EXPORTED ROUTINES
H5Mcreate -- Create an object
H5Mcopy -- Copy an object
+ H5Mget_file -- Get the file ID for an object
H5Mrelease -- Release access to an object
LIBRARY-SCOPED ROUTINES
@@ -208,6 +209,92 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5Mflush
+ PURPOSE
+ Flush an HDF5 object out to a file.
+ USAGE
+ hatom_t H5Mget_file(oid)
+ hatom_t oid; IN: Object to flush
+ RETURNS
+ SUCCEED/FAIL
+ DESCRIPTION
+ This function re-directs the object's flush into the appropriate
+ interface, as defined by the function pointers in hdf5fptr.h
+--------------------------------------------------------------------------*/
+hatom_t H5Mflush(hatom_t oid)
+{
+ group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
+ intn i; /* local counting variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER(H5Mflush, H5M_init_interface, FAIL);
+
+ /* Clear errors and check args and all the boring stuff. */
+ H5ECLEAR;
+ if(group<=BADGROUP || group>=MAXGROUP)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
+
+ i=H5M_find_type(group);
+ if(meta_func_arr[i].flush==NULL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
+ ret_value=meta_func_arr[i].flush(oid);
+
+done:
+ if(ret_value == FAIL)
+ { /* Error condition cleanup */
+
+ } /* end if */
+
+ /* Normal function cleanup */
+
+ FUNC_LEAVE(ret_value);
+} /* end H5Mflush() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Mget_file
+ PURPOSE
+ Get the file ID an HDF5 object.
+ USAGE
+ hatom_t H5Mget_file(oid)
+ hatom_t oid; IN: Object to query
+ RETURNS
+ SUCCEED/FAIL
+ DESCRIPTION
+ This function re-directs the object's query into the appropriate
+ interface, as defined by the function pointers in hdf5fptr.h
+--------------------------------------------------------------------------*/
+hatom_t H5Mget_file(hatom_t oid)
+{
+ group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
+ intn i; /* local counting variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER(H5Mget_file, H5M_init_interface, FAIL);
+
+ /* Clear errors and check args and all the boring stuff. */
+ H5ECLEAR;
+ if(group<=BADGROUP || group>=MAXGROUP)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
+
+ i=H5M_find_type(group);
+ if(meta_func_arr[i].get_file==NULL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
+ ret_value=meta_func_arr[i].get_file(oid);
+
+done:
+ if(ret_value == FAIL)
+ { /* Error condition cleanup */
+
+ } /* end if */
+
+ /* Normal function cleanup */
+
+ FUNC_LEAVE(ret_value);
+} /* end H5Mget_file() */
+
+/*--------------------------------------------------------------------------
+ NAME
H5Mrelease
PURPOSE
Release access to an HDF5 object.
diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h
index 927e956..cde2cda 100644
--- a/src/H5Mprivate.h
+++ b/src/H5Mprivate.h
@@ -41,6 +41,7 @@ typedef struct meta_func_t
herr_t (*flush) (hatom_t ); /* Flush the object to disk */
herr_t (*delete) (hatom_t ); /* Delete an object from file */
hatom_t (*get_parent) (hatom_t ); /* Get the parent object of an object */
+ hatom_t (*get_file) (hatom_t ); /* Get the file ID of an object */
herr_t (*release) (hatom_t ); /* End access to an object */
}
meta_func_t;
@@ -60,6 +61,7 @@ meta_func_t meta_func_arr[]={
NULL, /* File-Creation Template Flush */
NULL, /* File-Creation Template Delete */
NULL, /* File-Creation Template GetParent */
+ NULL, /* File-Creation Template GetFile */
H5C_release /* File-Creation Template Release */
},
{ /* Datatype object meta-functions (defined in H5T.c) */
@@ -76,6 +78,7 @@ meta_func_t meta_func_arr[]={
NULL, /* Datatype Flush */
NULL, /* Datatype Delete */
NULL, /* Datatype GetParent */
+ NULL, /* Datatype GetFile */
H5T_release /* Datatype Release */
},
{ /* Dimensionality object meta-functions (defined in H5P.c) */
@@ -92,6 +95,7 @@ meta_func_t meta_func_arr[]={
NULL, /* Dimensionality Flush */
NULL, /* Dimensionality Delete */
NULL, /* Dimensionality GetParent */
+ NULL, /* Dimensionality GetFile */
H5P_release /* Dimensionality Release */
},
{ /* Dataset object meta-functions (defined in H5D.c) */
@@ -108,6 +112,7 @@ meta_func_t meta_func_arr[]={
H5D_flush, /* Dataset Flush */
NULL, /* Dataset Delete */
NULL, /* Dataset GetParent */
+ NULL, /* Dataset GetFile */
H5D_release /* Dataset Release */
}
};