Salome HOME
Increment version number (2.2.3)
[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 #include <string>
14 #include <list> 
15
16 // IDL headers
17 #include "SALOMEconfig.h"
18 #include CORBA_SERVER_HEADER(SALOMEDS)
19
20 class SALOMEDS_Tool                                
21 {
22
23 public:
24  
25   // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
26   // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
27   static std::string GetTmpDir();
28
29  
30   // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
31   // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
32   static void RemoveTemporaryFiles(const std::string& theDirectory,
33                                    const SALOMEDS::ListOfFileNames& theFiles,
34                                    const bool IsDirDeleted);
35
36   // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
37   static SALOMEDS::TMPFile* PutFilesToStream(const std::string& theFromDirectory, 
38                                              const SALOMEDS::ListOfFileNames& theFiles,
39                                              const int theNamesOnly = 0);
40
41   // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
42   static SALOMEDS::ListOfFileNames_var PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
43                                                         const std::string& theToDirectory,
44                                                         const int theNamesOnly = 0);
45
46   // Returns the name by the path
47   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
48   static std::string GetNameFromPath(const std::string& thePath);
49
50   // Returns the directory by the path
51   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
52   static std::string GetDirFromPath(const std::string& thePath);
53
54   // Retrieves specified flaf from "AttributeFlags" attribute
55   static bool GetFlag( const int             theFlag,
56                        SALOMEDS::Study_var   theStudy,
57                        SALOMEDS::SObject_var theObj );
58
59   // Sets/Unsets specified flaf from "AttributeFlags" attribute
60   static bool SetFlag( const int           theFlag,
61                        SALOMEDS::Study_var theStudy,
62                        const std::string&  theEntry,
63                        const bool          theValue );
64
65   // Get all children of object. If theObj is null all objects of study are returned
66   static void GetAllChildren( SALOMEDS::Study_var               theStudy,
67                               SALOMEDS::SObject_var             theObj,
68                               std::list<SALOMEDS::SObject_var>& theList );
69
70 };
71 #endif
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91