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