This commit is contained in:
2021-06-30 13:03:31 +02:00
parent d7dc1912ac
commit fca9982b72
14 changed files with 314 additions and 43 deletions

View File

@ -1,15 +1,28 @@
#include "HDF5VirtualFile.h"
#include "sls/logger.h"
HDF5VirtualFile::HDF5VirtualFile(int index) : File(index, HDF5), fd_(0) {}
HDF5VirtualFile::HDF5VirtualFile(std::mutex *hdf5Lib)
: File(HDF5), hdf5Lib_(hdf5Lib) {}
HDF5VirtualFile::~HDF5VirtualFile() { CloseFile(); }
void HDF5VirtualFile::CloseFile() {
if (fd_ != 0) {
std::lock_guard<std::mutex> lock(*hdf5Lib_);
/*if (fd_ != 0) {
if (H5Fclose(fd_) < 0) {
LOG(logERROR) << "Could not close virtual HDF5 handles";
}
fd_ = 0;
}*/
try {
Exception::dontPrint(); // to handle errors
if (fd_) {
fd_->close();
delete fd_;
fd_ = nullptr;
}
} catch (const Exception &error) {
LOG(logERROR) << "Could not close virtual HDF5 handles of index";
error.printErrorStack();
}
}