Salome HOME
projects
/
modules
/
kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SALOMEDS changes:
[modules/kernel.git]
/
src
/
TOOLSDS
/
SALOMEDS_Tool.cxx
diff --git
a/src/TOOLSDS/SALOMEDS_Tool.cxx
b/src/TOOLSDS/SALOMEDS_Tool.cxx
index f8d0870ea3bedc587fe3dd22394747bce3a12e6b..6c09e96b4aa6f41826505460c5867d72b3284cf1 100644
(file)
--- a/
src/TOOLSDS/SALOMEDS_Tool.cxx
+++ b/
src/TOOLSDS/SALOMEDS_Tool.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
6
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
@@
-44,7
+44,6
@@
#include <iostream>
#include <fstream>
#include <iostream>
#include <fstream>
-#include <stdlib.h>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
@@
-132,12
+131,12
@@
std::string SALOMEDS_Tool::GetTmpDir()
// purpose : Removes files listed in theFileList
//============================================================================
void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory,
// purpose : Removes files listed in theFileList
//============================================================================
void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory,
- const
SALOMEDS::ListOfFileNam
es& theFiles,
+ const
ListOfFil
es& theFiles,
const bool IsDirDeleted)
{
std::string aDirName = theDirectory;
const bool IsDirDeleted)
{
std::string aDirName = theDirectory;
- int i, aLength = theFiles.
length
();
+ int i, aLength = theFiles.
size
();
for(i=1; i<=aLength; i++) {
std::string aFile(aDirName);
aFile += theFiles[i-1];
for(i=1; i<=aLength; i++) {
std::string aFile(aDirName);
aFile += theFiles[i-1];
@@
-170,11
+169,11
@@
namespace
{
SALOMEDS::TMPFile*
PutFilesToStream(const std::string& theFromDirectory,
{
SALOMEDS::TMPFile*
PutFilesToStream(const std::string& theFromDirectory,
- const
SALOMEDS::ListOfFileNames
& theFiles,
- const
SALOMEDS::ListOfFileNames
& theFileNames,
+ const
std::vector<std::string>
& theFiles,
+ const
std::vector<std::string>
& theFileNames,
const int theNamesOnly)
{
const int theNamesOnly)
{
- int i, aLength = theFiles.
length
();
+ int i, aLength = theFiles.
size
();
if(aLength == 0)
return (new SALOMEDS::TMPFile);
if(aLength == 0)
return (new SALOMEDS::TMPFile);
@@
-195,7
+194,7
@@
namespace
//Check if the file exists
if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
//Check if the file exists
if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
- std::string aFullPath = aTmpDir +
const_cast<char*>(theFiles[i].in());
+ std::string aFullPath = aTmpDir +
theFiles[i];
if(!Exists(aFullPath)) continue;
#ifdef WIN32
std::ifstream aFile(aFullPath.c_str(), std::ios::binary);
if(!Exists(aFullPath)) continue;
#ifdef WIN32
std::ifstream aFile(aFullPath.c_str(), std::ios::binary);
@@
-206,7
+205,7
@@
namespace
aFileSize[i] = aFile.tellg();
aBufferSize += aFileSize[i]; //Add a space to store the file
}
aFileSize[i] = aFile.tellg();
aBufferSize += aFileSize[i]; //Add a space to store the file
}
- aFileNameSize[i] =
strlen(theFileNames[i]
)+1;
+ aFileNameSize[i] =
theFileNames[i].length(
)+1;
aBufferSize += aFileNameSize[i]; //Add a space to store the file name
aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name,
// 8 bytes: length of the file itself
aBufferSize += aFileNameSize[i]; //Add a space to store the file name
aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name,
// 8 bytes: length of the file itself
@@
-230,7
+229,7
@@
namespace
for(i=0; i<aLength; i++) {
std::ifstream *aFile;
if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
for(i=0; i<aLength; i++) {
std::ifstream *aFile;
if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
- std::string aFullPath = aTmpDir +
const_cast<char*>(theFiles[i].in())
;
+ std::string aFullPath = aTmpDir +
theFiles[i]
;
if(!Exists(aFullPath)) continue;
#ifdef WIN32
aFile = new std::ifstream(aFullPath.c_str(), std::ios::binary);
if(!Exists(aFullPath)) continue;
#ifdef WIN32
aFile = new std::ifstream(aFullPath.c_str(), std::ios::binary);
@@
-245,7
+244,7
@@
namespace
aCurrentPos += 4;
//Copy the file name to the buffer
aCurrentPos += 4;
//Copy the file name to the buffer
- memcpy((aBuffer + aCurrentPos), theFileNames[i], aFileNameSize[i]);
+ memcpy((aBuffer + aCurrentPos), theFileNames[i]
.c_str()
, aFileNameSize[i]);
aCurrentPos += aFileNameSize[i];
if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
aCurrentPos += aFileNameSize[i];
if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
@@
-277,17
+276,17
@@
namespace
SALOMEDS::TMPFile*
SALOMEDS_Tool::PutFilesToStream(const std::string& theFromDirectory,
SALOMEDS::TMPFile*
SALOMEDS_Tool::PutFilesToStream(const std::string& theFromDirectory,
- const
SALOMEDS::ListOfFileNam
es& theFiles,
+ const
ListOfFil
es& theFiles,
const int theNamesOnly)
{
const int theNamesOnly)
{
-
SALOMEDS::ListOfFileNam
es aFileNames(theFiles);
+
ListOfFil
es aFileNames(theFiles);
return ::PutFilesToStream(theFromDirectory,theFiles,aFileNames,theNamesOnly);
}
SALOMEDS::TMPFile*
return ::PutFilesToStream(theFromDirectory,theFiles,aFileNames,theNamesOnly);
}
SALOMEDS::TMPFile*
-SALOMEDS_Tool::PutFilesToStream(const
SALOMEDS::ListOfFileNam
es& theFiles,
- const
SALOMEDS::ListOfFileNam
es& theFileNames)
+SALOMEDS_Tool::PutFilesToStream(const
ListOfFil
es& theFiles,
+ const
ListOfFil
es& theFileNames)
{
return ::PutFilesToStream("",theFiles,theFileNames,0);
}
{
return ::PutFilesToStream("",theFiles,theFileNames,0);
}
@@
-296,12
+295,12
@@
SALOMEDS_Tool::PutFilesToStream(const SALOMEDS::ListOfFileNames& theFiles,
// function : PutStreamToFile
// purpose : converts the stream "theStream" to the files
//============================================================================
// function : PutStreamToFile
// purpose : converts the stream "theStream" to the files
//============================================================================
-SALOMEDS
::ListOfFileNames_var
+SALOMEDS
_Tool::ListOfFiles
SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
const std::string& theToDirectory,
const int theNamesOnly)
{
SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
const std::string& theToDirectory,
const int theNamesOnly)
{
-
SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNam
es;
+
ListOfFiles aFil
es;
if(theStream.length() == 0)
return aFiles;
if(theStream.length() == 0)
return aFiles;
@@
-320,7
+319,7
@@
SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
//Copy the number of files in the stream
memcpy(&aNbFiles, aBuffer, sizeof(int));
//Copy the number of files in the stream
memcpy(&aNbFiles, aBuffer, sizeof(int));
- aFiles
->length
(aNbFiles);
+ aFiles
.reserve
(aNbFiles);
for(i=0; i<aNbFiles; i++) {
for(i=0; i<aNbFiles; i++) {
@@
-355,7
+354,7
@@
SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
aFile.close();
aCurrentPos += aFileSize;
}
aFile.close();
aCurrentPos += aFileSize;
}
- aFiles
[i] = CORBA::string_dup(aFileName
);
+ aFiles
.push_back(CORBA::string_dup(aFileName)
);
delete[] aFileName;
}
delete[] aFileName;
}
@@
-515,4
+514,3
@@
void SALOMEDS_Tool::GetAllChildren( SALOMEDS::Study_var theStudy,
}
}
-