| 47 | { } |
| 48 | |
| 49 | void Hdf5Handler::initialize( |
| 50 | const std::string& filename, |
| 51 | const std::vector<Hdf5ColumnData>& columns) |
| 52 | { |
| 53 | try |
| 54 | { |
| 55 | m_h5File.reset(new H5::H5File(filename, H5F_ACC_RDONLY)); |
| 56 | } |
| 57 | catch (const H5::FileIException&) |
| 58 | { |
| 59 | throw error("Could not open HDF5 file '" + filename + "'."); |
| 60 | } |
| 61 | |
| 62 | try |
| 63 | { |
| 64 | // Open each HDF5 DataSet and its corresponding DataSpace. |
| 65 | for (const auto& col : columns) |
| 66 | { |
| 67 | const std::string dataSetName = col.name; |
| 68 | const H5::PredType predType = col.predType; |
| 69 | const H5::DataSet dataSet = m_h5File->openDataSet(dataSetName); |
| 70 | const H5::DataSpace dataSpace = dataSet.getSpace(); |
| 71 | |
| 72 | m_columnDataMap.insert(std::make_pair( |
| 73 | dataSetName, |
| 74 | ColumnData(predType, dataSet, dataSpace))); |
| 75 | |
| 76 | // Does not check whether all the columns are the same length. |
| 77 | m_numPoints = (std::max)((uint64_t)getColumnNumEntries(dataSetName), |
| 78 | m_numPoints); |
| 79 | } |
| 80 | } |
| 81 | catch (const H5::Exception&) |
| 82 | { |
| 83 | throw error("Could not initialize data set information."); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void Hdf5Handler::close() |
| 88 | { |
nothing calls this directly
no test coverage detected