diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1999-03-12 20:05:43 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1999-03-12 20:05:43 (GMT) |
commit | 7795177df772237ca07e521cc6900be1933c795a (patch) | |
tree | 9b491c1eb7c7c60884cbfd31e676d72066b67406 | |
parent | b8ef51ee7a0cf3fd27ccedac81f637ac10c75942 (diff) | |
download | hdf5-7795177df772237ca07e521cc6900be1933c795a.zip hdf5-7795177df772237ca07e521cc6900be1933c795a.tar.gz hdf5-7795177df772237ca07e521cc6900be1933c795a.tar.bz2 |
[svn-r1139] Added code for H5Rget_object_type
-rw-r--r-- | src/H5R.c | 95 | ||||
-rw-r--r-- | src/H5Rpublic.h | 1 | ||||
-rw-r--r-- | src/H5Sselect.c | 68 |
3 files changed, 138 insertions, 26 deletions
@@ -38,6 +38,7 @@ static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space); static hid_t H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref); static H5S_t * H5R_get_region(H5D_t *dset, H5R_type_t ref_type, void *_ref); +static intn H5R_get_object_type(H5D_t *dset, void *_ref); /*-------------------------------------------------------------------------- @@ -610,3 +611,97 @@ done: FUNC_LEAVE(ret_value); } /* end H5Rget_region() */ + +/*-------------------------------------------------------------------------- + NAME + H5R_get_object_type + PURPOSE + Retrieves the type of object that an object reference points to + USAGE + intn H5Rget_object_type(dset, ref) + H5D_t *dset; IN: dataset pointer that the reference is located within + void *ref; IN: Reference to query. + + RETURNS + Success: An object type defined in H5Gpublic.h + Failure: H5G_UNKNOWN + DESCRIPTION + Given a reference to some object, this function returns the type of object + pointed to. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static intn +H5R_get_object_type(H5D_t *dset, void *_ref) +{ + H5G_entry_t ent; /* Symbol table entry */ + hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */ + uint8_t *p; /* Pointer to OID to store */ + intn ret_value = H5G_UNKNOWN; + + FUNC_ENTER(H5R_get_object_type, FAIL); + + assert(ref); + assert(dset); + + /* Initialize the symbol table entry */ + HDmemset(&ent,0,sizeof(H5G_entry_t)); + ent.type=H5G_NOTHING_CACHED; + ent.file=H5D_get_file(dset); + + /* Get the object oid */ + p=(uint8_t *)ref->oid; + H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header)); + + /* Get the OID type */ + ret_value=H5G_get_type(&ent); + +#ifdef LATER +done: +#endif /* LATER */ + FUNC_LEAVE(ret_value); +} /* end H5R_get_object_type() */ + +/*-------------------------------------------------------------------------- + NAME + H5Rget_object_type + PURPOSE + Retrieves the type of object that an object reference points to + USAGE + intn H5Rget_object_type(ref) + hid_t dataset; IN: dataset the reference is located within + void *ref; IN: Reference to query. + + RETURNS + Success: An object type defined in H5Gpublic.h + Failure: H5G_UNKNOWN + DESCRIPTION + Given a reference to some object, this function returns the type of object + pointed to. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +intn +H5Rget_object_type(hid_t dataset, void *_ref) +{ + H5D_t *dset = NULL; /* dataset object */ + hid_t ret_value = FAIL; + + FUNC_ENTER(H5Rget_object_type, FAIL); + + /* Check args */ + if (H5I_DATASET != H5I_get_type(dataset) || NULL == (dset = H5I_object(dataset))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); + if(_ref==NULL) + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); + + /* Get the object information */ + ret_value=H5R_get_object_type(dset,_ref); + +done: + FUNC_LEAVE(ret_value); +} /* end H5Rget_object_type() */ diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 37b9c77..61e96b7 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -70,6 +70,7 @@ __DLL__ herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id); __DLL__ hid_t H5Rdereference(hid_t dataset, H5R_type_t ref_type, void *ref); __DLL__ hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, void *ref); +__DLL__ int H5Rget_object_type(hid_t dataset, void *_ref); #ifdef __cplusplus } diff --git a/src/H5Sselect.c b/src/H5Sselect.c index a792d09..20e2bc0 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -1287,13 +1287,17 @@ H5Sget_select_elem_npoints(hid_t spaceid) RETURNS Non-negative on success, negative on failure DESCRIPTION - Puts a list of the hyperslab blocks into the user's buffer. The block - coordinates have the same dimensionality (rank) as the dataspace they - are located within. The list of blocks is formatted as follows: - <"start" coordinate> immediately followed by <"opposite" corner coordinate>, - followed by the next "start" coordinate, etc. until all the block - information in the selection have been put into the user's buffer. No - guarantee of any order of the blocks is implied. + Puts a list of the hyperslab blocks into the user's buffer. The blocks + start with the 'startblock'th block in the list of blocks and put + 'numblocks' number of blocks into the user's buffer (or until the end of + the list of blocks, whichever happen first) + The block coordinates have the same dimensionality (rank) as the + dataspace they are located within. The list of blocks is formatted as + follows: <"start" coordinate> immediately followed by <"opposite" corner + coordinate>, followed by the next "start" and "opposite" coordinate, etc. + until all the block information requested has been put into the user's + buffer. + No guarantee of any order of the blocks is implied. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -1350,13 +1354,17 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numbloc RETURNS Non-negative on success, negative on failure DESCRIPTION - Puts a list of the hyperslab blocks into the user's buffer. The block - coordinates have the same dimensionality (rank) as the dataspace they - are located within. The list of blocks is formatted as follows: - <"start" coordinate> immediately followed by <"opposite" corner coordinate>, - followed by the next "start" coordinate, etc. until all the block - information in the selection have been put into the user's buffer. No - guarantee of any order of the blocks is implied. + Puts a list of the hyperslab blocks into the user's buffer. The blocks + start with the 'startblock'th block in the list of blocks and put + 'numblocks' number of blocks into the user's buffer (or until the end of + the list of blocks, whichever happen first) + The block coordinates have the same dimensionality (rank) as the + dataspace they are located within. The list of blocks is formatted as + follows: <"start" coordinate> immediately followed by <"opposite" corner + coordinate>, followed by the next "start" and "opposite" coordinate, etc. + until all the block information requested has been put into the user's + buffer. + No guarantee of any order of the blocks is implied. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -1400,12 +1408,16 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numbloc RETURNS Non-negative on success, negative on failure DESCRIPTION - Puts a list of the element points into the user's buffer. The point - coordinates have the same dimensionality (rank) as the dataspace they - are located within. The list of points is formatted as follows: - <coordinate> followed by the next coordinate, etc. until all the point - information in the selection have been put into the user's buffer. No - guarantee of any order of the elements is implied. + Puts a list of the element points into the user's buffer. The points + start with the 'startpoint'th block in the list of points and put + 'numpoints' number of points into the user's buffer (or until the end of + the list of points, whichever happen first) + The point coordinates have the same dimensionality (rank) as the + dataspace they are located within. The list of points is formatted as + follows: <coordinate> followed by the next coordinate, etc. until all the + point information in the selection have been put into the user's buffer. + The points are returned in the order they will be interated through + when a selection is read/written from/to disk. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -1461,12 +1473,16 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint RETURNS Non-negative on success, negative on failure DESCRIPTION - Puts a list of the element points into the user's buffer. The point - coordinates have the same dimensionality (rank) as the dataspace they - are located within. The list of points is formatted as follows: - <coordinate> followed by the next coordinate, etc. until all the point - information in the selection have been put into the user's buffer. No - guarantee of any order of the elements is implied. + Puts a list of the element points into the user's buffer. The points + start with the 'startpoint'th block in the list of points and put + 'numpoints' number of points into the user's buffer (or until the end of + the list of points, whichever happen first) + The point coordinates have the same dimensionality (rank) as the + dataspace they are located within. The list of points is formatted as + follows: <coordinate> followed by the next coordinate, etc. until all the + point information in the selection have been put into the user's buffer. + The points are returned in the order they will be interated through + when a selection is read/written from/to disk. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES |