diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-08-31 13:46:47 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-08-31 13:46:47 (GMT) |
commit | 1e38c1378582208f6f109042c37c8fff858f985d (patch) | |
tree | cbed547d5490029b2f49f31a61187d33edaa8933 /src/H5R.c | |
parent | e4053f38c2b2732ffa48b7401581db2516b47951 (diff) | |
download | hdf5-1e38c1378582208f6f109042c37c8fff858f985d.zip hdf5-1e38c1378582208f6f109042c37c8fff858f985d.tar.gz hdf5-1e38c1378582208f6f109042c37c8fff858f985d.tar.bz2 |
[svn-r633] Changes since 19980828
----------------------
./RELEASE
Updated with important changes I made since the second beta.
./src/H5A.c
./src/H5D.c
./src/H5Dprivate.h
./src/H5G.c
./src/H5Gprivate.h
./src/H5R.c
./src/H5Rprivate.h
./src/H5T.c
./src/H5Tprivate.h
Any API function that used to take an `hid_t loc_id' followed
by a `const char *name' can now take any type of object for
the loc_id as long as the object is somehow associated with a
file. Internally, H5G_loc() was modified to return an
H5G_entry_t* instead of an H5G_t* so it's more general.
Among other things, this allows one to retrieve information
about an object like a named type or dataset without knowing
the name of the type or dataset:
int
get_nlinks (hid_t obj)
{
H5G_stat_t sb;
if (H5Gstat(obj, ".", TRUE, &sb)<0) return -1;
return sb.nlink;
}
./test/gheap.c
./test/istore.c
These files needed a couple of changes because they call some
of the internal functions whose H5G_t arguments changed to
H5G_entry_t.
./src/H5A.c
Got rid of all the switch statements for getting symbol table
entries for varous objects and replaced them with a call to
H5G_loc() allowing attributes to automatically apply to any
type of object that belongs to a file.
./test/Makefile.in
Moved the ragged array tests from the normal list of tests to
the `make timings' target.
./test/ragged.c
Added rewrite tests -- rewrite the rows of a dataset changing
the number of rows and the length of each row.
./test/mtime.c
Added a test that checks that H5Gstat() can be called with a
dataset as the first argument.
./src/H5S.c
Added #ifdef HAVE_PARALLEL around code to check for the
HDF5_MPI_OPT_TYPES environment variable because the global
variable that gets set is #ifdef'd.
./bin/release
bzip2 uses .bz2 as the file extension.
Diffstat (limited to 'src/H5R.c')
-rw-r--r-- | src/H5R.c | 76 |
1 files changed, 44 insertions, 32 deletions
@@ -40,6 +40,7 @@ typedef struct H5R_meta_t { } H5R_meta_t; struct H5R_t { + H5G_t *group; /*the group containing everything */ H5D_t *meta; /*ragged meta data array */ H5D_t *raw; /*fixed-width raw data */ H5D_t *over; /*overflow data */ @@ -160,7 +161,7 @@ hid_t H5Rcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t plist_id) { H5R_t *ra=NULL; - H5G_t *loc=NULL; + H5G_entry_t *loc=NULL; H5T_t *type=NULL; const H5D_create_t *plist=NULL; hid_t ret_value=FAIL; @@ -229,10 +230,10 @@ H5Rcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t plist_id) *------------------------------------------------------------------------- */ H5R_t * -H5R_create(H5G_t *loc, const char *name, H5T_t *type, const H5D_create_t *dcpl) +H5R_create(H5G_entry_t *loc, const char *name, H5T_t *type, + const H5D_create_t *dcpl) { H5R_t *ra = NULL; - H5G_t *grp = NULL; H5S_t *space = NULL; hsize_t cur_dims[2]; hsize_t max_dims[2]; @@ -255,7 +256,7 @@ H5R_create(H5G_t *loc, const char *name, H5T_t *type, const H5D_create_t *dcpl) } /* Create the group to contain the arrays */ - if (NULL==(grp=H5G_create(loc, name, 0))) { + if (NULL==(ra->group=H5G_create(loc, name, 0))) { HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, NULL, "unable to create container group"); } @@ -269,7 +270,8 @@ H5R_create(H5G_t *loc, const char *name, H5T_t *type, const H5D_create_t *dcpl) HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, NULL, "unable to define raw dataset extents"); } - if (NULL==(ra->raw=H5D_create(grp, "raw", type, space, dcpl))) { + if (NULL==(ra->raw=H5D_create(H5G_entof(ra->group), "raw", type, space, + dcpl))) { HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, NULL, "unable to create raw dataset"); } @@ -291,7 +293,8 @@ H5R_create(H5G_t *loc, const char *name, H5T_t *type, const H5D_create_t *dcpl) d1_dcpl = *dcpl; d1_dcpl.chunk_ndims = 1; d1_dcpl.chunk_size[0] = dcpl->chunk_size[0]*dcpl->chunk_size[1]; - if (NULL==(ra->over=H5D_create(grp, "over", type, space, &d1_dcpl))) { + if (NULL==(ra->over=H5D_create(H5G_entof(ra->group), "over", type, space, + &d1_dcpl))) { HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, NULL, "unable to create overflow dataset"); } @@ -314,8 +317,8 @@ H5R_create(H5G_t *loc, const char *name, H5T_t *type, const H5D_create_t *dcpl) (dcpl->chunk_size[0]*dcpl->chunk_size[1]* H5T_get_size(type))/ H5T_get_size(H5R_meta_type_g)); - if (NULL==(ra->meta=H5D_create(grp, "meta", H5R_meta_type_g, space, - &d1_dcpl))) { + if (NULL==(ra->meta=H5D_create(H5G_entof(ra->group), "meta", + H5R_meta_type_g, space, &d1_dcpl))) { HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, NULL, "unable to create meta dataset"); } @@ -326,20 +329,13 @@ H5R_create(H5G_t *loc, const char *name, H5T_t *type, const H5D_create_t *dcpl) } space = NULL; - /* Close the group -- we no longer need it */ - if (H5G_close(grp)<0) { - grp = NULL; - HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, NULL, - "unable to close ragged array group"); - } - grp = NULL; ret_value = ra; done: if (!ret_value) { - if (grp) H5G_close(grp); if (space) H5S_close(space); if (ra) { + if (ra->group) H5G_close(ra->group); if (ra->raw) H5D_close(ra->raw); if (ra->over) H5D_close(ra->over); if (ra->meta) H5D_close(ra->meta); @@ -371,7 +367,7 @@ H5R_create(H5G_t *loc, const char *name, H5T_t *type, const H5D_create_t *dcpl) hid_t H5Ropen(hid_t loc_id, const char *name) { - H5G_t *loc=NULL; + H5G_entry_t *loc=NULL; H5R_t *ra=NULL; hid_t ret_value=FAIL; @@ -421,11 +417,10 @@ H5Ropen(hid_t loc_id, const char *name) *------------------------------------------------------------------------- */ H5R_t * -H5R_open(H5G_t *loc, const char *name) +H5R_open(H5G_entry_t *loc, const char *name) { H5R_t *ra = NULL; H5R_t *ret_value = NULL; - H5G_t *grp=NULL; FUNC_ENTER(H5R_open, NULL); @@ -440,32 +435,25 @@ H5R_open(H5G_t *loc, const char *name) } /* Open the containing group */ - if (NULL==(grp=H5G_open(loc, name))) { + if (NULL==(ra->group=H5G_open(loc, name))) { HGOTO_ERROR(H5E_RAGGED, H5E_CANTOPENOBJ, NULL, "unable to open container group"); } /* Open the datasets */ - if (NULL==(ra->raw=H5D_open(grp, "raw")) || - NULL==(ra->over=H5D_open(grp, "over")) || - NULL==(ra->meta=H5D_open(grp, "meta"))) { + if (NULL==(ra->raw=H5D_open(H5G_entof(ra->group), "raw")) || + NULL==(ra->over=H5D_open(H5G_entof(ra->group), "over")) || + NULL==(ra->meta=H5D_open(H5G_entof(ra->group), "meta"))) { HGOTO_ERROR(H5E_RAGGED, H5E_CANTOPENOBJ, NULL, "unable to open one or more component datasets"); } - /* Close group */ - if (H5G_close(grp)<0) { - grp = NULL; - HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, NULL, - "unable to close container group"); - } - grp = NULL; ret_value = ra; done: if (!ret_value) { - if (grp) H5G_close(grp); if (ra) { + if (ra->group) H5G_close(ra->group); if (ra->raw) H5D_close(ra->raw); if (ra->over) H5D_close(ra->over); if (ra->meta) H5D_close(ra->meta); @@ -540,7 +528,8 @@ H5R_close(H5R_t *ra) FUNC_ENTER(H5R_close, FAIL); assert(ra); - if ((ra->raw && H5D_close(ra->raw)<0) || + if ((ra->group && H5G_close(ra->group)<0) || + (ra->raw && H5D_close(ra->raw)<0) || (ra->over && H5D_close(ra->over)<0) || (ra->meta && H5D_close(ra->meta)<0)) { HRETURN_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL, @@ -1175,3 +1164,26 @@ H5R_read(H5R_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type, FUNC_LEAVE(ret_value); } + +/*------------------------------------------------------------------------- + * Function: H5R_entof + * + * Purpose: Return a pointer to the ragged arrays symbol table entry. + * + * Return: Success: Ptr to symbol table entry + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Friday, August 28, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +H5G_entry_t * +H5R_entof(H5R_t *ra) +{ + assert(ra); + return H5G_entof(ra->group); +} |