/*===========================================================================*\ * * * OpenMesh * * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * * www.openmesh.org * * * *---------------------------------------------------------------------------* * This file is part of OpenMesh. * * * * OpenMesh is free software: you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of * * the License, or (at your option) any later version with the * * following exceptions: * * * * If other files instantiate templates or use macros * * or inline functions from this file, or you compile this file and * * link it with other files to produce an executable, this file does * * not by itself cause the resulting executable to be covered by the * * GNU Lesser General Public License. This exception does not however * * invalidate any other reasons why the executable file might be * * covered by the GNU Lesser General Public License. * * * * OpenMesh is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU LesserGeneral Public * * License along with OpenMesh. If not, * * see . * * * \*===========================================================================*/ /*===========================================================================*\ * * * $Revision$ * * $Date$ * * * \*===========================================================================*/ #ifndef OM_MESHIO_HH #define OM_MESHIO_HH //=== INCLUDES ================================================================ // -------------------- system settings #include // -------------------- check include order #if defined (OPENMESH_TRIMESH_ARRAY_KERNEL_HH) || \ defined (OPENMESH_POLYMESH_ARRAY_KERNEL_HH) # error "Include MeshIO.hh before including a mesh type!" #endif // -------------------- OpenMesh #include #include #include #include //== NAMESPACES ============================================================== namespace OpenMesh { namespace IO { //=== IMPLEMENTATION ========================================================== /** \name Mesh Reading / Writing Convenience functions the map to IOManager functions. \see OpenMesh::IO::_IOManager_ */ //@{ //----------------------------------------------------------------------------- /** Read a mesh from file _filename. The file format is determined by the file extension. */ template bool read_mesh(Mesh& _mesh, const std::string& _filename, bool _clear = true) { Options opt; return read_mesh(_mesh, _filename, opt, _clear); } /** Read a mesh from file _filename. The file format is determined by the file extension. */ template bool read_mesh(Mesh& _mesh, const std::string& _filename, Options& _opt, bool _clear = true) { if (_clear) _mesh.clear(); ImporterT importer(_mesh); return IOManager().read(_filename, importer, _opt); } //----------------------------------------------------------------------------- /** Write a mesh to the file _filename. The file format is determined by _filename's extension. */ template bool write_mesh(const Mesh& _mesh, const std::string& _filename, Options _opt = Options::Default) { ExporterT exporter(_mesh); return IOManager().write(_filename, exporter, _opt); } //----------------------------------------------------------------------------- template size_t binary_size(const Mesh& _mesh, const std::string& _format, Options _opt = Options::Default) { ExporterT exporter(_mesh); return IOManager().binary_size(_format, exporter, _opt); } //----------------------------------------------------------------------------- //@} //============================================================================= } // namespace IO } // namespace OpenMesh //============================================================================= #if defined(OM_STATIC_BUILD) || defined(ARCH_DARWIN) # include #endif //============================================================================= #endif //=============================================================================