Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

BaseWriter.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                               OpenMesh                                    *
00004  *      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openmesh.org                                *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------* 
00008  *                                                                           *
00009  *                                License                                    *
00010  *                                                                           *
00011  *  This library is free software; you can redistribute it and/or modify it  *
00012  *  under the terms of the GNU Library General Public License as published   *
00013  *  by the Free Software Foundation, version 2.                              *
00014  *                                                                           *
00015  *  This library is distributed in the hope that it will be useful, but      *
00016  *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
00018  *  Library General Public License for more details.                         *
00019  *                                                                           *
00020  *  You should have received a copy of the GNU Library General Public        *
00021  *  License along with this library; if not, write to the Free Software      *
00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
00023  *                                                                           *
00024 \*===========================================================================*/
00025 
00026 
00027 //=============================================================================
00028 //
00029 //  Implements the baseclass for IOManager writer modules
00030 //
00031 //=============================================================================
00032 
00033 
00034 #ifndef __BASEWRITER_HH__
00035 #define __BASEWRITER_HH__
00036 
00037 
00038 //=== INCLUDES ================================================================
00039 
00040 
00041 // STD C++
00042 #include <iostream>
00043 #include <string>
00044 
00045 // OpenMesh
00046 #include <OpenMesh/Core/System/config.hh>
00047 #include <OpenMesh/Core/IO/Options.hh>
00048 #include <OpenMesh/Core/IO/exporter/BaseExporter.hh>
00049 
00050 
00051 //== NAMESPACES ===============================================================
00052 
00053 
00054 namespace OpenMesh {
00055 namespace IO {
00056 
00057 
00058 //=== IMPLEMENTATION ==========================================================
00059 
00060 
00065 class BaseWriter
00066 {
00067 public:
00068 
00069   typedef unsigned int Option;
00070    
00072   virtual ~BaseWriter() {}
00073 
00075   virtual std::string get_description() const = 0;
00076   
00078   virtual std::string get_extensions() const = 0;
00079 
00081   virtual bool can_u_write(const std::string& _filename) const;
00082 
00084   virtual bool write(const std::string& _filename, 
00085                      BaseExporter& _be,
00086                      Options _opt) const = 0;
00087 
00089   virtual size_t binary_size(BaseExporter&, Options) const { return 0; }
00090 
00091 
00092 
00093 protected:
00094 
00095   bool check(BaseExporter& _be, Options _opt) const
00096   {
00097     return (_opt.check(Options::VertexNormal ) <= _be.has_vertex_normals())
00098        &&  (_opt.check(Options::VertexTexCoord)<= _be.has_vertex_texcoords())
00099        &&  (_opt.check(Options::VertexColor)   <= _be.has_vertex_colors())
00100        &&  (_opt.check(Options::FaceNormal)    <= _be.has_face_normals())
00101        &&  (_opt.check(Options::FaceColor)     <= _be.has_face_colors());
00102   }
00103 };
00104 
00105 
00106 //=============================================================================
00107 } // namespace IO
00108 } // namespace OpenMesh
00109 //=============================================================================
00110 #endif
00111 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .