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
typename deps::template add_features< hdf5features::MeshIO >::type type
Definition: MeshIO.hpp:186
bool addChannel(const std::string group, const std::string name, const AttributeChannel< T > &channel)
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
static constexpr const char * OBJID
Definition: MeshIO.hpp:75
bool isMesh(HighFive::Group &group)
typename Hdf5Construct< hdf5features::VariantChannelIO, Derived >::type dep1
Definition: MeshIO.hpp:181
std::string m_mesh_name
Definition: MeshIO.hpp:69
UCharChannel::Optional UCharChannelOptional
Definition: Channel.hpp:96
typename Hdf5Construct< hdf5features::ArrayIO, Derived >::type dep2
Definition: MeshIO.hpp:182
Helper class how to construct a IO feature with its dependencies.
bool addVertices(const FloatChannel &channel_ptr)
Persistence layer interface, Writes the vertices of the mesh to the persistence layer.
Hdf5IO Feature for handling MeshBuffer related IO.
Definition: MeshIO.hpp:52
bool addIndices(const IndexChannel &channel_ptr)
Persistence layer interface, Writes the face indices of the mesh to the persistence layer...
bool getChannel(const std::string group, const std::string name, boost::optional< AttributeChannel< T >> &channel)
IndexChannelOptional getIndices()
Persistence layer interface, Accesses the face indices of the mesh in the persistence layer...
MeshBufferPtr load(std::string name)
FloatChannel::Optional FloatChannelOptional
Definition: Channel.hpp:88
static constexpr const char * ID
Definition: MeshIO.hpp:74
ArrayIO< Derived > * m_array_io
Definition: MeshIO.hpp:77
Hdf5IO Feature for handling VariantChannel related IO.
IndexChannel::Optional IndexChannelOptional
Definition: Channel.hpp:100
typename Derived::template add_features< Feature >::type type
FloatChannelOptional getVertices()
Persistence layer interface, Accesses the vertices of the mesh in the persistence layer...
MeshBufferPtr loadMesh(std::string name)
void setMeshName(std::string meshName)
VariantChannelIO< Derived > * m_vchannel_io
Definition: MeshIO.hpp:72
void save(std::string name, const MeshBufferPtr &buffer)
typename dep1::template Merge< dep2 > deps
Definition: MeshIO.hpp:183


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:08