MeshIO.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef LVR2_IO_HDF5_MESHIO_HPP
4 #define LVR2_IO_HDF5_MESHIO_HPP
5 
6 #include <boost/optional.hpp>
7 
8 #include "lvr2/io/MeshBuffer.hpp"
10 #include <highfive/H5DataSet.hpp>
11 #include <highfive/H5DataSpace.hpp>
12 #include <highfive/H5File.hpp>
13 
14 // Dependencies
15 #include "ChannelIO.hpp"
16 #include "VariantChannelIO.hpp"
17 #include "ArrayIO.hpp"
18 
19 namespace lvr2 {
20 namespace hdf5features {
21 
51 template<typename Derived>
52 class MeshIO : public AttributeMeshIOBase {
53 public:
54  void save(std::string name, const MeshBufferPtr& buffer);
55  void save(HighFive::Group& group, const MeshBufferPtr& buffer);
56 
57  MeshBufferPtr load(std::string name);
59  MeshBufferPtr loadMesh(std::string name);
60 
61  void setMeshName(std::string meshName);
62 
63 protected:
64 
65  bool isMesh(HighFive::Group& group);
66 
67  Derived* m_file_access = static_cast<Derived*>(this);
68 
69  std::string m_mesh_name = "";
70 
71  // dependencies
73 
74  static constexpr const char* ID = "MeshIO";
75  static constexpr const char* OBJID = "MeshBuffer";
76 
78 
84 
90 
95  bool addVertices(const FloatChannel& channel_ptr);
96 
101  bool addIndices(const IndexChannel& channel_ptr);
102 
103  template <typename T>
104  bool getChannel(const std::string group, const std::string name, boost::optional<AttributeChannel<T>>& channel);
105 
113  virtual bool getChannel(const std::string group, const std::string name, FloatChannelOptional& channel);
114 
122  virtual bool getChannel(const std::string group, const std::string name, IndexChannelOptional& channel);
123 
131  virtual bool getChannel(const std::string group, const std::string name, UCharChannelOptional& channel);
132 
133  template <typename T>
134  bool addChannel(const std::string group, const std::string name, const AttributeChannel<T>& channel);
135 
143  virtual bool addChannel(const std::string group, const std::string name, const FloatChannel& channel);
144 
152  virtual bool addChannel(const std::string group, const std::string name, const IndexChannel& channel);
153 
161  virtual bool addChannel(const std::string group, const std::string name, const UCharChannel& channel);
162 
163 
164 };
165 
166 
167 } // hdf5features
168 
169 
177 template<typename Derived>
178 struct Hdf5Construct<hdf5features::MeshIO, Derived> {
179 
180  // DEPS
183  using deps = typename dep1::template Merge<dep2>;
184 
185  // ADD THE FEATURE ITSELF
186  using type = typename deps::template add_features<hdf5features::MeshIO>::type;
187 
188 };
189 
190 } // namespace lvr2
191 
192 #include "MeshIO.tcc"
193 
194 #endif // LVR2_IO_HDF5_MESHIO_HPP
lvr2::hdf5features::MeshIO::addVertices
bool addVertices(const FloatChannel &channel_ptr)
Persistence layer interface, Writes the vertices of the mesh to the persistence layer.
lvr2::hdf5features::MeshIO::setMeshName
void setMeshName(std::string meshName)
lvr2::IndexChannelOptional
IndexChannel::Optional IndexChannelOptional
Definition: Channel.hpp:100
lvr2::hdf5features::MeshIO::getIndices
IndexChannelOptional getIndices()
Persistence layer interface, Accesses the face indices of the mesh in the persistence layer.
lvr2::hdf5features::MeshIO::save
void save(std::string name, const MeshBufferPtr &buffer)
lvr2::UCharChannelOptional
UCharChannel::Optional UCharChannelOptional
Definition: Channel.hpp:96
lvr2::Hdf5Construct< hdf5features::MeshIO, Derived >::type
typename deps::template add_features< hdf5features::MeshIO >::type type
Definition: MeshIO.hpp:186
lvr2::Hdf5Construct::type
typename Derived::template add_features< Feature >::type type
Definition: HDF5FeatureBase.hpp:165
lvr2::Hdf5Construct< hdf5features::MeshIO, Derived >::deps
typename dep1::template Merge< dep2 > deps
Definition: MeshIO.hpp:183
lvr2::Hdf5Construct< hdf5features::MeshIO, Derived >::dep2
typename Hdf5Construct< hdf5features::ArrayIO, Derived >::type dep2
Definition: MeshIO.hpp:182
H5File.hpp
lvr2::hdf5features::MeshIO::m_vchannel_io
VariantChannelIO< Derived > * m_vchannel_io
Definition: MeshIO.hpp:72
lvr2::hdf5features::MeshIO::addChannel
bool addChannel(const std::string group, const std::string name, const AttributeChannel< T > &channel)
lvr2::hdf5features::MeshIO::loadMesh
MeshBufferPtr loadMesh(std::string name)
lvr2::FloatChannelOptional
FloatChannel::Optional FloatChannelOptional
Definition: Channel.hpp:88
VariantChannelIO.hpp
H5DataSet.hpp
H5DataSpace.hpp
lvr2::AttributeMeshIOBase
Definition: AttributeMeshIOBase.hpp:47
lvr2::hdf5features::MeshIO::m_mesh_name
std::string m_mesh_name
Definition: MeshIO.hpp:69
lvr2::hdf5features::MeshIO::ID
static constexpr const char * ID
Definition: MeshIO.hpp:74
lvr2::hdf5features::MeshIO::load
MeshBufferPtr load(std::string name)
lvr2::hdf5features::VariantChannelIO
Hdf5IO Feature for handling VariantChannel related IO.
Definition: hdf5/VariantChannelIO.hpp:59
HighFive::Group
Definition: H5Group.hpp:20
lvr2::hdf5features::MeshIO::m_array_io
ArrayIO< Derived > * m_array_io
Definition: MeshIO.hpp:77
MeshBuffer.hpp
ChannelIO.hpp
lvr2::hdf5features::MeshIO::OBJID
static constexpr const char * OBJID
Definition: MeshIO.hpp:75
lvr2::Channel< float >
lvr2::hdf5features::MeshIO::m_file_access
Derived * m_file_access
Definition: MeshIO.hpp:67
lvr2::hdf5features::MeshIO::addIndices
bool addIndices(const IndexChannel &channel_ptr)
Persistence layer interface, Writes the face indices of the mesh to the persistence layer.
lvr2
Definition: BaseBufferManipulators.hpp:39
AttributeMeshIOBase.hpp
lvr2::Hdf5Construct< hdf5features::MeshIO, Derived >::dep1
typename Hdf5Construct< hdf5features::VariantChannelIO, Derived >::type dep1
Definition: MeshIO.hpp:181
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
lvr2::hdf5features::MeshIO::isMesh
bool isMesh(HighFive::Group &group)
lvr2::Hdf5Construct
Helper class how to construct a IO feature with its dependencies.
Definition: HDF5FeatureBase.hpp:27
lvr2::hdf5features::ArrayIO
Definition: hdf5/ArrayIO.hpp:13
ArrayIO.hpp
lvr2::hdf5features::MeshIO::getChannel
bool getChannel(const std::string group, const std::string name, boost::optional< AttributeChannel< T >> &channel)
lvr2::hdf5features::MeshIO
Hdf5IO Feature for handling MeshBuffer related IO.
Definition: MeshIO.hpp:52
lvr2::hdf5features::MeshIO::getVertices
FloatChannelOptional getVertices()
Persistence layer interface, Accesses the vertices of the mesh in the persistence layer.


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 Wed Mar 2 2022 00:37:24