-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// 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/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SALOMEDSImpl_StudyManager.cxx
if (HDFascii::isASCII(aUrl.c_str())) {
isASCII = true;
char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str());
+ if ( !aResultPath )
+ return NULL;
aC_HDFUrl = new char[strlen(aResultPath) + 19];
sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath);
delete [] (aResultPath);
hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too
}
catch (HDFexception)
- {
- char *eStr;
- eStr = new char[strlen(aUrl.c_str())+17];
- sprintf(eStr,"Can't open file %s",aUrl.c_str());
- delete [] eStr;
- _errorCode = std::string(eStr);
- return NULL;
- }
-
+ {
+ char *eStr;
+ eStr = new char[strlen(aUrl.c_str())+17];
+ sprintf(eStr,"Can't open file %s",aUrl.c_str());
+ delete [] eStr;
+ _errorCode = std::string(eStr);
+ return NULL;
+ }
+
// Temporary aStudyUrl in place of study name
DF_Document* Doc = _appli->NewDocument("SALOME_STUDY");
BuildTree (Study, hdf_group_study_structure);
}
catch (HDFexception)
- {
- char *eStr = new char [strlen(aUrl.c_str())+17];
- sprintf(eStr,"Can't open file %s", aUrl.c_str());
- _errorCode = std::string(eStr);
- return NULL;
- }
-
+ {
+ char *eStr = new char [strlen(aUrl.c_str())+17];
+ sprintf(eStr,"Can't open file %s", aUrl.c_str());
+ _errorCode = std::string(eStr);
+ return NULL;
+ }
+
//Read and create notebook variables
if(hdf_file->ExistInternalObject("NOTEBOOK_VARIABLES")) {
hdf_notebook_vars = new HDFgroup("NOTEBOOK_VARIABLES",hdf_file);
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- int aLength = 0, anIndex, i;
+ std::string units = aProp->GetUnits();
+ std::string comment = aProp->GetComment();
+
+ int aLength = 0, anIndex, i, unitsSize = 0, commentSize = 0;
for(i=1; i<=aNames.size(); i++)
aLength += aNames[i-1].size() + 1;
-
- //string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, "zero" byte
- char* aProperty = new char[3 + aLength + 12 * aNames.size()];
+
+ unitsSize = units.size();
+ commentSize = comment.size();
+
+ //string format:
+ //locked flag, modified flag,
+ //minutes, hours, day, months, year, user name, char(1),
+ //minutes, hours, day, months, year, user name, char(1),
+ //.....................................................,
+ //.....................................................,
+ //.....................................................,
+ //minutes, hours, day, months, year, user name, char(1), char(30) <- !!!! used to define end of section with modifications !!!!
+ //units, char(1), comment, char(0)
+
+ //string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, 1 byte (char(30) section delimeter)
+ // unit length + 1, comment length, "zero" byte
+
+ char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize ];
sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u');
a = strlen(aProperty);
aProperty[a++] = 1;
}
- aProperty[a] = 0;
+ //Write delimeter of the section to define end of the modifications section
+ aProperty[a++] = 30;
+
+ //Write units if need
+ if(units.size() > 0) {
+ sprintf(&(aProperty[a]),"%s",units.c_str());
+ a = strlen(aProperty);
+ }
+
+ aProperty[a++] = 1;
+
+ //Write comments if need
+ if(comment.size() > 0) {
+ sprintf(&(aProperty[a]),"%s",comment.c_str());
+ a = strlen(aProperty);
+ a++;
+ }
+
+ aProperty[a] = 0;
+
name_len = (hdf_int32) a;
size[0] = name_len + 1 ;
hdf_dataset = new HDFdataset("AttributeStudyProperties",hdf_group,HDF_STRING,size,1);
hdf_dataset->CloseOnDisk();
hdf_dataset=0; //will be deleted by hdf_sco_group destructor
delete [] aProperty;
-
+
aProp->SetModified(0);
return true;
}
system(aCmd.c_str());
// Iterate and move files in the temporary directory
- FILE* fp = fopen(aTmpFile.c_str(), "r");
+ FILE* fp = fopen(aTmpFile.c_str(), "rb");
if(!fp) return false;
char* buffer = new char[2047];
while(!feof(fp)) {
aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag());
aAuxSourceLabel = aAuxSourceLabel.FindChild(aSourceLabel.Tag());
}
+ SALOMEDSImpl_SObject so = theDestinationStudy->GetSObject(aTargetLabel);
+ theDestinationStudy->addSO_Notification(so);
}
// check auxiliary label for TMPFile => IOR