return self._ComponentDataType
def Save(self, theComponent, theURL, isMultiFile):
- return NULL
+ return ""
def SaveASCII(self, theComponent, theURL, isMultiFile):
return self.Save(theComponent, theURL, isMultiFile)
return 1
def PublishInStudy(self, theStudy, theSObject, theObject, theName):
- return NULL
+ return None
def CanCopy(self, theObject):
return 0
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;
}
//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);
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();
//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();
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);