I have this adapted code:
//
···
-----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
herr_t H5Utilities::closeFile(hid_t &fileId)
{
herr_t err = 1;
if (fileId < 0) { // fileId isn't open
return 1;
}
// Get the number of open identifiers of all types
// except files
int32_t num_open = H5Fget_obj_count(fileId, H5F_OBJ_DATASET | H5F_OBJ_GROUP |
H5F_OBJ_DATATYPE | H5F_OBJ_ATTR);
if (num_open > 0) {
std::cout << "WARNING: Some IDs weren't closed. Closing them." << std::endl;
std::vector<hid_t> attr_ids(num_open, 0);
H5Fget_obj_ids(fileId, H5F_OBJ_DATASET | H5F_OBJ_GROUP |
H5F_OBJ_DATATYPE | H5F_OBJ_ATTR,
num_open, &(attr_ids.front()) );
for (int i=0; i<num_open; i++)
{
H5Utilities::closeHDF5Object(attr_ids[i]);
}
}
err = H5Fclose(fileId);
if (err < 0) {
std::cout << logTime() << "Error Closing HDF5 File." << err << std::endl;
}
fileId= -1;
return err;
}
Which I run to close a file to make sure everything is cleaned up. I have some other code that I am developing that is reporting that I still have ids that are open. Problem is I can not seem to track down what is being left open. Is there an API that I can use (Version 1.6.9/10) that given the Object ID, I can tell what path in the HDF5 file that object represents? I can obviously break up the initial getting of the objects to narrow it down to either a group or data set or attribute or what ever. But once I have the object ID, what can I do with it?
Thanks
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio