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_extended_OFF.h $ 00019 // $Id: File_header_extended_OFF.h 35794 2007-01-24 18:00:30Z spion $ 00020 // 00021 // 00022 // Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de> 00023 00024 00025 #ifndef CGAL_IO_FILE_HEADER_EXTENDED_OFF_H 00026 #define CGAL_IO_FILE_HEADER_EXTENDED_OFF_H 1 00027 #include <CGAL/basic.h> 00028 00029 #include <iostream> 00030 #include <string> 00031 00032 00033 CGAL_BEGIN_NAMESPACE 00034 00035 class File_header_extended_OFF { 00036 bool m_verbose; // Print error messages if true. 00037 bool m_polyhedral_surface; 00038 int m_halfedges; 00039 bool m_triangulated; 00040 bool m_non_empty_facets; 00041 bool m_terrain; 00042 bool m_normalized_to_sphere; 00043 double m_radius; 00044 bool m_rounded; 00045 int m_rounded_bits; 00046 bool m_off_header; 00047 public: 00048 typedef File_header_extended_OFF Self; 00049 File_header_extended_OFF( bool verbose = false) 00050 : m_verbose ( verbose), 00051 m_polyhedral_surface ( false), 00052 m_halfedges ( 0), 00053 m_triangulated ( false), 00054 m_non_empty_facets ( false), 00055 m_terrain ( false), 00056 m_normalized_to_sphere ( false), 00057 m_radius ( 0.0), 00058 m_rounded ( false), 00059 m_rounded_bits ( 0), 00060 m_off_header ( true) 00061 {} 00062 // Access: 00063 bool verbose() const { return m_verbose; } 00064 bool polyhedral_surface() const { return m_polyhedral_surface; } 00065 int halfedges() const { return m_halfedges; } 00066 int size_of_halfedges() const { return m_halfedges; } 00067 bool triangulated() const { return m_triangulated; } 00068 bool non_empty_facets() const { return m_non_empty_facets; } 00069 bool terrain() const { return m_terrain; } 00070 bool normalized_to_sphere() const { return m_normalized_to_sphere; } 00071 double radius() const { return m_radius; } 00072 bool rounded() const { return m_rounded; } 00073 int rounded_bits() const { return m_rounded_bits; } 00074 bool off_header() const { return m_off_header; } 00075 // Derived predicates about the file format. 00076 bool is_OFF() const { return m_off_header; } 00077 bool is_POL() const; 00078 bool is_CBP() const; 00079 bool is_TRN() const; 00080 int is_CBPn() const; 00081 int is_TRNn() const; 00082 // The proper file suffix with respect to file format. 00083 std::string suffix() const; 00084 // The proper format name. 00085 std::string format_name() const; 00086 // Set values: 00087 void set_verbose( bool b) { m_verbose = b; } 00088 void set_polyhedral_surface( bool b) { m_polyhedral_surface = b; } 00089 void set_halfedges( int h) { m_halfedges = h; } 00090 void set_triangulated( bool b) { m_triangulated = b; } 00091 void set_non_empty_facets( bool b) { m_non_empty_facets = b; } 00092 void set_terrain( bool b) { m_terrain = b; } 00093 void set_normalized_to_sphere( bool b) { m_normalized_to_sphere = b;} 00094 void set_radius( double d) { m_radius = d; } 00095 void set_rounded( bool b) { m_rounded = b; } 00096 void set_rounded_bits( int i) { m_rounded_bits = i; } 00097 void set_off_header( bool b) { m_off_header = b; } 00098 Self& operator+=( const Self& header); // union of two headers 00099 }; 00100 00101 // Write extended header incl. CGAL/ENDCBP keywords. 00102 std::ostream& operator<<( std::ostream& out, 00103 const File_header_extended_OFF& h); 00104 00105 // Scan extended header. The CBP keyword must be read already. 00106 std::istream& operator>>( std::istream& in, File_header_extended_OFF& h); 00107 00108 // istream modifier skips chars until end of line. 00109 inline std::istream& skip_until_EOL( std::istream& in) { 00110 char c; 00111 while ( in.get(c) && c != '\n') 00112 ; 00113 return in; 00114 } 00115 00116 // istream modifier that checks for OFF comments and removes them. 00117 inline std::istream& skip_comment_OFF( std::istream& in) { 00118 char c; 00119 while( (in >> c) && c == '#') 00120 in >> skip_until_EOL; 00121 in.putback(c); 00122 return in; 00123 } 00124 00125 CGAL_END_NAMESPACE 00126 #endif // CGAL_IO_FILE_HEADER_EXTENDED_OFF_H // 00127 // EOF //