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__
18 #include "SALOMEconfig.h"
19 #include CORBA_SERVER_HEADER(SALOMEDS)
22 #include <SALOME_WNT.hxx>
24 #define SALOME_WNT_EXPORT
27 class SALOME_WNT_EXPORT SALOMEDS_Tool
32 // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
33 // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
34 static std::string GetTmpDir();
37 // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
38 // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
39 static void RemoveTemporaryFiles(const std::string& theDirectory,
40 const SALOMEDS::ListOfFileNames& theFiles,
41 const bool IsDirDeleted);
43 // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
44 static SALOMEDS::TMPFile* PutFilesToStream(const std::string& theFromDirectory,
45 const SALOMEDS::ListOfFileNames& theFiles,
46 const int theNamesOnly = 0);
48 // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
49 static SALOMEDS::ListOfFileNames_var PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
50 const std::string& theToDirectory,
51 const int theNamesOnly = 0);
53 // Returns the name by the path
54 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
55 static std::string GetNameFromPath(const std::string& thePath);
57 // Returns the directory by the path
58 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
59 static std::string GetDirFromPath(const std::string& thePath);
61 // Retrieves specified flaf from "AttributeFlags" attribute
62 static bool GetFlag( const int theFlag,
63 SALOMEDS::Study_var theStudy,
64 SALOMEDS::SObject_var theObj );
66 // Sets/Unsets specified flaf from "AttributeFlags" attribute
67 static bool SetFlag( const int theFlag,
68 SALOMEDS::Study_var theStudy,
69 const std::string& theEntry,
70 const bool theValue );
72 // Get all children of object. If theObj is null all objects of study are returned
73 static void GetAllChildren( SALOMEDS::Study_var theStudy,
74 SALOMEDS::SObject_var theObj,
75 std::list<SALOMEDS::SObject_var>& theList );