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 // $Revision: 1.1.1.1 $ 00027 // $Date: 2004/09/06 12:35:08 $ 00028 // 00029 //============================================================================= 00030 00031 00032 //============================================================================= 00033 // 00034 // Helper Functions for binary reading / writing 00035 // 00036 //============================================================================= 00037 00038 #ifndef OPENMESH_STORERESTORE_HH 00039 #define OPENMESH_STORERESTORE_HH 00040 00041 00042 //== INCLUDES ================================================================= 00043 00044 #include <stdexcept> 00045 #include <OpenMesh/Core/System/config.hh> 00046 #include <OpenMesh/Core/IO/SR_binary.hh> 00047 00048 //== NAMESPACES =============================================================== 00049 00050 namespace OpenMesh { 00051 namespace IO { 00052 00053 00054 //============================================================================= 00055 00056 00061 00062 00063 //----------------------------------------------------------------------------- 00064 // StoreRestore definitions 00065 00066 template <typename T> inline 00067 bool is_streamable(void) 00068 { return binary< T >::is_streamable; } 00069 00070 template <typename T> inline 00071 bool is_streamable( const T& ) 00072 { return binary< T >::is_streamable; } 00073 00074 template <typename T> inline 00075 size_t size_of( const T& _v ) 00076 { return binary< T >::size_of(_v); } 00077 00078 template <typename T> inline 00079 size_t size_of(void) 00080 { return binary< T >::size_of(); } 00081 00082 template <typename T> inline 00083 size_t store( std::ostream& _os, const T& _v, bool _swap=false) 00084 { return binary< T >::store( _os, _v, _swap ); } 00085 00086 template <typename T> inline 00087 size_t restore( std::istream& _is, T& _v, bool _swap=false) 00088 { return binary< T >::restore( _is, _v, _swap ); } 00089 00091 00092 00093 //============================================================================= 00094 } // namespace IO 00095 } // namespace OpenMesh 00096 //============================================================================= 00097 #endif // OPENMESH_MESHREADER_HH defined 00098 //=============================================================================