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

OMWriter.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 a writer module for OM files
00030 //
00031 //=============================================================================
00032 
00033 
00034 #ifndef __OMWRITER_HH__
00035 #define __OMWRITER_HH__
00036 
00037 
00038 //=== INCLUDES ================================================================
00039 
00040 
00041 // STD C++
00042 #include <iostream>
00043 #include <string>
00044 
00045 // OpenMesh
00046 #include <OpenMesh/Core/IO/BinaryHelper.hh>
00047 #include <OpenMesh/Core/System/config.hh>
00048 #include <OpenMesh/Core/Utils/SingletonT.hh>
00049 #include <OpenMesh/Core/IO/OMFormat.hh>
00050 #include <OpenMesh/Core/IO/IOManager.hh>
00051 #include <OpenMesh/Core/IO/writer/BaseWriter.hh>
00052 
00053 
00054 //== NAMESPACES ===============================================================
00055 
00056 
00057 namespace OpenMesh {
00058 namespace IO {
00059 
00060 //=== FORWARDS ================================================================
00061 
00062 
00063 class BaseExporter;
00064 
00065 
00066 //=== IMPLEMENTATION ==========================================================
00067 
00068 
00073 class _OMWriter_ : public BaseWriter
00074 {
00075 public:
00076 
00077   // constructor
00078   _OMWriter_();
00079 
00080   std::string get_description() const
00081   { return "OpenMesh Format"; }
00082   
00083   std::string get_extensions() const
00084   { return "om"; }
00085 
00086   bool write(std::ostream&, BaseExporter&, Options) const;
00087 
00088 
00089   size_t binary_size(BaseExporter& _be, Options _opt) const;
00090 
00091 
00092 protected:
00093 
00094   static const OMFormat::uchar magic_[3];
00095   static const OMFormat::uint8 version_;
00096 
00097   bool write(const std::string&, BaseExporter&, Options) const;
00098 
00099   bool write_binary(std::ostream&, BaseExporter&, Options) const;
00100 
00101   size_t store_binary_custom_chunk( std::ostream&, const BaseProperty&,
00102                                     OMFormat::Chunk::Entity, bool) const;
00103 };
00104 
00105 
00106 //== TYPE DEFINITION ==========================================================
00107 
00108 
00110 extern _OMWriter_  __OMWriterInstance;
00111 _OMWriter_& OMWriter();
00112 
00113 
00114 //=============================================================================
00115 } // namespace IO
00116 } // namespace OpenMesh
00117 //=============================================================================
00118 #endif
00119 //=============================================================================

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