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

index 649f51556c4ea488e9497bfe8113c5580f121057..19ca539b1ca7b00de497add3248f0b134a7eaf23 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "KernelBasis.hxx"
 
+#include <sstream>
+
 static bool DEFAULT_SSL_MODE = true;
 static bool GUI_MODE = false;
 
@@ -137,8 +139,39 @@ 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;
 
+/*!
+ * 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 cbecfe72e1940b7e4329e87c913ac70bd3b2fb86..59b18c91c5e28f5804169d8b56703cdc9f021ca6 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 092c7537ff72bcd58b0ab9c7298658fa7ada0aa2..2e6a0f9ce940b52b151119bf76207721e2f626d1 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;
 
@@ -142,6 +143,16 @@ bool BigObjOnDiskDirectoryDefinedSwig()
   return SALOME::BigObjOnDiskDirectoryDefined();
 }
 
+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);