Developer Documentation
OpenMesh::IO::_IOManager_ Class Reference

#include <libs_required/OpenMesh/src/OpenMesh/Core/IO/IOManager.hh>

Public Member Functions

bool read (const std::string &_filename, BaseImporter &_bi, Options &_opt)
 
bool read (std::istream &_filename, const std::string &_ext, BaseImporter &_bi, Options &_opt)
 
bool write (const std::string &_filename, BaseExporter &_be, Options _opt=Options::Default, std::streamsize _precision=6)
 
bool write (std::ostream &_filename, const std::string &_ext, BaseExporter &_be, Options _opt=Options::Default, std::streamsize _precision=6)
 
bool can_read (const std::string &_format) const
 Returns true if the format is supported by one of the reader modules.
 
bool can_write (const std::string &_format) const
 Returns true if the format is supported by one of the writer modules.
 
size_t binary_size (const std::string &_format, BaseExporter &_be, Options _opt=Options::Default)
 
const std::string & qt_read_filters () const
 
const std::string & qt_write_filters () const
 
bool register_module (BaseReader *_bl)
 
bool register_module (BaseWriter *_bw)
 

Private Member Functions

 _IOManager_ ()
 Constructor has nothing todo for the Manager.
 
 ~_IOManager_ ()
 Destructor has nothing todo for the Manager.
 
void update_read_filters ()
 
void update_write_filters ()
 
const BaseWriterfind_writer (const std::string &_format)
 

Private Attributes

std::set< BaseReader * > reader_modules_
 
std::set< BaseWriter * > writer_modules_
 
std::string read_filters_
 
std::string write_filters_
 

Friends

OPENMESHDLLEXPORT _IOManager_IOManager ()
 

Detailed Description

This is the real IOManager class that is later encapsulated by SingletonT to enforce its uniqueness. IOManager is not meant to be used directly by the programmer - the IOManager alias exists for this task.

All reader/writer modules register themselves at this class. For reading or writing data all modules are asked to do the job. If no suitable module is found, an error is returned.

For the sake of reading, the target data structure is hidden behind the BaseImporter interface that takes care of adding vertices or faces.

Writing from a source structure is encapsulate similarly behind a BaseExporter interface, providing iterators over vertices/faces to the writer modules.

See also
Read and write meshes from files

Definition at line 107 of file IOManager.hh.

Member Function Documentation

const std::string& OpenMesh::IO::_IOManager_::qt_read_filters ( ) const
inline

Returns all readable file extension + descriptions in one string. File formats are separated by ;;. Convenience function for Qt file dialogs.

Definition at line 194 of file IOManager.hh.

const std::string& OpenMesh::IO::_IOManager_::qt_write_filters ( ) const
inline

Returns all writeable file extension + descriptions in one string. File formats are separated by ;;. Convenience function for Qt file dialogs.

Definition at line 201 of file IOManager.hh.

bool OpenMesh::IO::_IOManager_::read ( const std::string &  _filename,
BaseImporter _bi,
Options _opt 
)

Read a mesh from file _filename. The target data structure is specified by the given BaseImporter. The read method consecutively queries all of its reader modules. True is returned upon success, false if all reader modules failed to interprete _filename.

Definition at line 92 of file IOManager.cc.

bool OpenMesh::IO::_IOManager_::read ( std::istream &  _filename,
const std::string &  _ext,
BaseImporter _bi,
Options _opt 
)

Read a mesh from open std::istream _is. The target data structure is specified by the given BaseImporter. The sread method consecutively queries all of its reader modules. True is returned upon success, false if all reader modules failed to use _is.

Definition at line 123 of file IOManager.cc.

bool OpenMesh::IO::_IOManager_::register_module ( BaseReader _bl)
inline

Registers a new reader module. A call to this function should be implemented in the constructor of all classes derived from BaseReader.

Definition at line 222 of file IOManager.hh.

bool OpenMesh::IO::_IOManager_::register_module ( BaseWriter _bw)
inline

Registers a new writer module. A call to this function should be implemented in the constructor of all classed derived from BaseWriter.

Definition at line 234 of file IOManager.hh.

bool OpenMesh::IO::_IOManager_::write ( const std::string &  _filename,
BaseExporter _be,
Options  _opt = Options::Default,
std::streamsize  _precision = 6 
)

Write a mesh to file _filename. The source data structure is specified by the given BaseExporter. The save method consecutively queries all of its writer modules. True is returned upon success, false if all writer modules failed to write the requested format. Options is determined by _filename's extension.

Definition at line 148 of file IOManager.cc.

bool OpenMesh::IO::_IOManager_::write ( std::ostream &  _filename,
const std::string &  _ext,
BaseExporter _be,
Options  _opt = Options::Default,
std::streamsize  _precision = 6 
)

Write a mesh to open std::ostream _os. The source data structure is specified by the given BaseExporter. The save method consecutively queries all of its writer modules. True is returned upon success, false if all writer modules failed to write the requested format. Options is determined by _filename's extension.

Definition at line 177 of file IOManager.cc.

Friends And Related Function Documentation

OPENMESHDLLEXPORT _IOManager_& IOManager ( )
friend

Declare the singleton getter function as friend to access the private constructor and destructor

Definition at line 77 of file IOManager.cc.


The documentation for this class was generated from the following files: