From 8c9cdfbc345881d297f4705bb0fc21885ba45c09 Mon Sep 17 00:00:00 2001 From: "mhochsteger@cerbsim.com" Date: Thu, 11 Nov 2021 15:25:12 +0100 Subject: [PATCH] store netgen version, introduce "format_version" for future changes --- libsrc/occ/occgeom.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index a097ce31..d5a85e97 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1668,8 +1668,12 @@ namespace netgen void OCCGeometry :: DoArchive(Archive& ar) { - int version = 0; - ar & version; + constexpr int current_format_version = 0; + + int format_version = current_format_version; + auto netgen_version = GetLibraryVersion("netgen"); + ar & netgen_version & format_version; + if(ar.Output()) { std::stringstream ss; @@ -1678,6 +1682,11 @@ namespace netgen } else { + if(format_version>current_format_version) + throw Exception("Loading OCCGeometry from archive: unkown format version " + + ToString(format_version) + + ", written by netgen version " + + ToString(netgen_version)); std::string str; ar & str; stringstream ss(str);