- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Namespace List
- Namespace Members

# OpenMesh::IO Namespace Reference

This namespace contains functions for reading and writing polygonal meshes and a list of supported file formats. More...

## Classes
class | BaseExporter
| Base class for exporter modules. More...
class | ExporterT
| This class template provides an exporter module for OpenMesh meshes. More...
class | BaseImporter
| Base class for importer modules. More...
class | ImporterT
| This class template provides an importer module for OpenMesh meshes. More...
class | _IOManager_
| This is the real IOManager class that is later encapsulated by SingletonT to enforce its uniqueness. More...
class | Options
| Set options for reader/writer modules. More...
class | BaseReader
| Base class for reader modules. More...
class | _OBJReader_
| Implementation of the OBJ format reader. More...
class | _OFFReader_
| Implementation of the OFF format reader. More...
class | _OMReader_
| Implementation of the OM format reader. More...
class | _STLReader_
| Implementation of the STL format reader. More...
struct | binary
| The struct defines how to store and restore the type T. More...
class | BaseWriter
| Base class for all writer modules. More...
class | _OBJWriter_
| This class defines the OBJ writer. More...
class | _OFFWriter_
| Implementation of the OFF format writer. More...
class | _OMWriter_
| Implementation of the OM format writer. More...
class | _STLWriter_
| Implementation of the STL format writer. More...
## Typedefs
Handling binary input/output.
These functions take care of swapping bytes to get the right Endian.
typedef unsigned char | uchar
typedef unsigned short | ushort
typedef unsigned int | uint
typedef unsigned long | ulong
typedef char | int8_t
typedef unsigned char | uint8_t
typedef short | int16_t
typedef unsigned short | uint16_t
typedef long | int32_t
typedef unsigned long | uint32_t
typedef long long | int64_t
typedef unsigned long long | uint64_t
typedef float | float32_t
typedef double | float64_t
typedef uint8_t | rgb_t [3]
typedef uint8_t | rgba_t [4]
## Functions
template<typename T>
size_t | store (std::ostream &_os, const T &_val, OMFormat::Chunk::Integer_Size _b, bool _swap)
| Store an integer with a wanted number of bits.
template<typename T>
size_t | restore (std::istream &_is, T &_val, OMFormat::Chunk::Integer_Size _b, bool _swap)
| Restore an integer with a wanted number of bits.
template<typename VecT>
size_t | vector_store (std::ostream &_os, const VecT &_vec, bool _swap)
| storing a vector type
template<typename VecT>
size_t | vector_restore (std::istream &_is, VecT &_vec, bool _swap)
| Restoring a vector type.
Handling binary input/output.
These functions take care of swapping bytes to get the right Endian.
short int | read_short (FILE *_in, bool _swap=false)
| Binary read a `short` from `_is` and perform byte swapping if `_swap` is true.
int | read_int (FILE *_in, bool _swap=false)
| Binary read an `int` from `_is` and perform byte swapping if `_swap` is true.
float | read_float (FILE *_in, bool _swap=false)
| Binary read a `float` from `_is` and perform byte swapping if `_swap` is true.
double | read_double (FILE *_in, bool _swap=false)
| Binary read a `double` from `_is` and perform byte swapping if `_swap` is true.
void | write_short (short int _i, FILE *_out, bool _swap=false)
| Binary write a `short` to `_os` and perform byte swapping if `_swap` is true.
void | write_int (int _i, FILE *_out, bool _swap=false)
| Binary write an `int` to `_os` and perform byte swapping if `_swap` is true.
void | write_float (float _f, FILE *_out, bool _swap=false)
| Binary write a `float` to `_os` and perform byte swapping if `_swap` is true.
void | write_double (double _d, FILE *_out, bool _swap=false)
| Binary write a `double` to `_os` and perform byte swapping if `_swap` is true.
Mesh Reading / Writing
Convenience functions the map to IOManager functions. See also: OpenMesh::IO::_IOManager_
template<class Mesh>
bool | read_mesh (Mesh &_mesh, const std::string &_filename, bool _clear=true)
| Read a mesh from file _filename.
template<class Mesh>
bool | read_mesh (Mesh &_mesh, const std::string &_filename, Options &_opt, bool _clear=true)
| Read a mesh from file _filename.
template<class Mesh>
bool | write_mesh (const Mesh &_mesh, const std::string &_filename, Options _opt=Options::Default)
| Write a mesh to the file _filename.
template<class Mesh>
size_t | binary_size (const Mesh &_mesh, const std::string &_format, Options _opt=Options::Default)
| Read a mesh from file _filename.
Handling binary input/output.
These functions take care of swapping bytes to get the right Endian.
template<size_t N>
void | _reverse_byte_order_N (uint8_t *_val)
template<>
void | _reverse_byte_order_N< 1 > (uint8_t *_val)
template<>
void | _reverse_byte_order_N< 2 > (uint8_t *_val)
template<>
void | _reverse_byte_order_N< 4 > (uint8_t *_val)
template<>
void | _reverse_byte_order_N< 8 > (uint8_t *_val)
template<>
void | _reverse_byte_order_N< 12 > (uint8_t *_val)
template<>
void | _reverse_byte_order_N< 16 > (uint8_t *_val)
template<typename T>
T * | reverse_byte_order (T *t)
void | compile_time_error__no_fundamental_type ()
template<typename T>
T & | reverse_byte_order (T &_t)
template<>
bool & | reverse_byte_order (bool &_t)
template<>
char & | reverse_byte_order (char &_t)
template<>
uchar & | reverse_byte_order (uchar &_t)
template<>
int16_t & | reverse_byte_order (int16_t &_t)
template<>
uint16_t & | reverse_byte_order (uint16_t &_t)
template<>
int & | reverse_byte_order (int &_t)
template<>
uint & | reverse_byte_order (uint &_t)
template<>
int32_t & | reverse_byte_order (int32_t &_t)
template<>
uint32_t & | reverse_byte_order (uint32_t &_t)
template<>
int64_t & | reverse_byte_order (int64_t &_t)
template<>
uint64_t & | reverse_byte_order (uint64_t &_t)
template<>
float & | reverse_byte_order (float &_t)
template<>
double & | reverse_byte_order (double &_t)
template<>
long double & | reverse_byte_order (long double &_t)
template<typename T>
T | reverse_byte_order (const T &a)
Handling binary input/output.
These functions take care of swapping bytes to get the right Endian.
template<typename T>
bool | is_streamable (void)
template<typename T>
bool | is_streamable (const T &)
template<typename T>
size_t | size_of (const T &_v)
template<typename T>
size_t | size_of (void)
template<typename T>
size_t | store (std::ostream &_os, const T &_v, bool _swap=false)
template<typename T>
size_t | restore (std::istream &_is, T &_v, bool _swap=false)
## Variables
_OFFReader_ | __OFFReaderInstance
| Declare the single entity of the OFF reader.
_OFFReader_ | __OFFReaderInstance
| Declare the single entity of the OFF reader.
_OMReader_ | __OMReaderInstance
| Declare the single entity of the OM reader.
_OMReader_ | __OMReaderInstance
| Declare the single entity of the OM reader.
_STLReader_ | __STLReaderInstance
| Declare the single entity of the STL reader.
_STLReader_ | __STLReaderInstance
| Declare the single entity of the STL reader.
_OBJWriter_ | __OBJWriterinstance
| Declare the single entity of the OBJ writer.
_OBJWriter_ | __OBJWriterinstance
| Declare the single entity of the OBJ writer.
_OFFWriter_ | __OFFWriterInstance
| Declare the single entity of the OFF writer.
_OFFWriter_ | __OFFWriterInstance
| Declare the single entity of the OFF writer.
_OMWriter_ | __OMWriterInstance
| Declare the single entity of the OM writer.
_OMWriter_ | __OMWriterInstance
| Declare the single entity of the OM writer.

## Detailed Description

This namespace contains functions for reading and writing polygonal meshes and a list of supported file formats.

## Function Documentation

template<class Mesh>

size_t OpenMesh::IO::binary_size | ( | const Mesh & | _mesh,
|  | const std::string & | _format,
|  | Options | _opt = `Options::Default` |
| ) |  |  |

Read a mesh from file _filename.

The file format is determined by the file extension.

template<class Mesh>

bool OpenMesh::IO::read_mesh | ( | Mesh & | _mesh,
|  | const std::string & | _filename,
|  | Options & | _opt,
|  | bool | _clear = `true` |
| ) |  |  |

Read a mesh from file _filename.

The file format is determined by the file extension.

template<class Mesh>

bool OpenMesh::IO::read_mesh | ( | Mesh & | _mesh,
|  | const std::string & | _filename,
|  | bool | _clear = `true` |
| ) |  |  |

Read a mesh from file _filename.

The file format is determined by the file extension.

template<class Mesh>

bool OpenMesh::IO::write_mesh | ( | const Mesh & | _mesh,
|  | const std::string & | _filename,
|  | Options | _opt = `Options::Default` |
| ) |  |  |

Write a mesh to the file _filename.

The file format is determined by _filename's extension.