Salome HOME
PR: new python function getShortHostName() in Utils_Identity.py, based on socket...
[modules/yacs.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 #include <string> 
14
15 // IDL headers
16 #include "SALOMEconfig.h"
17 #include CORBA_SERVER_HEADER(SALOMEDS)
18
19 class SALOMEDS_Tool                                
20 {
21
22 public:
23  
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();
27
28  
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);
34
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);
39
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);
44
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);
48
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);
52
53 };
54 #endif