Hdf5Util.hpp
Go to the documentation of this file.
1 #ifndef HDF5UTIL_HPP
2 #define HDF5UTIL_HPP
3 
4 #pragma once
5 
7 #include "lvr2/io/Timestamp.hpp"
8 
9 #include <H5Tpublic.h>
10 #include <boost/filesystem.hpp>
11 #include <boost/optional.hpp>
12 
13 #include <chrono>
14 #include <hdf5_hl.h>
15 #include <highfive/H5DataSet.hpp>
16 #include <highfive/H5DataSpace.hpp>
17 #include <highfive/H5File.hpp>
18 #include <memory>
19 #include <string>
20 #include <vector>
21 
22 namespace lvr2
23 {
24 
25 namespace hdf5util
26 {
27 
28 template<typename T>
29 void addArray(
30  HighFive::Group& g,
31  const std::string datasetName,
32  std::vector<size_t>& dim,
33  boost::shared_array<T>& data);
34 
35 template<typename T>
36 void addArray(
37  HighFive::Group& g,
38  const std::string datasetName,
39  const size_t& length,
40  boost::shared_array<T>& data);
41 
42 template<typename T>
43  boost::shared_array<T> getArray(
44  const HighFive::Group& g,
45  const std::string& datasetName,
46  std::vector<size_t>& dim);
47 
48 template<typename T>
49 std::vector<size_t> getDimensions(
50  const HighFive::Group& g,
51  const std::string& datasetName);
52 
53 template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
54 void addMatrix(HighFive::Group& group,
55  std::string datasetName,
56  const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& mat);
57 
58 template<typename MatrixT>
59 boost::optional<MatrixT> getMatrix(const HighFive::Group& g, const std::string& datasetName);
60 
61 std::vector<std::string> splitGroupNames(const std::string& groupName);
62 
63 void writeBaseStructure(std::shared_ptr<HighFive::File> hdf5_file);
64 
65 HighFive::Group getGroup(std::shared_ptr<HighFive::File> hdf5_file,
66  const std::string& groupName,
67  bool create = true);
68 
69 HighFive::Group getGroup(HighFive::Group& g, const std::string& groupName, bool create = true);
70 
71 
72 bool exist(std::shared_ptr<HighFive::File> hdf5_file, const std::string& groupName);
73 
74 
75 bool exist(HighFive::Group& group, const std::string& groupName);
76 
77 std::shared_ptr<HighFive::File> open(const std::string& filename);
78 
79 template <typename T>
80 std::unique_ptr<HighFive::DataSet> createDataset(HighFive::Group& g,
81  std::string datasetName,
82  const HighFive::DataSpace& dataSpace,
83  const HighFive::DataSetCreateProps& properties);
84 
85 template <typename T>
86 void setAttribute(HighFive::Group& g, const std::string& attr_name, T& data);
87 
88 
89 
90 } // namespace hdf5util
91 
92 } // namespace lvr2
93 
94 #include "Hdf5Util.tcc"
95 
96 #endif
void addMatrix(HighFive::Group &group, std::string datasetName, const Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &mat)
std::vector< size_t > getDimensions(const HighFive::Group &g, const std::string &datasetName)
boost::shared_array< T > getArray(const HighFive::Group &g, const std::string &datasetName, std::vector< size_t > &dim)
void setAttribute(HighFive::Group &g, const std::string &attr_name, T &data)
boost::optional< MatrixT > getMatrix(const HighFive::Group &g, const std::string &datasetName)
void writeBaseStructure(std::shared_ptr< HighFive::File > hdf5_file)
Definition: Hdf5Util.cpp:36
std::unique_ptr< HighFive::DataSet > createDataset(HighFive::Group &g, std::string datasetName, const HighFive::DataSpace &dataSpace, const HighFive::DataSetCreateProps &properties)
std::shared_ptr< HighFive::File > open(const std::string &filename)
Definition: Hdf5Util.cpp:202
HighFive::Group getGroup(std::shared_ptr< HighFive::File > hdf5_file, const std::string &groupName, bool create=true)
Definition: Hdf5Util.cpp:58
void addArray(HighFive::Group &g, const std::string datasetName, std::vector< size_t > &dim, boost::shared_array< T > &data)
bool exist(std::shared_ptr< HighFive::File > hdf5_file, const std::string &groupName)
Definition: Hdf5Util.cpp:136
std::vector< std::string > splitGroupNames(const std::string &groupName)
Definition: Hdf5Util.cpp:9


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06