diff --git a/src/OpenMesh/Core/IO/StoreRestore.hh b/src/OpenMesh/Core/IO/StoreRestore.hh index e3966c88..fff14302 100644 --- a/src/OpenMesh/Core/IO/StoreRestore.hh +++ b/src/OpenMesh/Core/IO/StoreRestore.hh @@ -89,18 +89,34 @@ template inline size_t size_of( const T& _v ) { return binary< T >::size_of(_v); } +template inline +size_t size_of( const std::vector & _v, bool _store_size = true) +{ return binary< std::vector >::size_of(_v, _store_size); } + template inline size_t size_of(void) { return binary< T >::size_of(); } +template inline +size_t size_of(bool _store_size) +{ return binary< std::vector >::size_of(_store_size); } + template inline size_t store( std::ostream& _os, const T& _v, bool _swap=false) { return binary< T >::store( _os, _v, _swap ); } +template inline +size_t store( std::ostream& _os, const std::vector& _v, bool _swap=false, bool _store_size = true) +{ return binary< std::vector >::store( _os, _v, _swap, _store_size); } + template inline size_t restore( std::istream& _is, T& _v, bool _swap=false) { return binary< T >::restore( _is, _v, _swap ); } +template inline +size_t restore( std::istream& _is, std::vector& _v, bool _swap=false, bool _restore_size = true) +{ return binary< std::vector >::restore( _is, _v, _swap, _restore_size); } + //@} diff --git a/src/OpenMesh/Core/Utils/Property.hh b/src/OpenMesh/Core/Utils/Property.hh index 2f2ec135..3629e540 100644 --- a/src/OpenMesh/Core/Utils/Property.hh +++ b/src/OpenMesh/Core/Utils/Property.hh @@ -56,6 +56,7 @@ #include #include +#include //== NAMESPACES =============================================================== @@ -149,21 +150,23 @@ public: virtual size_t store( std::ostream& _ostr, bool _swap ) const override { - if ( IO::is_streamable() ) - return IO::store(_ostr, data_, _swap ); + if (IO::is_streamable() && element_size() != IO::UnknownSize) + return IO::store(_ostr, data_, _swap, false); //does not need to store its length + size_t bytes = 0; for (size_t i=0; i() ) - return IO::restore(_istr, data_, _swap ); + if ( IO::is_streamable() && element_size() != IO::UnknownSize ) + return IO::restore(_istr, data_, _swap, false); //does not need to restore its length + size_t bytes = 0; for (size_t i=0; i