diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1997-08-15 16:06:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1997-08-15 16:06:12 (GMT) |
commit | fdb45fa4fa3c0e0749deb2b40c6246543ba47cf1 (patch) | |
tree | b766f5bc4aa6143f76e15d4e773985ac20aa7a88 | |
parent | 876badec3f143c1ca90f240c02e09e54b1b20608 (diff) | |
download | hdf5-fdb45fa4fa3c0e0749deb2b40c6246543ba47cf1.zip hdf5-fdb45fa4fa3c0e0749deb2b40c6246543ba47cf1.tar.gz hdf5-fdb45fa4fa3c0e0749deb2b40c6246543ba47cf1.tar.bz2 |
[svn-r31] Added code for H5Mget_file & H5Mflush and re-targeted some of the H5D calls
to use them.
-rw-r--r-- | src/H5D.c | 6 | ||||
-rw-r--r-- | src/H5M.c | 87 | ||||
-rw-r--r-- | src/H5Mprivate.h | 5 |
3 files changed, 95 insertions, 3 deletions
@@ -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... */ @@ -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 */ } }; |