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