From 4fdeb003fd2b9967f4c2203f116929b3d91f60e2 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 18 Oct 2012 12:29:58 +0000 Subject: [PATCH] 0021478: EDF 2083 ALL: Write the version of Salome used to create the study in the hdf file Additional fix: whe old study is opened, automatically add "unknown" version tag for all components --- src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index efa5daf12..cae31faee 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -40,6 +40,7 @@ #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" #include "SALOMEDSImpl_ScalarVariable.hxx" +#include "SALOMEDSImpl_IParameters.hxx" #include #include "HDFOI.hxx" @@ -245,6 +246,20 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const std::string& aUrl) delete hdf_file; // all related hdf objects will be deleted + // unlock study if it is locked, to set components versions + StudyUnlocker unlock(Study); + + //For old studies we have to add "unknown" version tag for all stored components + SALOMEDSImpl_SComponentIterator itcomponent = Study->NewComponentIterator(); + for (; itcomponent.More(); itcomponent.Next()) + { + SALOMEDSImpl_SComponent sco = itcomponent.Value(); + std::string aCompType = sco.GetComment(); + if ( aCompType == SALOMEDSImpl_IParameters::getDefaultVisualComponent() ) continue; + if ( Study->GetProperties()->GetComponentVersions( aCompType ).empty() ) + Study->GetProperties()->SetComponentVersion( aCompType, "" ); // empty version means "unknown" + } + return Study; } -- 2.39.2