From: apo Date: Fri, 13 Jul 2007 07:26:25 +0000 (+0000) Subject: To finilize persistent for MULTIPR/VISU extension X-Git-Tag: T_MULTIPR_INDUS_Persistence~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb9b4c762dfa261a1e2e4af7b4f0850d977ebd40;p=modules%2Fvisu.git To finilize persistent for MULTIPR/VISU extension --- diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 36438e8f..487bbd48 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -88,7 +88,7 @@ namespace filesystem = boost::filesystem; #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif @@ -427,7 +427,7 @@ namespace VISU std::string anURL = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); if(MYDEBUG) MESSAGE("VISU_Gen_i::SaveASCII - "<GetStudy(); diff --git a/src/VISU_I/VISU_MultiResult_i.cc b/src/VISU_I/VISU_MultiResult_i.cc index e89e5d81..e4832781 100644 --- a/src/VISU_I/VISU_MultiResult_i.cc +++ b/src/VISU_I/VISU_MultiResult_i.cc @@ -43,7 +43,7 @@ #include #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; static int MYTIMEDEBUG = 0; #else static int MYDEBUG = 0; @@ -564,7 +564,8 @@ VISU::MultiResult_i myMultiprObj.create(theFileName); if (myMultiprObj.isValidDistributedMEDFile()) { aTargetFileName = myMultiprObj.getSequentialMEDFilename(); - SetFileName(aFileInfo.filePath().latin1()); + SetInitFileName(aFileInfo.filePath().latin1()); + SetName(VISU::GenerateName(aFileInfo.fileName()).latin1(), false); myIsBuildParts = true; } } @@ -606,7 +607,7 @@ VISU::MultiResult_i } std::string aBase, aSuffix; - SplitName(GetName(), aBase, aSuffix); + SplitName(GetFileName(), aBase, aSuffix); BEGMSG(MYDEBUG, "aBase = '"<(aPathToCopy.c_str()), true); + if(theIsASCII) + HDFascii::ConvertFromHDFToASCII(const_cast(aPathToCopy.c_str()), true); + } theFileNames.push_back(aFileName); theFiles.push_back(aFile); @@ -650,6 +652,18 @@ VISU::MultiResult_i } +//--------------------------------------------------------------- +CORBA::Boolean +VISU::MultiResult_i +::CanCopy(SALOMEDS::SObject_ptr theObject) +{ + if(!myIsPartsDone) + return Result_i::CanCopy(theObject); + + return false; +} + + //--------------------------------------------------------------- void VISU::MultiResult_i @@ -679,7 +693,7 @@ VISU::MultiResult_i { std::string aBase, aSuffix; - SplitName(GetName(), aBase, aSuffix); + SplitName(GetFileName(), aBase, aSuffix); INITMSG(MYDEBUG, "aBase = '"< #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif diff --git a/src/VISU_I/VISU_PrsObject_i.cc b/src/VISU_I/VISU_PrsObject_i.cc index 2ebbadd5..a87ca5e8 100644 --- a/src/VISU_I/VISU_PrsObject_i.cc +++ b/src/VISU_I/VISU_PrsObject_i.cc @@ -68,7 +68,7 @@ VISU::RemovableObject_i //--------------------------------------------------------------- -const std::string& +std::string VISU::RemovableObject_i ::GetName() const { @@ -77,7 +77,7 @@ VISU::RemovableObject_i //--------------------------------------------------------------- -const SALOMEDS::Study_var& +SALOMEDS::Study_var VISU::RemovableObject_i ::GetStudyDocument() const { diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index de524352..3fe23554 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -41,7 +41,7 @@ namespace VISU virtual ~RemovableObject_i(); - const SALOMEDS::Study_var& + SALOMEDS::Study_var GetStudyDocument() const; virtual @@ -49,7 +49,7 @@ namespace VISU GetEntry(); virtual - const std::string& + std::string GetName() const; virtual diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 86be74bb..08b9fab4 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -61,7 +61,7 @@ #include #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif @@ -385,13 +385,13 @@ VISU::Result_i aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s", GetComment(), myFileInfo.filePath().latin1(), - GetFileName().c_str()); // Restoring of Python dump + GetInitFileName().c_str()); // Restoring of Python dump std::string aResultEntry = CreateAttributes(myStudy, aSComponentEntry.in(), NO_ICON, anIOR.in(), - myName, + GetName(), NO_PERFSITENT_REF, aComment.latin1(), true); @@ -499,23 +499,23 @@ VISU::Result_i { try { myFileInfo.setFile(theFileName); - if(!myIsBuildParts) - SetFileName(myFileInfo.filePath().latin1()); - myName = VISU::GenerateName(myFileInfo.fileName()).latin1(); + myFileName = myFileInfo.fileName().latin1(); + + if(!myIsBuildParts){ + SetInitFileName(myFileInfo.filePath().latin1()); + SetName(VISU::GenerateName(myFileInfo.fileName()).latin1(), false); + } + if(mySourceId == eRestoredFile){ - std::string aTmpDir(SALOMEDS_Tool::GetTmpDir()); - static QString aCommand; - aCommand.sprintf(" %s %s", myFileInfo.absFilePath().latin1(), aTmpDir.c_str() ); - aCommand = QDir::convertSeparators( aCommand ); - aCommand.prepend( COPY_COMMAND ); - - if(system(aCommand.latin1()) == -1){ - MESSAGE("Create - Can't execute the command :"<ConvertObjectToIOR(theField); SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR); @@ -616,21 +616,22 @@ VISU::Result_i aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in()); } - std::string aFileName = aPrefix + "_" + GetName(); + std::string aFileName = aPrefix + "_" + GetFileName(); BEGMSG(MYDEBUG, "aFileName = '"<(aPathToCopy.c_str()), true); + if(theIsASCII) + HDFascii::ConvertFromHDFToASCII(const_cast(aPathToCopy.c_str()), true); + } theFileNames.push_back(aFileName); theFiles.push_back(aFile); @@ -718,9 +719,8 @@ VISU::Result_i myIsBuildImmediately = true; try { - myName = VISU::Storable::FindValue(theMap, "myName").latin1(); - VISU::GenerateName(myName); // To register the name in global naming map - SetFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1()); + myFileName = VISU::Storable::FindValue(theMap, "myName").latin1(); + SetInitFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1()); SALOMEDS::SObject_var aRefSObj, aTargetRefSObj; if (theSObject->FindSubObject(1, aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)) { @@ -761,7 +761,7 @@ VISU::Result_i aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in()); } if (!myFileInfo.isFile()) { - string aFileName = thePrefix + aStudyPrefix + "_" + myName; + std::string aFileName = thePrefix + aStudyPrefix + "_" + myFileName; myFileInfo.setFile(aFileName.c_str()); } if(MYDEBUG) @@ -832,7 +832,7 @@ VISU::Result_i aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s", GetComment(), myFileInfo.filePath().latin1(), - GetFileName().c_str()); // Restoring of Python dump + GetInitFileName().c_str()); // Restoring of Python dump SALOMEDS::GenericAttribute_var anAttr; if (!theSObject->FindAttribute(anAttr, "AttributeString")) throw std::runtime_error("Build - There is no AttributeString for the SObject !!!"); @@ -1292,9 +1292,8 @@ void VISU::Result_i ::ToStream(std::ostringstream& theStr) { - if(MYDEBUG) MESSAGE(GetComment()); - Storable::DataToStream(theStr,"myName", myName.c_str()); - Storable::DataToStream(theStr,"myInitFileName", GetFileName().c_str()); + Storable::DataToStream(theStr,"myName", GetFileName().c_str()); + Storable::DataToStream(theStr,"myInitFileName", GetInitFileName().c_str()); Storable::DataToStream(theStr,"myCreationId", myCreationId); Storable::DataToStream(theStr,"myIsBuildFields", myIsFieldsDone); Storable::DataToStream(theStr,"myIsBuildMinMax", myIsMinMaxDone); @@ -1303,9 +1302,9 @@ VISU::Result_i //--------------------------------------------------------------- -const std::string& +std::string VISU::Result_i -::GetFileName() const +::GetInitFileName() const { return myInitFileName; } @@ -1313,29 +1312,32 @@ VISU::Result_i void VISU::Result_i -::SetFileName(const std::string& theFileName) +::SetInitFileName(const std::string& theFileName) { myInitFileName = theFileName; } //--------------------------------------------------------------- -const std::string& +std::string VISU::Result_i -::GetName() const +::GetFileName() const { - return myName; + if(GetSourceId() == eFile) + return QString("%1:%2").arg(myFileName.c_str()).arg(size_t(this)).latin1(); + + return myFileName; } -const QFileInfo& +QFileInfo VISU::Result_i ::GetFileInfo() const { return myFileInfo; } -const VISU::Result_i::ECreationId& +VISU::Result_i::ECreationId VISU::Result_i ::GetCreationId() const { @@ -1343,7 +1345,7 @@ VISU::Result_i } -const VISU::Result_i::ESourceId& +VISU::Result_i::ESourceId VISU::Result_i ::GetSourceId() const { @@ -1360,14 +1362,14 @@ VISU::Result_i return anEntry.in(); } -const SALOMEDS::SObject_var& +SALOMEDS::SObject_var VISU::Result_i ::GetSObject() const { return mySObject; } -const SALOMEDS::Study_var& +SALOMEDS::Study_var VISU::Result_i ::GetStudyDocument() const { @@ -1381,7 +1383,7 @@ VISU::Result_i return myStudy; } -const SALOMEDS::SComponent_var& +SALOMEDS::SComponent_var VISU::Result_i ::GetSComponent() const { diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index b0131f86..17d35e2b 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -194,7 +194,7 @@ namespace VISU ECreationId myCreationId; PInput myInput; - std::string myName; + std::string myFileName; QFileInfo myFileInfo; std::string myInitFileName; @@ -225,7 +225,7 @@ namespace VISU Storable* BuildAll(SALOMEDS::SObject_ptr theSObject) ; - const ESourceId& + ESourceId GetSourceId() const; _PTR(Study) myStudy; @@ -323,20 +323,21 @@ namespace VISU CORBA::Long theTimeStampNumber = -1); virtual - const std::string& - GetFileName() const; + std::string + GetInitFileName() const; virtual void - SetFileName(const std::string& theFileName); + SetInitFileName(const std::string& theFileName); - const std::string& - GetName() const; + virtual + std::string + GetFileName() const; - const QFileInfo& + QFileInfo GetFileInfo() const; - const ECreationId& + ECreationId GetCreationId() const; private: @@ -348,16 +349,16 @@ namespace VISU std::string GetEntry(); - const SALOMEDS::SObject_var& + SALOMEDS::SObject_var GetSObject() const; - const SALOMEDS::Study_var& + SALOMEDS::Study_var GetStudyDocument() const; _PTR(Study) GetStudy() const; - const SALOMEDS::SComponent_var& + SALOMEDS::SComponent_var GetSComponent() const; std::string @@ -381,7 +382,8 @@ namespace VISU }; //! To find Result object as published on father of the given SObject - VISU_I_EXPORT Result_var + VISU_I_EXPORT + Result_var FindResult(SALOMEDS::SObject_ptr theSObject); //! To get VISU::Result object published on the given SALOMEDS::SObject