OpenMesh
OpenMesh::IO Namespace Reference

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

Classes

struct  binary< MyData >
struct  binary< MyMap >
union  u1
union  u2
union  u3
union  u4
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...
struct  OFFFormat
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  _PLYReader_
 Implementation of the PLY format reader. More...
class  CmpVec
class  _STLReader_
 Implementation of the STL format reader. More...
struct  binary
 The struct defines how to store and restore the type T. More...
struct  binary< unsigned long >
struct  binary< Vec1c >
struct  binary< Vec1uc >
struct  binary< Vec1s >
struct  binary< Vec1us >
struct  binary< Vec1i >
struct  binary< Vec1ui >
struct  binary< Vec1f >
struct  binary< Vec1d >
struct  binary< Vec2c >
struct  binary< Vec2uc >
struct  binary< Vec2s >
struct  binary< Vec2us >
struct  binary< Vec2i >
struct  binary< Vec2ui >
struct  binary< Vec2f >
struct  binary< Vec2d >
struct  binary< Vec3c >
struct  binary< Vec3uc >
struct  binary< Vec3s >
struct  binary< Vec3us >
struct  binary< Vec3i >
struct  binary< Vec3ui >
struct  binary< Vec3f >
struct  binary< Vec3d >
struct  binary< Vec4c >
struct  binary< Vec4uc >
struct  binary< Vec4s >
struct  binary< Vec4us >
struct  binary< Vec4i >
struct  binary< Vec4ui >
struct  binary< Vec4f >
struct  binary< Vec4d >
struct  binary< Vec6c >
struct  binary< Vec6uc >
struct  binary< Vec6s >
struct  binary< Vec6us >
struct  binary< Vec6i >
struct  binary< Vec6ui >
struct  binary< Vec6f >
struct  binary< Vec6d >
struct  binary< std::string >
struct  binary< OpenMesh::Attributes::StatusInfo >
struct  FunctorStore
struct  FunctorRestore
struct  binary< std::vector< std::string > >
struct  binary< std::vector< bool > >
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...
struct  Enabler
class  _OMWriter_
 Implementation of the OM format writer. More...
class  _PLYWriter_
 Implementation of the PLY format writer. More...
class  _STLWriter_
 Implementation of the STL format writer. More...

Typedefs

typedef GenProg::True t_signed
typedef GenProg::False t_unsigned

Functions

_IOManager_IOManager ()
template<>
size_t store (std::ostream &_os, const OMFormat::Header &_hdr, bool _swap)
template<>
size_t restore (std::istream &_is, OMFormat::Header &_hdr, bool _swap)
template<>
size_t store (std::ostream &_os, const OMFormat::Chunk::Header &_hdr, bool _swap)
template<>
size_t restore (std::istream &_is, OMFormat::Chunk::Header &_hdr, bool _swap)
template<typename T >
size_t store (std::ostream &_os, const T &_val, OMFormat::Chunk::Integer_Size _b, bool _swap, t_signed)
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, t_signed)
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 store (std::ostream &_os, const VecT &_vec, GenProg::Int2Type< 2 >, bool _swap)
template<typename VecT >
size_t store (std::ostream &_os, const VecT &_vec, GenProg::Int2Type< 3 >, bool _swap)
template<typename VecT >
size_t store (std::ostream &_os, const VecT &_vec, GenProg::Int2Type< 4 >, bool _swap)
template<typename VecT >
size_t store (std::ostream &_os, const VecT &_vec, GenProg::Int2Type< 1 >, bool _swap)
template<typename VecT >
size_t vector_store (std::ostream &_os, const VecT &_vec, bool _swap)
 storing a vector type
template<typename VecT >
size_t restore (std::istream &_is, VecT &_vec, GenProg::Int2Type< 2 >, bool _swap)
template<typename VecT >
size_t restore (std::istream &_is, VecT &_vec, GenProg::Int2Type< 3 >, bool _swap)
template<typename VecT >
size_t restore (std::istream &_is, VecT &_vec, GenProg::Int2Type< 4 >, bool _swap)
template<typename VecT >
size_t restore (std::istream &_is, VecT &_vec, GenProg::Int2Type< 1 >, bool _swap)
template<typename VecT >
size_t vector_restore (std::istream &_is, VecT &_vec, bool _swap)
 Restoring a vector type.
template<>
size_t store (std::ostream &_os, const OMFormat::Chunk::PropertyName &_pn, bool _swap)
template<>
size_t restore (std::istream &_is, OMFormat::Chunk::PropertyName &_pn, bool _swap)
_OBJReader_OBJReader ()
void trimString (std::string &_string)
_OFFReader_OFFReader ()
_OMReader_OMReader ()
_PLYReader_PLYReader ()
std::string get_property_name (std::string _string1, std::string _string2)
_PLYReader_::ValueType get_property_type (std::string _string1, std::string _string2)
_STLReader_STLReader ()
 SIMPLE_BINARY (bool)
 SIMPLE_BINARY (float)
 SIMPLE_BINARY (double)
 SIMPLE_BINARY (long double)
 SIMPLE_BINARY (int8_t)
 SIMPLE_BINARY (int16_t)
 SIMPLE_BINARY (int32_t)
 SIMPLE_BINARY (int64_t)
 SIMPLE_BINARY (uint8_t)
 SIMPLE_BINARY (uint16_t)
 SIMPLE_BINARY (uint32_t)
 SIMPLE_BINARY (uint64_t)
 BINARY_VECTOR (short)
 BINARY_VECTOR (unsigned short)
 BINARY_VECTOR (int)
 BINARY_VECTOR (long)
 BINARY_VECTOR (float)
 BINARY_VECTOR (double)
_OBJWriter_OBJWriter ()
_OFFWriter_OFFWriter ()
_OMWriter_OMWriter ()
_PLYWriter_PLYWriter ()
_STLWriter_STLWriter ()
Mesh Reading / Writing

Option for reader and writer modules.

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 read_mesh (Mesh &_mesh, std::istream &_is, const std::string &_ext, Options &_opt, bool _clear=true)
 Read a mesh from file open std::istream.
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 >
bool write_mesh (const Mesh &_mesh, std::ostream &_os, const std::string &_ext, Options _opt=Options::Default)
 Write a mesh to an open std::ostream.
template<class Mesh >
size_t binary_size (const Mesh &_mesh, const std::string &_format, Options _opt=Options::Default)
 Read a mesh from file _filename.

Variables

union OpenMesh::IO::u1 sc
union OpenMesh::IO::u2 ic
union OpenMesh::IO::u3 fc
union OpenMesh::IO::u4 dc
_IOManager___IOManager_instance = 0
_OBJReader_ __OBJReaderInstance
_OFFReader_ __OFFReaderInstance
 Declare the single entity of the OFF reader.
_OMReader_ __OMReaderInstance
 Declare the single entity of the OM reader.
_PLYReader_ __PLYReaderInstance
 Declare the single entity of the PLY reader.
_STLReader_ __STLReaderInstance
 Declare the single entity of the STL reader.
_OBJWriter_ __OBJWriterinstance
 Declare the single entity of the OBJ writer.
_OFFWriter_ __OFFWriterInstance
 Declare the single entity of the OFF writer.
_OMWriter_ __OMWriterInstance
 Declare the single entity of the OM writer.
_PLYWriter_ __PLYWriterInstance
 Declare the single entity of the PLY writer.
_STLWriter_ __STLWriterInstance

Handling binary input/output.

These functions take care of swapping bytes to get the right Endian.

typedef unsigned char uchar
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef unsigned short ushort
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef unsigned long ulong
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef char int8_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef unsigned char uint8_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef short int16_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef unsigned short uint16_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef int int32_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef unsigned int uint32_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef long long int64_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef unsigned long long uint64_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef float float32_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef double float64_t
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef uint8_t rgb_t [3]
 Binary read a short from _is and perform byte swapping if _swap is true.
typedef uint8_t rgba_t [4]
 Binary read a short from _is and perform byte swapping if _swap is true.
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.
template<size_t N>
void _reverse_byte_order_N (uint8_t *_val)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
void _reverse_byte_order_N< 1 > (uint8_t *)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
void _reverse_byte_order_N< 2 > (uint8_t *_val)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
void _reverse_byte_order_N< 4 > (uint8_t *_val)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
void _reverse_byte_order_N< 8 > (uint8_t *_val)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
void _reverse_byte_order_N< 12 > (uint8_t *_val)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
void _reverse_byte_order_N< 16 > (uint8_t *_val)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<typename T >
T * reverse_byte_order (T *t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
void compile_time_error__no_fundamental_type ()
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<typename T >
T & reverse_byte_order (T &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
bool & reverse_byte_order (bool &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
char & reverse_byte_order (char &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
ucharreverse_byte_order (uchar &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
int16_treverse_byte_order (int16_t &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
uint16_treverse_byte_order (uint16_t &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
unsigned long & reverse_byte_order (unsigned long &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
int32_treverse_byte_order (int32_t &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
uint32_treverse_byte_order (uint32_t &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
int64_treverse_byte_order (int64_t &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
uint64_treverse_byte_order (uint64_t &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
float & reverse_byte_order (float &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
double & reverse_byte_order (double &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<>
long double & reverse_byte_order (long double &_t)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<typename T >
reverse_byte_order (const T &a)
 this does not compile for g++3.4 and higher, hence we comment the function body which will result in a linker error
template<typename T >
bool is_streamable (void)
 Binary read a short from _is and perform byte swapping if _swap is true.
template<typename T >
bool is_streamable (const T &)
 Binary read a short from _is and perform byte swapping if _swap is true.
template<typename T >
size_t size_of (const T &_v)
 Binary read a short from _is and perform byte swapping if _swap is true.
template<typename T >
size_t size_of (void)
 Binary read a short from _is and perform byte swapping if _swap is true.
template<typename T >
size_t store (std::ostream &_os, const T &_v, bool _swap=false)
 Binary read a short from _is and perform byte swapping if _swap is true.
template<typename T >
size_t restore (std::istream &_is, T &_v, bool _swap=false)
 Binary read a short from _is and perform byte swapping if _swap is true.

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,
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,
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,
std::istream &  _is,
const std::string &  _ext,
Options &  _opt,
bool  _clear = true 
)

Read a mesh from file open std::istream.

The file format is determined by parameter _ext. _ext has to include ".[format]" in order to work properly

template<class Mesh >
bool OpenMesh::IO::write_mesh ( const Mesh &  _mesh,
std::ostream &  _os,
const std::string &  _ext,
Options  _opt = Options::Default 
)

Write a mesh to an open std::ostream.

The file format is determined by _ext.

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.