// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SALOMEDSImpl_StudyManager.cxx
// Author : Sergey RUIN
#include "SALOMEDSImpl_StudyManager.hxx"
-using namespace std;
-
#include <CDF_Session.hxx>
#include <CDF_DirectoryIterator.hxx>
#include <TDF_Label.hxx>
#include <iostream>
#include <stdlib.h>
+using namespace std;
+
IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared )
}
catch (HDFexception)
{
-#ifndef WNT
- char eStr[strlen(aUrl.ToCString())+17];
-#else
+//#ifndef WNT
+// char eStr[strlen(aUrl.ToCString())+17];
+//#else
char *eStr;
eStr = new char[strlen(aUrl.ToCString())+17];
-#endif
+//#endif
sprintf(eStr,"Can't open file %s",aUrl.ToCString());
-#ifdef WNT
+//#ifdef WNT
delete [] eStr;
-#endif
+//#endif
_errorCode = TCollection_AsciiString(eStr);
return NULL;
}
}
catch (HDFexception)
{
-#ifndef WNT
- char eStr[strlen(aUrl.ToCString())+17];
-#else
+//#ifndef WNT
+// char eStr[strlen(aUrl.ToCString())+17];
+//#else
char *eStr = new char [strlen(aUrl.ToCString())+17];
-#endif
+//#endif
sprintf(eStr,"Can't open file %s", aUrl.ToCString());
_errorCode = TCollection_AsciiString(eStr);
return NULL;
if (isASCII) {
Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
- aFilesToRemove->Append(aHDFUrl);
+ aFilesToRemove->Append("hdf_from_ascii.hdf");
SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
}
if (Engine != NULL)
{
- unsigned char* aStream;
+ Handle(SALOMEDSImpl_TMPFile) aStream;
long length;
if (theASCII) aStream = Engine->SaveASCII(sco,
HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1);
hdf_dataset->CreateOnDisk();
- hdf_dataset->WriteOnDisk(aStream); //Save the stream in the HDF file
+ hdf_dataset->WriteOnDisk(aStream->Data()); //Save the stream in the HDF file
hdf_dataset->CloseOnDisk();
}
hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor
// Creation of the persistance reference attribute
Translate_IOR_to_persistentID (sco, Engine, theMultiFile, theASCII);
-
- if(aStream != NULL) delete [] aStream;
}
}
hdf_sco_group->CloseOnDisk();
_errorCode = "HDFexception ! ";
return false;
}
+ catch(std::exception& exc)
+ {
+ _errorCode = const_cast<char*>(exc.what());
+ return false;
+ }
+ catch(...)
+ {
+ _errorCode = "Unknown exception ! ";
+ return false;
+ }
if (theASCII) { // save file in ASCII format
HDFascii::ConvertFromHDFToASCII(aUrl.ToCString(), true);
}
Handle(SALOMEDSImpl_SObject) aSO = theSourceStudy->FindObjectID(anEntry.ToCString());
int anObjID;
long aLen;
- unsigned char* aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
+ Handle(SALOMEDSImpl_TMPFile) aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
TCollection_ExtendedString aResStr("");
for(a = 0; a < aLen; a++) {
- aResStr += TCollection_ExtendedString(ToExtCharacter((Standard_Character)aStream[a]));
+ aResStr += TCollection_ExtendedString(ToExtCharacter(Standard_Character(aStream->Get(a))));
}
- if(aStream != NULL) delete [] aStream;
SALOMEDSImpl_AttributeInteger::Set(aAuxTargetLabel, anObjID);
SALOMEDSImpl_AttributeName::Set(aAuxTargetLabel, aResStr);
continue;