BWAPI
|
00001 // Copyright (c) 1997 Utrecht University (The Netherlands), 00002 // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), 00003 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg 00004 // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), 00005 // and Tel-Aviv University (Israel). All rights reserved. 00006 // 00007 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00008 // modify it under the terms of the GNU Lesser General Public License as 00009 // published by the Free Software Foundation; version 2.1 of the License. 00010 // See the file LICENSE.LGPL distributed with CGAL. 00011 // 00012 // Licensees holding a valid commercial license may use this file in 00013 // accordance with the commercial license agreement provided with the software. 00014 // 00015 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 // 00018 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Stream_support/include/CGAL/IO/File_header_OFF.h $ 00019 // $Id: File_header_OFF.h 35787 2007-01-24 17:16:05Z spion $ 00020 // 00021 // 00022 // Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de> 00023 00024 00025 #ifndef CGAL_IO_FILE_HEADER_OFF_H 00026 #define CGAL_IO_FILE_HEADER_OFF_H 1 00027 00028 #include <CGAL/IO/File_header_extended_OFF.h> 00029 #include <iostream> 00030 00031 CGAL_BEGIN_NAMESPACE 00032 00033 // Info structure for OFF file headers 00034 // =================================== 00035 class File_header_OFF : public File_header_extended_OFF { 00036 private: 00037 // Publicly accessible file informations. 00038 int n_vertices; 00039 int n_facets; 00040 bool m_skel; // SKEL format instead of OFF. 00041 bool m_binary; // OFF in binary format. 00042 bool m_no_comments; // no comments in output. 00043 int m_offset; // index offset for vertices, usually 0. 00044 00045 // Publicly accessible but not that well supported file informations. 00046 bool m_colors; // COFF detected. 00047 bool m_normals; // NOFF format stores also normals at vertices. 00048 00049 // More privately used file informations to scan the file. 00050 bool m_tag4; // 4OFF detected. 00051 bool m_tagDim; // nOFF detected (will not be supported). 00052 int m_dim; // dimension for nOFF (will not be supported). 00053 public: 00054 typedef File_header_OFF Self; 00055 typedef File_header_extended_OFF Base; 00056 00057 explicit File_header_OFF( bool verbose = false); 00058 File_header_OFF( bool binary, bool noc, bool skel, 00059 bool verbose = false); 00060 //File_header_OFF( int v, int h, int f, bool verbose = false); 00061 File_header_OFF( int v, int h, int f, 00062 bool binary, bool noc, bool skel, 00063 bool verbose = false); 00064 File_header_OFF( const File_header_extended_OFF& ext_header); 00065 File_header_OFF( const File_header_extended_OFF& ext_header, 00066 bool binary, bool noc, bool skel); 00067 File_header_OFF( int v, int h, int f, 00068 const File_header_extended_OFF& ext_header); 00069 File_header_OFF( int v, int h, int f, 00070 const File_header_extended_OFF& ext_header, 00071 bool binary, bool noc, bool skel); 00072 00073 Self& operator= ( const Base& base) { (Base&)(*this) = base; 00074 return *this; 00075 } 00076 int size_of_vertices() const { return n_vertices; } 00077 int size_of_facets() const { return n_facets; } 00078 00079 bool skel() const { return m_skel; } // SKEL format. 00080 bool off() const { return ! m_skel; } // OFF format. 00081 bool binary() const { return m_binary; } // binary format. 00082 bool ascii() const { return ! m_binary; } // ASCII format. 00083 bool no_comments() const { return m_no_comments; } 00084 bool comments() const { return ! m_no_comments; } 00085 00086 int index_offset() const { return m_offset; } 00087 bool has_colors() const { return m_colors; } // COFF detected. 00088 bool has_normals() const { return m_normals;} // NOFF format. 00089 bool is_homogeneous() const { return m_tag4; } // 4OFF detected. 00090 // nOFF detected. (will not be supported). 00091 bool n_dimensional() const { return m_tagDim; } 00092 // dimension for nOFF (will not be supported). 00093 int dimension() const { return m_dim; } 00094 00095 void set_vertices( int n) { n_vertices = n; } 00096 void set_facets( int n) { n_facets = n; } 00097 00098 void set_skel( bool b) { m_skel = b; } 00099 void set_binary( bool b) { m_binary = b; } 00100 void set_no_comments( bool b) { m_no_comments = b; } 00101 void set_index_offset( int i) { m_offset = i; } 00102 00103 void set_colors( bool b) { m_colors = b; } 00104 void set_normals( bool b) { m_normals = b;} 00105 void set_homogeneous( bool b) { m_tag4 = b; } 00106 void set_dimensional( bool b) { m_tagDim = b; } 00107 void set_dimension( int i) { m_dim = i; } 00108 Self& operator+=( const Self& header); 00109 }; 00110 00111 // Write header. 00112 std::ostream& operator<<( std::ostream& out, const File_header_OFF& h); 00113 00114 // Scan header. Marks streams badbit if not in SKEL format nor in OFF. 00115 std::istream& operator>>( std::istream& in, File_header_OFF& h); 00116 00117 CGAL_END_NAMESPACE 00118 #endif // CGAL_IO_FILE_HEADER_OFF_H // 00119 // EOF //