Template Class MeshIO

Inheritance Relationships

Base Type

Class Documentation

template<typename Derived>
class MeshIO : public lvr2::AttributeMeshIOBase

Hdf5IO Feature for handling MeshBuffer related IO.

This Feature of the Hdf5IO handles the IO of a MeshBuffer object.

Example:

MyHdf5IO io;
MeshBufferPtr mesh, mesh_in;

// writing
io.open("test.h5");
io.save("amesh", mesh);

// reading
mesh_in = io.loadMesh("amesh");

Generates attributes at hdf5 group:

Dependencies:

Public Functions

void save(std::string name, const MeshBufferPtr &buffer)
void save(HighFive::Group &group, const MeshBufferPtr &buffer)
MeshBufferPtr load(std::string name)
MeshBufferPtr load(HighFive::Group &group)
MeshBufferPtr loadMesh(std::string name)
void setMeshName(std::string meshName)

Protected Functions

bool isMesh(HighFive::Group &group)
virtual FloatChannelOptional getVertices()

Persistence layer interface, Accesses the vertices of the mesh in the persistence layer.

Returns:

An optional float channel, the channel is valid if the mesh vertices have been read successfully

virtual IndexChannelOptional getIndices()

Persistence layer interface, Accesses the face indices of the mesh in the persistence layer.

Returns:

An optional index channel, the channel is valid if the mesh indices have been read successfully

virtual bool addVertices(const FloatChannel &channel_ptr)

Persistence layer interface, Writes the vertices of the mesh to the persistence layer.

Returns:

true if the channel has been written successfully

virtual bool addIndices(const IndexChannel &channel_ptr)

Persistence layer interface, Writes the face indices of the mesh to the persistence layer.

Returns:

true if the channel has been written successfully

template<typename T>
bool getChannel(const std::string group, const std::string name, boost::optional<AttributeChannel<T>> &channel)
virtual bool getChannel(const std::string group, const std::string name, FloatChannelOptional &channel)

getChannel Reads a float attribute channel in the given group with the given name

Parameters:
  • group – The associated attribute group

  • name – The associated attribute name

  • channel – The pointer to the float channel

Returns:

true if the channel has been loaded successfully, false otherwise

virtual bool getChannel(const std::string group, const std::string name, IndexChannelOptional &channel)

getChannel Reads an index attribute channel in the given group with the given name

Parameters:
  • group – The associated attribute group

  • name – The associated attribute name

  • channel – The pointer to the index channel

Returns:

true if the channel has been loaded successfully, false otherwise

virtual bool getChannel(const std::string group, const std::string name, UCharChannelOptional &channel)

getChannel Reads an unsigned char attribute channel in the given group with the given name

Parameters:
  • group – The associated attribute group

  • name – The associated attribute name

  • channel – The pointer to the unsigned char channel

Returns:

true if the channel has been loaded successfully, false otherwise

template<typename T>
bool addChannel(const std::string group, const std::string name, const AttributeChannel<T> &channel)
virtual bool addChannel(const std::string group, const std::string name, const FloatChannel &channel)

addChannel Writes a float attribute channel from the given group with the given name

Parameters:
  • group – The associated attribute group

  • name – The associated attribute name

  • channel – The pointer to the float channel which should be written

Returns:

true if the channel has been written successfully, false otherwise

virtual bool addChannel(const std::string group, const std::string name, const IndexChannel &channel)

addChannel Writes an index attribute channel from the given group with the given name

Parameters:
  • group – The associated attribute group

  • name – The associated attribute name

  • channel – The pointer to the index channel which should be written

Returns:

true if the channel has been written successfully, false otherwise

virtual bool addChannel(const std::string group, const std::string name, const UCharChannel &channel)

addChannel Writes an unsigned char attribute channel from the given group with the given name

Parameters:
  • group – The associated attribute group

  • name – The associated attribute name

  • channel – The pointer to the unsigned char channel which should be written

Returns:

true if the channel has been written successfully, false otherwise

Protected Attributes

Derived *m_file_access = static_cast<Derived*>(this)
std::string m_mesh_name = ""
std::string m_geometry_group = "geometry"

all geometry channels are stored to

std::string m_materials_group = "materials"
std::string m_textures_group = "textures"
ChannelIO<Derived> *m_channel_io = static_cast<ChannelIO<Derived>*>(m_file_access)
VariantChannelIO<Derived> *m_vchannel_io = static_cast<VariantChannelIO<Derived>*>(m_file_access)
ArrayIO<Derived> *m_array_io = static_cast<ArrayIO<Derived>*>(m_file_access)

Protected Static Attributes

static constexpr const char *ID = "MeshIO"
static constexpr const char *OBJID = "MeshBuffer"