1 // File : SALOMEDS_Tool.hxx
2 // Created : Mon Oct 21 16:24:50 2002
3 // Author : Sergey RUIN
7 // Copyright : Open CASCADE
10 #ifndef __SALOMEDS_Tool_H__
11 #define __SALOMEDS_Tool_H__
16 #include "SALOMEconfig.h"
17 #include CORBA_SERVER_HEADER(SALOMEDS)
24 // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
25 // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
26 static std::string GetTmpDir();
29 // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
30 // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
31 static void RemoveTemporaryFiles(const char* theDirectory,
32 const SALOMEDS::ListOfFileNames& theFiles,
33 const bool IsDirDeleted);
35 // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
36 static SALOMEDS::TMPFile* PutFilesToStream(const char* theFromDirectory,
37 const SALOMEDS::ListOfFileNames& theFiles,
38 const int theNamesOnly = 0);
40 // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
41 static SALOMEDS::ListOfFileNames_var PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
42 const char* theToDirectory,
43 const int theNamesOnly = 0);
45 // Returns the name by the path
46 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
47 static std::string GetNameFromPath(const char* thePath);
49 // Returns the directory by the path
50 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
51 static std::string GetDirFromPath(const char* thePath);