From b50dafaf34a51b651d89e1087cfe40304e806726 Mon Sep 17 00:00:00 2001 From: Alexandra Heuschling Date: Thu, 5 Nov 2020 20:03:51 +0100 Subject: [PATCH] add enum PropertyType, so that properties can be restored from .om files --- src/OpenMesh/Core/IO/OMFormat.hh | 17 +++++++++++++++++ src/OpenMesh/Core/IO/writer/OMWriter.cc | 11 +++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Core/IO/OMFormat.hh b/src/OpenMesh/Core/IO/OMFormat.hh index 0bc8e3da..b81bfabf 100644 --- a/src/OpenMesh/Core/IO/OMFormat.hh +++ b/src/OpenMesh/Core/IO/OMFormat.hh @@ -275,6 +275,23 @@ namespace OMFormat { }; + //----------------------------------------------------------------------------------------------------------------------------------- + //this enum stores the type of the property so that it can be recovered + enum PropertyType { + BoolType = 0x00, + UCharType= 0x01, + CharType = 0x02, + ShortType = 0x03, + UIntType = 0x04, + IntType = 0x05, + ULongType = 0x06, + LongType = 0x07, + FloatType = 0x08, + DoubleType = 0x09, + VecDoubleType = 0x0a + }; +//----------------------------------------------------------------------------------------------------------------------------------- + }; // Chunk // ------------------------------------------------------------ Helper diff --git a/src/OpenMesh/Core/IO/writer/OMWriter.cc b/src/OpenMesh/Core/IO/writer/OMWriter.cc index c190b2f8..91b7a408 100644 --- a/src/OpenMesh/Core/IO/writer/OMWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OMWriter.cc @@ -620,11 +620,18 @@ size_t _OMWriter_::store_binary_custom_chunk(std::ostream& _os, // 2. property name bytes += store( _os, OMFormat::Chunk::PropertyName(_bp.name()), _swap ); - // 3. block size + // 3. data type + OMFormat::Chunk::PropertyType type; + + + + bytes += store(_os, type, _swap); + + // 4. block size bytes += store( _os, _bp.size_of(), OMFormat::Chunk::Integer_32, _swap ); //omlog() << " n_bytes = " << _bp.size_of() << std::endl; - // 4. data + // 5. data { size_t b; bytes += ( b=_bp.store( _os, _swap ) );