Salome HOME
sources v1.2
[modules/kernel.git] / src / TOOLSDS / SALOMEDS_Tool.hxx
1 //  File      : SALOMEDS_Tool.hxx
2 //  Created   : Mon Oct 21 16:24:50 2002
3 //  Author    : Sergey RUIN
4
5 //  Project   : SALOME
6 //  Module    : SALOMEDS
7 //  Copyright : Open CASCADE
8
9
10 #ifndef __SALOMEDS_Tool_H__
11 #define __SALOMEDS_Tool_H__
12
13
14
15 // IDL headers
16 #include <SALOMEDS.hh> 
17
18 class SALOMEDS_Tool                                
19 {
20 public:
21  
22   // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
23   // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
24   static char* GetTmpDir();
25
26  
27   // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
28   // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
29   static void RemoveTemporaryFiles(const char* theDirectory,
30                                    const SALOMEDS::ListOfFileNames& theFiles,
31                                    const bool IsDirDeleted);
32
33   // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
34   static SALOMEDS::TMPFile* PutFilesToStream(const char* theFromDirectory, 
35                                              const SALOMEDS::ListOfFileNames& theFiles,
36                                              const int theNamesOnly = 0);
37
38   // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
39   static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
40                                                      const char* theToDirectory,
41                                                      const int theNamesOnly = 0);
42
43   // Returns the name by the path
44   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
45   static char* GetNameFromPath(const char* thePath);
46
47   // Returns the directory by the path
48   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
49   static char* GetDirFromPath(const char* thePath);
50
51 };
52 #endif