[svn-r7059] Purpose:

Refactoring

Description:
    Track changes to H5Fget_obj_<foo> API functions.

Platforms tested:
    FreeBSD 4.8 (sleipnir)
    h5committest
This commit is contained in:
Quincey Koziol 2003-06-18 15:52:54 -05:00
parent b6fca58d92
commit 1aeaa7fbb1
8 changed files with 77 additions and 59 deletions

View File

@ -70,8 +70,9 @@ Release 1.4.x versions of this document; they are not reported here.
<tr>
<td align="left" valign="top"><code>H5Fget_obj_ids</code></td>
<td align="left" valign="top">
<em>herr_t </em><code>H5Fget_obj_ids</code> (<em>hid_t</em> <code>file_id</code>,
<em>unsigned int</em> <code>types</code>, <em>hid_t *</em><code>obj_id_list</code>)
<em>int </em><code>H5Fget_obj_ids</code> (<em>hid_t</em> <code>file_id</code>,
<em>unsigned int</em> <code>types</code>,
<em>int</em> <code>max_objs</code>, <em>hid_t *</em><code>obj_id_list</code>)
</td>
</tr>
<tr>

View File

@ -529,9 +529,8 @@ facilitate moving easily between them.</i>
<dl>
<dt><strong>Name:</strong> <a name="File-GetObjCount">H5Fget_obj_count</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Fget_obj_count</code>(<em>hid_t</em> <code>file_id</code>,
<em>unsigned int</em> <code>types</code>,
<em>unsigned int *</em><code>obj_id_count</code>
<dd><em>int </em><code>H5Fget_obj_count</code>(<em>hid_t</em> <code>file_id</code>,
<em>unsigned int</em> <code>types</code>
)
<dt><strong>Purpose:</strong>
<dd>Returns the number of open object identifiers for an open file.
@ -565,13 +564,18 @@ facilitate moving easily between them.</i>
<code>H5F_OBJ_DATATYPE&nbsp;&nbsp;</code>
</td><td valign=top>
Named datatypes only
</td></tr><tr><td valign=top>
<code>H5F_OBJ_ATTR&nbsp;&nbsp;</code>
</td><td valign=top>
Attributes only
</td></tr><tr><td valign=top>
<code>H5F_OBJ_ALL</code>
</td><td valign=top>
All of the above
<br>
(I.e., <code>H5F_OBJ_FILE</code> | <code>H5F_OBJ_DATASET</code> |
<code>H5F_OBJ_GROUP</code> | <code>H5F_OBJ_DATATYPE</code> )
<code>H5F_OBJ_GROUP</code> | <code>H5F_OBJ_DATATYPE</code>
| <code>H5F_OBJ_ATTR</code> )
</td></tr>
</table>
</center>
@ -586,11 +590,9 @@ facilitate moving easily between them.</i>
<code>H5F_OBJ_ALL</code> for all currently-open HDF5 files.
<dt><em>unsigned int</em> <code>types</code>
<dd>IN: Type of object for which identifiers are to be returned.
<dt><em>unsigned int *</em><code>obj_id_count</code>
<dd>OUT: Pointer to the returned list of open object identifiers.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a file access property list identifier if successful;
<dd>Returns a the number of open objects if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5f_FORTRAN.html#h5fget_obj_count_f"
@ -606,8 +608,9 @@ facilitate moving easily between them.</i>
<dl>
<dt><strong>Name:</strong> <a name="File-GetObjIDs">H5Fget_obj_ids</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t </em><code>H5Fget_obj_ids</code>(<em>hid_t</em> <code>file_id</code>,
<dd><em>int </em><code>H5Fget_obj_ids</code>(<em>hid_t</em> <code>file_id</code>,
<em>unsigned int</em> <code>types</code>,
<em>int</em> <code>max_objs</code>,
<em>hid_t *</em><code>obj_id_list</code>
)
<dt><strong>Purpose:</strong>
@ -625,6 +628,9 @@ facilitate moving easily between them.</i>
The types of object identifiers to be retrieved are specified
in <code>types</code> using the codes listed for the same
parameter in <a href="#File-GetObjCount"><code>H5Fget_obj_count</code></a>
<p>
To retrieve identifiers for all open objects, pass a negative value
for the <code>max_objs</code>.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>file_id</code>
@ -632,11 +638,13 @@ facilitate moving easily between them.</i>
<code>H5F_OBJ_ALL</code> for all currently-open HDF5 files.
<dt><em>unsigned int</em> <code>types</code>
<dd>IN: Type of object for which identifiers are to be returned.
<dt><em>int</em> <code>max_objs</code>
<dd>IN: Maximum number of object identifiers to place into <code>obj_id_list</code>.
<dt><em>hid_t *</em><code>obj_id_list</code>
<dd>OUT: Pointer to the returned list of open object identifiers.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
<dd>Returns number of objects placed into <code>obj_id_list</code> if successful;
otherwise returns a negative value.
<dt><strong>Non-C API(s):</strong>
<dd><a href="fortran/h5f_FORTRAN.html#h5fget_obj_ids_f"

View File

@ -300,7 +300,7 @@ FORTRAN File API -- h5f
<dt><strong>FORTRAN interface:</strong> &nbsp <strong>h5fget_obj_ids_f</strong>
<pre>
SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, obj_ids, hdferr)
SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, max_objs, obj_ids, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier
@ -310,6 +310,7 @@ FORTRAN File API -- h5f
! H5F_OBJ_DATASET_F
! H5F_OBJ_DATATYPE_F
! H5F_OBJ_ALL_F
INTEGER, INTENT(IN) :: max_objs ! Maximum # of object IDs to retrieve
INTEGER(HID_T), DIMENSION(*), INTENT(OUT) :: obj_ids
! array of requested object identifiers
INTEGER, INTENT(OUT) :: hdferr ! Error code

View File

@ -417,12 +417,12 @@ nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, int_f * obj_count)
int ret_value = 0;
hid_t c_file_id;
unsigned c_obj_type;
unsigned c_obj_count;
int c_obj_count;
c_file_id = (hid_t)*file_id;
c_obj_type = (unsigned) *obj_type;
if ( H5Fget_obj_count(c_file_id, c_obj_type, &c_obj_count) < 0 ) ret_value = -1;
if ( (c_obj_count=H5Fget_obj_count(c_file_id, c_obj_type)) < 0 ) ret_value = -1;
*obj_count = (int_f)c_obj_count;
return ret_value;
}
@ -439,14 +439,16 @@ nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, int_f * obj_count)
*---------------------------------------------------------------------------*/
int_f
nh5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, hid_t_f *obj_ids)
nh5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, int_f *max_objs, hid_t_f *obj_ids)
{
int ret_value = 0;
hid_t c_file_id;
unsigned c_obj_type;
int c_max_objs;
c_file_id = (hid_t)*file_id;
c_obj_type = (unsigned) *obj_type;
if ( H5Fget_obj_ids(c_file_id, c_obj_type, (hid_t *)obj_ids) < 0 ) ret_value = -1;
c_max_objs = (int)*max_objs;
if ( H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, (hid_t *)obj_ids) < 0 ) ret_value = -1;
return ret_value;
}

View File

@ -771,7 +771,7 @@
! Comment:
!----------------------------------------------------------------------
SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, obj_ids, hdferr)
SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, max_objs, obj_ids, hdferr)
!
!This definition is needed for Windows DLLs
!DEC$if defined(BUILD_HDF5_DLL)
@ -782,23 +782,25 @@
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier
INTEGER, INTENT(IN) :: obj_type ! Object type
INTEGER, INTENT(IN) :: max_objs ! Maximum # of objects to retrieve
INTEGER(HID_T), DIMENSION(*), INTENT(INOUT) :: obj_ids
! Array of open objects iidentifiers
INTEGER, INTENT(OUT) :: hdferr ! Error code
INTERFACE
INTEGER FUNCTION h5fget_obj_ids_c(file_id, obj_type, obj_ids)
INTEGER FUNCTION h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids)
USE H5GLOBAL
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
!MS$ATTRIBUTES C,reference,alias:'_H5FGET_OBJ_IDS_C':: h5fget_obj_ids_c
!DEC$ ENDIF
INTEGER(HID_T), INTENT(IN) :: file_id
INTEGER, INTENT(IN) :: obj_type
INTEGER, INTENT(IN) :: max_objs
INTEGER(HID_T), DIMENSION(*), INTENT(INOUT) :: obj_ids
END FUNCTION h5fget_obj_ids_c
END INTERFACE
hdferr = h5fget_obj_ids_c(file_id, obj_type, obj_ids)
hdferr = h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids)
END SUBROUTINE h5fget_obj_ids_f
END MODULE H5F

View File

@ -77,7 +77,7 @@ H5_DLL int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id);
H5_DLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, int_f *obj_count);
H5_DLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, int_f *obj_ids);
H5_DLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, int_f *max_objs, int_f *obj_ids);
H5_DLL int_f nh5fflush_c (hid_t_f *obj_id, int_f *scope);
/*

View File

@ -638,7 +638,7 @@
write(*,*) "Wrong number of open objects reported, error"
endif
allocate(obj_ids(obj_countf), stat = error)
CALL h5fget_obj_ids_f(fid, H5F_OBJ_FILE_F, obj_ids, error)
CALL h5fget_obj_ids_f(fid, H5F_OBJ_FILE_F, -1, obj_ids, error)
CALL check("h5fget_obj_ids_f",error,total_error)
if(error .eq. 0) then
do i = 1, obj_countf

View File

@ -713,7 +713,7 @@ static void
create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
hid_t *ret_gid2, hid_t *ret_gid3)
{
unsigned oid_count;
int oid_count;
herr_t ret;
/* Check reference counts of file IDs and opened object IDs.
@ -721,22 +721,20 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
* is changed, remember to check this part and update the macros.
*/
{
ret = H5Fget_obj_count(fid1, H5F_OBJ_ALL, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid1, H5F_OBJ_ALL);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_2, "H5Fget_obj_count");
ret = H5Fget_obj_count(fid1, H5F_OBJ_DATASET|H5F_OBJ_GROUP|
H5F_OBJ_DATATYPE, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid1, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
ret = H5Fget_obj_count(fid2, H5F_OBJ_ALL, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid2, H5F_OBJ_ALL);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_2, "H5Fget_obj_count");
ret = H5Fget_obj_count(fid2, H5F_OBJ_DATASET|H5F_OBJ_GROUP|
H5F_OBJ_DATATYPE, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid2, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
}
@ -779,14 +777,17 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
{
hid_t gid1, gid2, gid3;
gid1 = H5Gcreate(fid2, "/group", 0);
CHECK(gid1, FAIL, "H5Gcreate");
if(ret_gid1 != NULL)
*ret_gid1 = gid1;
gid2 = H5Gopen(fid2, "/group");
CHECK(gid2, FAIL, "H5Gopen");
if(ret_gid2 != NULL)
*ret_gid2 = gid2;
gid3 = H5Gopen(fid2, "/group");
CHECK(gid3, FAIL, "H5Gopen");
if(ret_gid3 != NULL)
*ret_gid3 = gid3;
}
@ -796,22 +797,20 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
* is changed, remember to check this part and update the macros.
*/
{
ret = H5Fget_obj_count(fid1, H5F_OBJ_ALL, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid1, H5F_OBJ_ALL);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_6, "H5Fget_obj_count");
ret = H5Fget_obj_count(fid1, H5F_OBJ_DATASET|H5F_OBJ_GROUP|
H5F_OBJ_DATATYPE, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid1, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count");
ret = H5Fget_obj_count(fid2, H5F_OBJ_ALL, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid2, H5F_OBJ_ALL);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_6, "H5Fget_obj_count");
ret = H5Fget_obj_count(fid2, H5F_OBJ_DATASET|H5F_OBJ_GROUP|
H5F_OBJ_DATATYPE, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(fid2, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count");
}
}
@ -826,7 +825,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
hid_t gid2, hid_t gid3)
{
hid_t fid3, fid4;
unsigned oid_count;
int oid_count;
herr_t ret;
/* Create two new files */
@ -836,38 +835,43 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
CHECK(fid4, FAIL, "H5Fcreate");
/* test object count of all files IDs open */
ret = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_FILE, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_FILE);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count");
/* test object count of all dataset open */
ret = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATASET, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
/* test object count of all datasets open */
oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATASET);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_1, "H5Fget_obj_count");
/* test object count of all group open */
ret = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_GROUP, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
/* test object count of all groups open */
oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_GROUP);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_3, "H5Fget_obj_count");
/* test object count of all datatype open */
ret = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATATYPE, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
/* test object count of all named datatypes open */
oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATATYPE);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
/* test object count of all attributes open */
oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ATTR);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
/* test object count of all objects currently open */
ret = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL, &oid_count);
CHECK(ret, FAIL, "H5Fget_obj_count");
oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_8, "H5Fget_obj_count");
{
hid_t *oid_list;
unsigned i;
int i;
H5I_type_t id_type;
oid_list = (hid_t*)calloc(oid_count, sizeof(hid_t));
oid_list = (hid_t*)calloc((size_t)oid_count, sizeof(hid_t));
if(oid_list != NULL) {
ret = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, oid_list);
ret = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, oid_count, oid_list);
CHECK(ret, FAIL, "H5Fget_obj_ids");
}