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__
17 #include "SALOMEconfig.h"
18 #include CORBA_SERVER_HEADER(SALOMEDS)
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();
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);
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);
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);
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);
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);
54 // Retrieves specified flaf from "AttributeFlags" attribute
55 static bool GetFlag( const int theFlag,
56 SALOMEDS::Study_var theStudy,
57 SALOMEDS::SObject_var theObj );
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 );
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 );