diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1998-10-07 21:04:51 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1998-10-07 21:04:51 (GMT) |
commit | c4f1dfcf17118f16254f469332b346c74dea1c53 (patch) | |
tree | 77b72e7079afe86c1b4bb0b50c01d3e9912dd460 /src/H5I.c | |
parent | fe135c15da44b70fdf966ced9262c6b1cf0ec45c (diff) | |
download | hdf5-c4f1dfcf17118f16254f469332b346c74dea1c53.zip hdf5-c4f1dfcf17118f16254f469332b346c74dea1c53.tar.gz hdf5-c4f1dfcf17118f16254f469332b346c74dea1c53.tar.bz2 |
[svn-r743] Added H5I_type_t type to H5_trace and added H5Iget_type function call. Also
checked in H5R skeleton files.
Diffstat (limited to 'src/H5I.c')
-rw-r--r-- | src/H5I.c | 46 |
1 files changed, 37 insertions, 9 deletions
@@ -84,13 +84,13 @@ static herr_t H5I_init_interface(void); # define ID_CACHE_SIZE 4 /*# of previous atoms cached */ #endif -/* # of bits to use for Group ID in each atom (change if H5I_MAXID>16) */ -#define GROUP_BITS 8 -#define GROUP_MASK 0xFF +/* # of bits to use for Group ID in each atom (change if H5I_MAXID>32) */ +#define GROUP_BITS 5 +#define GROUP_MASK 0x1F /* # of bits to use for the Atom index in each atom (assumes 8-bit bytes) */ #define ID_BITS ((sizeof(hid_t)*8)-GROUP_BITS) -#define ID_MASK 0x0FFFFFFF +#define ID_MASK 0x07FFFFFF /* Map an atom to a Group number */ #define H5I_GROUP(a) ((H5I_type_t) \ @@ -148,6 +148,9 @@ H5I_init_interface(void) herr_t ret_value = SUCCEED; FUNC_ENTER(H5I_init_interface, FAIL); + /* Make certain the ID types don't overflow the number of bits allocated for them in an ID */ + assert((int)H5I_MAXID<=(int)pow((double)2.0,(double)GROUP_BITS)); + /* Registers the cleanup routine with the exit chain */ ret_value = H5_add_exit(&H5I_term_interface); @@ -551,13 +554,38 @@ H5I_get_type(hid_t id) FUNC_ENTER(H5I_get_type, H5I_BADID); + assert(id>H5I_BADID && id<H5I_MAXID); + ret_value = H5I_GROUP(id); - if (ret_value <= H5I_BADID || ret_value >= H5I_MAXID) { - HGOTO_DONE(H5I_BADID); - } - - done: + FUNC_LEAVE(ret_value); +} + +/****************************************************************************** + NAME + H5Iget_type - Returns the type of an ID + + DESCRIPTION + Retrieves the type of an ID. + + RETURNS + Returns group if successful and H5I_BADID otherwise + +*******************************************************************************/ +H5I_type_t +H5Iget_type(hid_t id) +{ + H5I_type_t ret_value = H5I_BADID; + + FUNC_ENTER(H5Iget_type, H5I_BADID); + H5TRACE1("It","i",id); + + if (ret_value <= H5I_BADID || ret_value >= H5I_MAXID) + HGOTO_DONE(H5I_BADID); + + ret_value = H5I_get_type(id); + +done: FUNC_LEAVE(ret_value); } |