]> SALOME platform Git repositories - modules/kernel.git/blob - src/Basics/KernelBasis.i
Salome HOME
[EDF30399] : Steer directory hosting replay files
[modules/kernel.git] / src / Basics / KernelBasis.i
1 // Copyright (C) 2021-2024  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 %module KernelBasis
21
22 %{
23 #include "KernelBasis.hxx"
24 #include "HeatMarcel.hxx"
25 #include "libSALOMELog.hxx"
26 #include "Monitoring.hxx"
27 using namespace SALOME;
28 %}
29
30 %include std_string.i
31 %include std_set.i
32 %include std_except.i
33 %include std_vector.i
34
35 %template(dvec) std::vector<double>;
36 %template(strvec) std::vector<std::string>;
37
38 %exception {
39    try 
40    {
41       $action
42    } 
43    catch(std::exception& e) 
44    {
45       SWIG_exception(SWIG_SystemError, e.what() );
46    } 
47    catch(...) 
48    {
49      SWIG_exception(SWIG_UnknownError, "Unknown exception");
50    }
51 }
52
53 %rename (HeatMarcel) HeatMarcelSwig;
54 %rename (GetBigObjOnDiskThreshold) GetBigObjOnDiskThresholdSwig;
55 %rename (SetBigObjOnDiskThreshold) SetBigObjOnDiskThresholdSwig;
56 %rename (GetBigObjOnDiskProtocolAndDirectory) GetBigObjOnDiskProtocolAndDirectorySwig;
57 %rename (BigObjOnDiskProtocolFromStr) BigObjOnDiskProtocolFromStrSwig;
58 %rename (BigObjOnDiskProtocolToStr) BigObjOnDiskProtocolToStrSwig;
59 %rename (SetBigObjOnDiskDirectory) SetBigObjOnDiskDirectorySwig;
60 %rename (BigObjOnDiskDirectoryDefined) BigObjOnDiskDirectoryDefinedSwig;
61 %rename (GetDirectoryForReplayFiles) GetDirectoryForReplayFilesSwig;
62 %rename (SetDirectoryForReplayFiles) SetDirectoryForReplayFilesSwig;
63 %rename (SetNumberOfRetry) SetNumberOfRetrySwig;
64 %rename (GetNumberOfRetry) GetNumberOfRetrySwig;
65
66 bool getSSLMode();
67 void setSSLMode(bool sslMode);
68
69 bool getGUIMode();
70 void setGUIMode(bool guiMode);
71
72 std::string getIOROfEmbeddedNS();
73 void setIOROfEmbeddedNS(const std::string& ior);
74
75 double GetTimeAdjustmentCst();
76
77 long LaunchMonitoring(const std::string& pyScriptToEvaluate);
78
79 void StopMonitoring(long pid);
80
81 bool VerbosityActivated();
82
83 void SetVerbosityActivated(bool flag);
84
85 bool IsDebugLevel();
86
87 bool IsInfoLevel();
88
89 bool IsWarningLevel();
90
91 bool IsErrorLevel();
92
93 void WriteInStdout(const std::string& msg);
94
95 void WriteInStderr(const std::string& msg);
96
97 %rename (SetVerbosityLevel) SetVerbosityLevelSwig;
98 %rename (VerbosityLevel) VerbosityLevelSwig;
99 %rename (SetPyExecutionMode) SetPyExecutionModeStrSwig;
100 %rename (GetPyExecutionMode) GetPyExecutionModeStrSwig;
101 %rename (GetAllPyExecutionModes) GetAllPyExecutionModesSwig;
102
103 %inline
104 {
105 PyObject *HeatMarcelSwig(double timeAjustment, unsigned int nbThreads = 0)
106 {
107   double timeInS = 0.0;
108   long double piVal = HeatMarcel(timeAjustment,timeInS,nbThreads);
109   PyObject *ret(PyTuple_New(2));
110   PyTuple_SetItem(ret,0,SWIG_From_double((double)piVal));
111   PyTuple_SetItem(ret,1,SWIG_From_double(timeInS));
112   return ret;
113 }
114
115 std::vector<double> ReadFloatsInFileSwig(const std::string& fileName)
116 {
117   std::vector<double> ret;
118   try
119   {
120     ret = SALOME::ReadFloatsInFile( fileName );
121   }
122   catch(std::exception& e) { }
123   return ret;
124 }
125
126 int GetBigObjOnDiskThresholdSwig()
127 {
128   return SALOME::GetBigObjOnDiskThreshold();
129 }
130
131 void SetBigObjOnDiskThresholdSwig(int newThreshold)
132 {
133   return SALOME::SetBigObjOnDiskThreshold(newThreshold);
134 }
135
136 void SetBigObjOnDiskDirectorySwig(const std::string& directory)
137 {
138   return SALOME::SetBigObjOnDiskDirectory(directory);
139 }
140
141 bool BigObjOnDiskDirectoryDefinedSwig()
142 {
143   return SALOME::BigObjOnDiskDirectoryDefined();
144 }
145
146 void SetNumberOfRetrySwig(int nbRetry)
147 {
148   SALOME::SetNumberOfRetry( nbRetry );
149 }
150
151 int GetNumberOfRetrySwig()
152 {
153   return SALOME::GetNumberOfRetry( );
154 }
155
156 std::string GetDirectoryForReplayFilesSwig()
157 {
158   return SALOME::GetDirectoryForReplayFiles();
159 }
160
161 void SetDirectoryForReplayFilesSwig(const std::string& directory)
162 {
163   SALOME::SetDirectoryForReplayFiles(directory);
164 }
165
166 std::string BigObjOnDiskProtocolToStrSwig( int protocol )
167 {
168   return SALOME::BigObjOnDiskProtocolToStr( SALOME::FromIntToBigObjOnDiskProtocol( protocol ) );
169 }
170
171 int BigObjOnDiskProtocolFromStrSwig(const std::string& protocol)
172 {
173   return static_cast<char>( SALOME::BigObjOnDiskProtocolFromStr( protocol ) );
174 }
175
176 PyObject *GetBigObjOnDiskProtocolAndDirectorySwig()
177 {
178   std::string directory;
179   SALOME::BigObjTransferProtocol ret0 = SALOME::GetBigObjOnDiskProtocolAndDirectory(directory);
180   PyObject *ret(PyTuple_New(2));
181   PyTuple_SetItem(ret,0,PyInt_FromLong(static_cast<char>( ret0 ) ));
182   PyTuple_SetItem(ret,1,PyUnicode_FromString(directory.c_str()));
183   return ret;
184 }
185
186 void SetVerbosityLevelSwig(const std::string& level)
187 {
188   SetVerbosityLevelStr(level);
189 }
190
191 std::string VerbosityLevelSwig()
192 {
193   return VerbosityLevelStr();
194 }
195
196 void SetPyExecutionModeStrSwig(const std::string& mode)
197 {
198   SetPyExecutionModeStr( mode );
199 }
200
201 std::string GetPyExecutionModeStrSwig()
202 {
203   return GetPyExecutionModeStr();
204 }
205
206 std::vector<std::string> GetAllPyExecutionModesSwig()
207 {
208   return GetAllPyExecutionModes();
209 }
210 }
211
212 %pythoncode %{
213 def ReadFloatsInFile( fileName ):
214   ret = ReadFloatsInFileSwig( fileName )
215   return ret
216 %}