| 48 | |
| 49 | |
| 50 | void Handler::initialize( |
| 51 | const std::string& filename, |
| 52 | const std::map<std::string,std::string>& map) |
| 53 | { |
| 54 | try |
| 55 | { |
| 56 | m_h5File.reset(new H5::H5File(filename, H5F_ACC_RDONLY)); |
| 57 | } |
| 58 | catch (const H5::FileIException&) |
| 59 | { |
| 60 | throw pdal_error("Could not open HDF5 file '" + filename + "'."); |
| 61 | } |
| 62 | |
| 63 | // Create our vector of dimensions and associated data |
| 64 | for( auto const& entry : map) { |
| 65 | std::string const& dimName = entry.first; |
| 66 | std::string const& datasetName = entry.second; |
| 67 | m_dimInfos.emplace_back(DimInfo(dimName, datasetName, m_h5File.get())); |
| 68 | } |
| 69 | |
| 70 | // Check that all dimensions have equal lengths |
| 71 | m_numPoints = m_dimInfos.at(0).getNumPoints(); |
| 72 | for( DimInfo& info : m_dimInfos) { |
| 73 | if(m_numPoints != info.getNumPoints()) { |
| 74 | throw pdal_error("All given datasets must have the same length"); |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | |
| 80 | void Handler::close() |
nothing calls this directly
no test coverage detected