]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF30057] : WIP
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 30 May 2024 07:29:57 +0000 (09:29 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 17 Jun 2024 06:58:52 +0000 (08:58 +0200)
src/Basics/KernelBasis.cxx
src/Basics/KernelBasis.hxx
src/Basics/KernelBasis.i

index c236f00206bd1da8866d2dce09878906b761435d..c49036e7f96242d29514199ef9f340d6ca941a96 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "KernelBasis.hxx"
 
+#include <sstream>
+
 static bool DEFAULT_SSL_MODE = true;
 static bool GUI_MODE = false;
 
@@ -153,12 +155,43 @@ void SALOME::SetBigObjOnDiskThreshold(int newThresholdInByte)
   SALOME_BIG_OBJ_ON_DISK_THRES = newThresholdInByte;
 }
 
+enum class BigObjTransferProtocol : char
+{
+  SharedFileSystem = 0,
+  SSDCopyFileSystem = 1
+};
+
+constexpr char SALOME_FILE_BIG_OBJ_DIR_SEP = '@';
+
 static std::string SALOME_FILE_BIG_OBJ_DIR;
 
 constexpr int DFT_SALOME_NB_RETRY = 1;
 
 static int SALOME_NB_RETRY = DFT_SALOME_NB_RETRY;
 
+/*!
+ * This method returns the protocol of proxy transfert and the directory
+ */
+int SALOME::GetBigObjOnDiskProtocolAndDirectory(std::string& directory)
+{
+  if(SALOME_FILE_BIG_OBJ_DIR.size() < 3)
+  {
+    directory = SALOME_FILE_BIG_OBJ_DIR;
+    return static_cast<char>( BigObjTransferProtocol::SharedFileSystem );
+  }
+  std::string protocol = SALOME_FILE_BIG_OBJ_DIR.substr(0,3);
+  directory = SALOME_FILE_BIG_OBJ_DIR.substr(3);
+  if( protocol[0]!=SALOME_FILE_BIG_OBJ_DIR_SEP || protocol[2]!=SALOME_FILE_BIG_OBJ_DIR_SEP)
+  {
+    directory = SALOME_FILE_BIG_OBJ_DIR;
+    return static_cast<char>( BigObjTransferProtocol::SharedFileSystem );
+  }
+  std::istringstream iss(protocol.substr(1,1)); iss.exceptions(std::istringstream::failbit | std::istringstream::badbit);
+  char iproxyprot = 0;
+  iss >> iproxyprot;
+  return iproxyprot;
+}
+
 std::string SALOME::GetBigObjOnDiskDirectory()
 {
   return SALOME_FILE_BIG_OBJ_DIR;
index d2a7bb222030a0fc634afe81cc95c05df27e7f17..d40a422b8093de5a730752dd7de3a0208ba2c26a 100644 (file)
@@ -45,6 +45,7 @@ namespace SALOME
   PyExecutionMode BASICS_EXPORT GetPyExecutionMode();
   int BASICS_EXPORT GetBigObjOnDiskThreshold();
   void BASICS_EXPORT SetBigObjOnDiskThreshold(int newThresholdInByte);
+  int BASICS_EXPORT GetBigObjOnDiskProtocolAndDirectory(std::string& directory);
   std::string BASICS_EXPORT GetBigObjOnDiskDirectory();
   void BASICS_EXPORT SetBigObjOnDiskDirectory(const std::string& directory);
   bool BASICS_EXPORT BigObjOnDiskDirectoryDefined();
index 6c5e8536f6e805312a21cd9e217d0f28c90665dd..70920c990715f4f7340a0453c68e1a58e8231d7c 100644 (file)
@@ -54,6 +54,7 @@ using namespace SALOME;
 %rename (GetBigObjOnDiskThreshold) GetBigObjOnDiskThresholdSwig;
 %rename (SetBigObjOnDiskThreshold) SetBigObjOnDiskThresholdSwig;
 %rename (GetBigObjOnDiskDirectory) GetBigObjOnDiskDirectorySwig;
+%rename (GetBigObjOnDiskProtocolAndDirectory) GetBigObjOnDiskProtocolAndDirectorySwig;
 %rename (SetBigObjOnDiskDirectory) SetBigObjOnDiskDirectorySwig;
 %rename (BigObjOnDiskDirectoryDefined) BigObjOnDiskDirectoryDefinedSwig;
 %rename (SetNumberOfRetry) SetNumberOfRetrySwig;
@@ -154,6 +155,16 @@ int GetNumberOfRetrySwig()
   return SALOME::GetNumberOfRetry( );
 }
 
+PyObject *GetBigObjOnDiskProtocolAndDirectorySwig()
+{
+  std::string directory;
+  int ret0 = SALOME::GetBigObjOnDiskProtocolAndDirectory(directory);
+  PyObject *ret(PyTuple_New(2));
+  PyTuple_SetItem(ret,0,PyInt_FromLong(ret0));
+  PyTuple_SetItem(ret,1,PyUnicode_FromString(directory.c_str()));
+  return ret;
+}
+
 void SetVerbosityLevelSwig(const std::string& level)
 {
   SetVerbosityLevelStr(level);
@@ -184,4 +195,4 @@ std::vector<std::string> GetAllPyExecutionModesSwig()
 def ReadFloatsInFile( fileName ):
   ret = ReadFloatsInFileSwig( fileName )
   return ret
-%}
\ No newline at end of file
+%}