From: Anthony Geay Date: Thu, 30 May 2024 07:29:57 +0000 (+0200) Subject: [EDF30057] : WIP X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=39d2fb5041cf5ec3bdd163b63fc12ea00883533c;p=modules%2Fkernel.git [EDF30057] : WIP --- diff --git a/src/Basics/KernelBasis.cxx b/src/Basics/KernelBasis.cxx index 649f51556..19ca539b1 100644 --- a/src/Basics/KernelBasis.cxx +++ b/src/Basics/KernelBasis.cxx @@ -19,6 +19,8 @@ #include "KernelBasis.hxx" +#include + 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( 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( 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; diff --git a/src/Basics/KernelBasis.hxx b/src/Basics/KernelBasis.hxx index cbecfe72e..59b18c91c 100644 --- a/src/Basics/KernelBasis.hxx +++ b/src/Basics/KernelBasis.hxx @@ -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(); diff --git a/src/Basics/KernelBasis.i b/src/Basics/KernelBasis.i index 092c7537f..2e6a0f9ce 100644 --- a/src/Basics/KernelBasis.i +++ b/src/Basics/KernelBasis.i @@ -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);