145 lines
3.8 KiB
Diff
145 lines
3.8 KiB
Diff
From: Daniel Drake <dsd@gentoo.org>
|
|
|
|
Index: OpenMesh/Core/IO/OMFormat.hh
|
|
===================================================================
|
|
--- OpenMesh.orig/Core/IO/OMFormat.hh
|
|
+++ OpenMesh/Core/IO/OMFormat.hh
|
|
@@ -462,23 +462,6 @@ namespace OMFormat {
|
|
typedef GenProg::False t_unsigned;
|
|
|
|
|
|
- /// Store an integer with a wanted number of bits
|
|
- template< typename T >
|
|
- inline
|
|
- size_t
|
|
- store( std::ostream& _os,
|
|
- const T& _val,
|
|
- OMFormat::Chunk::Integer_Size _b,
|
|
- bool _swap)
|
|
- {
|
|
- assert( OMFormat::is_integer( _val ) );
|
|
-
|
|
- if ( OMFormat::is_signed( _val ) )
|
|
- return store( _os, _val, _b, _swap, t_signed() );
|
|
- return store( _os, _val, _b, _swap, t_unsigned() );
|
|
- }
|
|
-
|
|
-
|
|
// helper to store a an integer
|
|
template< typename T >
|
|
size_t
|
|
@@ -497,24 +480,22 @@ namespace OMFormat {
|
|
bool _swap,
|
|
t_unsigned);
|
|
|
|
-
|
|
- /// Restore an integer with a wanted number of bits
|
|
+ /// Store an integer with a wanted number of bits
|
|
template< typename T >
|
|
inline
|
|
size_t
|
|
- restore( std::istream& _is,
|
|
- T& _val,
|
|
- OMFormat::Chunk::Integer_Size _b,
|
|
- bool _swap)
|
|
+ store( std::ostream& _os,
|
|
+ const T& _val,
|
|
+ OMFormat::Chunk::Integer_Size _b,
|
|
+ bool _swap)
|
|
{
|
|
assert( OMFormat::is_integer( _val ) );
|
|
-
|
|
+
|
|
if ( OMFormat::is_signed( _val ) )
|
|
- return restore( _is, _val, _b, _swap, t_signed() );
|
|
- return restore( _is, _val, _b, _swap, t_unsigned() );
|
|
+ return store( _os, _val, _b, _swap, t_signed() );
|
|
+ return store( _os, _val, _b, _swap, t_unsigned() );
|
|
}
|
|
|
|
-
|
|
// helper to store a an integer
|
|
template< typename T > inline
|
|
size_t restore( std::istream& _is,
|
|
@@ -530,18 +511,26 @@ namespace OMFormat {
|
|
OMFormat::Chunk::Integer_Size _b,
|
|
bool _swap,
|
|
t_unsigned);
|
|
- //
|
|
- // ---------------------------------------- storing vectors
|
|
|
|
- /// storing a vector type
|
|
- template <typename VecT> inline
|
|
- size_t vector_store( std::ostream& _os, const VecT& _vec, bool _swap )
|
|
- {
|
|
- return store( _os, _vec,
|
|
- GenProg::Int2Type< vector_traits<VecT>::size_ >(),
|
|
- _swap );
|
|
+ /// Restore an integer with a wanted number of bits
|
|
+ template< typename T >
|
|
+ inline
|
|
+ size_t
|
|
+ restore( std::istream& _is,
|
|
+ T& _val,
|
|
+ OMFormat::Chunk::Integer_Size _b,
|
|
+ bool _swap)
|
|
+ {
|
|
+ assert( OMFormat::is_integer( _val ) );
|
|
+
|
|
+ if ( OMFormat::is_signed( _val ) )
|
|
+ return restore( _is, _val, _b, _swap, t_signed() );
|
|
+ return restore( _is, _val, _b, _swap, t_unsigned() );
|
|
}
|
|
|
|
+ //
|
|
+ // ---------------------------------------- storing vectors
|
|
+
|
|
template <typename VecT> inline
|
|
size_t store( std::ostream& _os, const VecT& _vec, GenProg::Int2Type<1>,
|
|
bool _swap )
|
|
@@ -579,19 +568,17 @@ namespace OMFormat {
|
|
return bytes;
|
|
}
|
|
|
|
- // ---------------------------------------- restoring vectors
|
|
-
|
|
- /// Restoring a vector type
|
|
- template <typename VecT>
|
|
- inline
|
|
- size_t
|
|
- vector_restore( std::istream& _is, VecT& _vec, bool _swap )
|
|
+ /// storing a vector type
|
|
+ template <typename VecT> inline
|
|
+ size_t vector_store( std::ostream& _os, const VecT& _vec, bool _swap )
|
|
{
|
|
- return restore( _is, _vec,
|
|
- GenProg::Int2Type< vector_traits<VecT>::size_ >(),
|
|
- _swap );
|
|
+ return store( _os, _vec,
|
|
+ GenProg::Int2Type< vector_traits<VecT>::size_ >(),
|
|
+ _swap );
|
|
}
|
|
|
|
+ // ---------------------------------------- restoring vectors
|
|
+
|
|
|
|
template <typename VecT>
|
|
inline
|
|
@@ -644,6 +631,17 @@ namespace OMFormat {
|
|
return bytes;
|
|
}
|
|
|
|
+ /// Restoring a vector type
|
|
+ template <typename VecT>
|
|
+ inline
|
|
+ size_t
|
|
+ vector_restore( std::istream& _is, VecT& _vec, bool _swap )
|
|
+ {
|
|
+ return restore( _is, _vec,
|
|
+ GenProg::Int2Type< vector_traits<VecT>::size_ >(),
|
|
+ _swap );
|
|
+ }
|
|
+
|
|
// ---------------------------------------- storing property names
|
|
|
|
template <>
|