mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
wip
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user