]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Join modifications from V3_2_0_maintainance (V3_2_6pre4 - T32x_16Aug2007_16h00m) Start_MERGE_MULTIPR_EVOLUTION
authorjfa <jfa@opencascade.com>
Fri, 17 Aug 2007 08:25:09 +0000 (08:25 +0000)
committerjfa <jfa@opencascade.com>
Fri, 17 Aug 2007 08:25:09 +0000 (08:25 +0000)
src/SALOMEDS/SALOME_DriverPy.py
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx

index 8346a3979024a118afa4990b19e8a80e4188e646..9e8f5264ae8fc65ff3ad1c1ff6bf8c0cf5a92be3 100644 (file)
@@ -38,7 +38,7 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
         return self._ComponentDataType
 
     def Save(self, theComponent, theURL, isMultiFile):
-        return NULL
+        return ""
 
     def SaveASCII(self, theComponent, theURL, isMultiFile):
         return self.Save(theComponent, theURL, isMultiFile)
@@ -56,7 +56,7 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
         return 1
 
     def PublishInStudy(self, theStudy, theSObject, theObject, theName):
-        return NULL
+        return None
 
     def CanCopy(self, theObject):
         return 0
index 7c9225a3f6cbff61b171885ffa873c675eb06c67..518929b81ea93ab164c8bc2035127e10bc710060 100644 (file)
@@ -343,18 +343,20 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const
 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR)
 {
   _errorCode = "";
-  
+
   Handle(SALOMEDSImpl_SObject) aResult = NULL;
-  
+
   // searching in the datamap for optimization
   if (myIORLabels.IsBound(anObjectIOR)) {
     aResult = GetSObject(myIORLabels.Find(anObjectIOR));
     // 11 oct 2002: forbidden attributes must be checked here
-    if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID()))
+    if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) {
       myIORLabels.UnBind(anObjectIOR);
+      aResult = NULL;
+    }
   }
-  
-  if(aResult.IsNull()) _errorCode = "No object was found";
+
+  if (aResult.IsNull()) _errorCode = "No object was found";
   return aResult;
 }
 
index 423052a77c249595e105d7fd71e94e79ae84b9cc..9b06d1d0fed08e65934ffc77c2befc9b5e4f80c4 100644 (file)
@@ -335,8 +335,8 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
     //Open the Study HDF file 
     HDFfile *hdf_file = new HDFfile(aHDFUrl.ToCString()); 
 
-    char aMultifileState[2];
-    char ASCIIfileState[2];
+    char aMultifileState[2] = "S"; // default: single
+    char ASCIIfileState[2] = "B"; // default: binary
     try {
       TCollection_AsciiString scoid = anSCO->GetID();
       hdf_file->OpenOnDisk(HDF_RDONLY);
@@ -357,16 +357,27 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
        hdf_dataset->ReadFromDisk(aStreamFile);
        hdf_dataset->CloseOnDisk();
        hdf_dataset = 0;
-      } else
+      }
+      else
         aStreamFile = NULL;
 
-      HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
-      multifile_hdf_dataset->OpenOnDisk();
-      multifile_hdf_dataset->ReadFromDisk(aMultifileState);
+      if (hdf_sco_group->ExistInternalObject("MULTIFILE_STATE")) {
+        HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
+        multifile_hdf_dataset->OpenOnDisk();
+        multifile_hdf_dataset->ReadFromDisk(aMultifileState);
+
+        multifile_hdf_dataset->CloseOnDisk();
+        multifile_hdf_dataset = 0;
+      }
 
-      HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
-      ascii_hdf_dataset->OpenOnDisk();
-      ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
+      if (hdf_sco_group->ExistInternalObject("ASCII_STATE")) {
+        HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
+        ascii_hdf_dataset->OpenOnDisk();
+        ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
+
+        ascii_hdf_dataset->CloseOnDisk();
+        ascii_hdf_dataset = 0;
+      }
 
       // set path without file name from URL 
       //int aFileNameSize = Res.Length();
@@ -395,11 +406,6 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
 
       //if(aDir != NULL) delete []aDir;
 
-      multifile_hdf_dataset->CloseOnDisk();
-      multifile_hdf_dataset = 0;
-      ascii_hdf_dataset->CloseOnDisk();
-      ascii_hdf_dataset = 0;
-
       hdf_sco_group->CloseOnDisk();
       hdf_sco_group = 0;
       hdf_group->CloseOnDisk();
@@ -420,7 +426,8 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)&
       if (isASCII) {
        Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
        aFilesToRemove->Append(aHDFUrl);
-       SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+        SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl),
+                                                aFilesToRemove, true);
       }
 
       if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);