#include "KernelBasis.hxx"
#include <sstream>
+#include <stdexcept>
static bool DEFAULT_SSL_MODE = true;
static bool GUI_MODE = false;
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;
static int SALOME_NB_RETRY = DFT_SALOME_NB_RETRY;
+SALOME::BigObjTransferProtocol SALOME::FromIntToBigObjOnDiskProtocol(char protocol)
+{
+ switch( protocol )
+ {
+ case SALOME::SHARED_FILE_SYSTEM_PROTOCOL:
+ return SALOME::BigObjTransferProtocol::SharedFileSystem;
+ case SALOME::SSD_COPY_FILE_SYSTEM_PROTOCOL:
+ return SALOME::BigObjTransferProtocol::SSDCopyFileSystem;
+ default:
+ throw std::runtime_error("FromIntToBigObjOnDiskProtocol unrecognized protocol ! should be in [0,1] !");
+ }
+}
+
+SALOME::BigObjTransferProtocol SALOME::BigObjOnDiskProtocolFromStr(const std::string& protocol)
+{
+ if( protocol == SALOME::SHARED_FILE_SYSTEM_PROTOCOL_STR )
+ return SALOME::BigObjTransferProtocol::SharedFileSystem;
+ if( protocol == SALOME::SSD_COPY_FILE_SYSTEM_PROTOCOL_STR )
+ return SALOME::BigObjTransferProtocol::SSDCopyFileSystem;
+ throw std::runtime_error("BigObjOnDiskProtocolFromStr unrecognized protocol !");
+}
+
+std::string SALOME::BigObjOnDiskProtocolToStr(BigObjTransferProtocol protocol)
+{
+ switch( protocol )
+ {
+ case SALOME::BigObjTransferProtocol::SharedFileSystem:
+ return SALOME::SHARED_FILE_SYSTEM_PROTOCOL_STR;
+ case SALOME::BigObjTransferProtocol::SSDCopyFileSystem:
+ return SALOME::SSD_COPY_FILE_SYSTEM_PROTOCOL_STR;
+ default:
+ throw std::runtime_error("FromIntToBigObjOnDiskProtocol unrecognized protocol ! should be in [0,1] !");
+ }
+}
+
/*!
* This method returns the protocol of proxy transfert and the directory
*/
-int SALOME::GetBigObjOnDiskProtocolAndDirectory(std::string& directory)
+SALOME::BigObjTransferProtocol 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 );
+ return SALOME::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 );
+ return SALOME::BigObjTransferProtocol::SharedFileSystem;
}
std::istringstream iss(protocol.substr(1,1)); iss.exceptions(std::istringstream::failbit | std::istringstream::badbit);
char iproxyprot = 0;
iss >> iproxyprot;
- return iproxyprot;
+ return FromIntToBigObjOnDiskProtocol( iproxyprot );
}
std::string SALOME::GetBigObjOnDiskDirectory()
namespace SALOME
{
+ constexpr char SHARED_FILE_SYSTEM_PROTOCOL = 0;
+ constexpr char SSD_COPY_FILE_SYSTEM_PROTOCOL = 1;
+ const char SHARED_FILE_SYSTEM_PROTOCOL_STR[] = "SharedFileSystem";
+ const char SSD_COPY_FILE_SYSTEM_PROTOCOL_STR[] = "SSDCopyFileSystem";
+
enum class PyExecutionMode { NotSet, InProcess, OutOfProcessNoReplay, OutOfProcessWithReplay, OutOfProcessNoReplayFT, OutOfProcessWithReplayFT };
+
+ enum class BigObjTransferProtocol : char
+ { SharedFileSystem = SHARED_FILE_SYSTEM_PROTOCOL, SSDCopyFileSystem = SSD_COPY_FILE_SYSTEM_PROTOCOL };
+
void BASICS_EXPORT SetPyExecutionMode(PyExecutionMode mode);
void BASICS_EXPORT SetPyExecutionModeStr(const std::string& mode);
std::vector<std::string> BASICS_EXPORT GetAllPyExecutionModes();
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 BigObjOnDiskProtocolToStr(BigObjTransferProtocol protocol);
+ BigObjTransferProtocol BASICS_EXPORT BigObjOnDiskProtocolFromStr(const std::string& protocol);
+ BigObjTransferProtocol BASICS_EXPORT FromIntToBigObjOnDiskProtocol(char protocol);
+ BigObjTransferProtocol BASICS_EXPORT GetBigObjOnDiskProtocolAndDirectory(std::string& directory);
std::string BASICS_EXPORT GetBigObjOnDiskDirectory();
void BASICS_EXPORT SetBigObjOnDiskDirectory(const std::string& directory);
bool BASICS_EXPORT BigObjOnDiskDirectoryDefined();
%rename (SetBigObjOnDiskThreshold) SetBigObjOnDiskThresholdSwig;
%rename (GetBigObjOnDiskDirectory) GetBigObjOnDiskDirectorySwig;
%rename (GetBigObjOnDiskProtocolAndDirectory) GetBigObjOnDiskProtocolAndDirectorySwig;
+%rename (BigObjOnDiskProtocolFromStr) BigObjOnDiskProtocolFromStrSwig;
+%rename (BigObjOnDiskProtocolToStr) BigObjOnDiskProtocolToStrSwig;
%rename (SetBigObjOnDiskDirectory) SetBigObjOnDiskDirectorySwig;
%rename (BigObjOnDiskDirectoryDefined) BigObjOnDiskDirectoryDefinedSwig;
%rename (SetNumberOfRetry) SetNumberOfRetrySwig;
return SALOME::GetNumberOfRetry( );
}
+std::string BigObjOnDiskProtocolToStrSwig( int protocol )
+{
+ return SALOME::BigObjOnDiskProtocolToStr( SALOME::FromIntToBigObjOnDiskProtocol( protocol ) );
+}
+
+int BigObjOnDiskProtocolFromStrSwig(const std::string& protocol)
+{
+ return static_cast<char>( SALOME::BigObjOnDiskProtocolFromStr( protocol ) );
+}
+
PyObject *GetBigObjOnDiskProtocolAndDirectorySwig()
{
std::string directory;
- int ret0 = SALOME::GetBigObjOnDiskProtocolAndDirectory(directory);
+ SALOME::BigObjTransferProtocol ret0 = SALOME::GetBigObjOnDiskProtocolAndDirectory(directory);
PyObject *ret(PyTuple_New(2));
- PyTuple_SetItem(ret,0,PyInt_FromLong(ret0));
+ PyTuple_SetItem(ret,0,PyInt_FromLong(static_cast<char>( ret0 ) ));
PyTuple_SetItem(ret,1,PyUnicode_FromString(directory.c_str()));
return ret;
}