]> SALOME platform Git repositories - modules/kernel.git/blob - src/Basics/KernelBasis.i
Salome HOME
[EDF30062] : Forward of current directory mecanism
[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 %rename (GetForwardCurrentDirectoryStatus) GetForwardCurrentDirectoryStatusSwig;
66 %rename (SetForwardCurrentDirectoryStatus) SetForwardCurrentDirectoryStatusSwig;
67
68 bool getSSLMode();
69 void setSSLMode(bool sslMode);
70
71 bool getGUIMode();
72 void setGUIMode(bool guiMode);
73
74 std::string getIOROfEmbeddedNS();
75 void setIOROfEmbeddedNS(const std::string& ior);
76
77 double GetTimeAdjustmentCst();
78
79 long LaunchMonitoring(const std::string& pyScriptToEvaluate);
80
81 void StopMonitoring(long pid);
82
83 bool VerbosityActivated();
84
85 void SetVerbosityActivated(bool flag);
86
87 bool IsDebugLevel();
88
89 bool IsInfoLevel();
90
91 bool IsWarningLevel();
92
93 bool IsErrorLevel();
94
95 void WriteInStdout(const std::string& msg);
96
97 void WriteInStderr(const std::string& msg);
98
99 %rename (SetVerbosityLevel) SetVerbosityLevelSwig;
100 %rename (VerbosityLevel) VerbosityLevelSwig;
101 %rename (SetPyExecutionMode) SetPyExecutionModeStrSwig;
102 %rename (GetPyExecutionMode) GetPyExecutionModeStrSwig;
103 %rename (GetAllPyExecutionModes) GetAllPyExecutionModesSwig;
104
105 %inline
106 {
107 PyObject *HeatMarcelSwig(double timeAjustment, unsigned int nbThreads = 0)
108 {
109   double timeInS = 0.0;
110   long double piVal = HeatMarcel(timeAjustment,timeInS,nbThreads);
111   PyObject *ret(PyTuple_New(2));
112   PyTuple_SetItem(ret,0,SWIG_From_double((double)piVal));
113   PyTuple_SetItem(ret,1,SWIG_From_double(timeInS));
114   return ret;
115 }
116
117 std::vector<double> ReadFloatsInFileSwig(const std::string& fileName)
118 {
119   std::vector<double> ret;
120   try
121   {
122     ret = SALOME::ReadFloatsInFile( fileName );
123   }
124   catch(std::exception& e) { }
125   return ret;
126 }
127
128 int GetBigObjOnDiskThresholdSwig()
129 {
130   return SALOME::GetBigObjOnDiskThreshold();
131 }
132
133 void SetBigObjOnDiskThresholdSwig(int newThreshold)
134 {
135   return SALOME::SetBigObjOnDiskThreshold(newThreshold);
136 }
137
138 void SetBigObjOnDiskDirectorySwig(const std::string& directory)
139 {
140   return SALOME::SetBigObjOnDiskDirectory(directory);
141 }
142
143 bool BigObjOnDiskDirectoryDefinedSwig()
144 {
145   return SALOME::BigObjOnDiskDirectoryDefined();
146 }
147
148 void SetNumberOfRetrySwig(int nbRetry)
149 {
150   SALOME::SetNumberOfRetry( nbRetry );
151 }
152
153 int GetNumberOfRetrySwig()
154 {
155   return SALOME::GetNumberOfRetry( );
156 }
157
158 bool GetForwardCurrentDirectoryStatusSwig()
159 {
160   return SALOME::GetForwardCurrentDirectoryStatus();
161 }
162
163 void SetForwardCurrentDirectoryStatusSwig(bool newStatus)
164 {
165   SALOME::SetForwardCurrentDirectoryStatus(newStatus);
166 }
167
168 std::string GetDirectoryForReplayFilesSwig()
169 {
170   return SALOME::GetDirectoryForReplayFiles();
171 }
172
173 void SetDirectoryForReplayFilesSwig(const std::string& directory)
174 {
175   SALOME::SetDirectoryForReplayFiles(directory);
176 }
177
178 std::string BigObjOnDiskProtocolToStrSwig( int protocol )
179 {
180   return SALOME::BigObjOnDiskProtocolToStr( SALOME::FromIntToBigObjOnDiskProtocol( protocol ) );
181 }
182
183 int BigObjOnDiskProtocolFromStrSwig(const std::string& protocol)
184 {
185   return static_cast<char>( SALOME::BigObjOnDiskProtocolFromStr( protocol ) );
186 }
187
188 PyObject *GetBigObjOnDiskProtocolAndDirectorySwig()
189 {
190   std::string directory;
191   SALOME::BigObjTransferProtocol ret0 = SALOME::GetBigObjOnDiskProtocolAndDirectory(directory);
192   PyObject *ret(PyTuple_New(2));
193   PyTuple_SetItem(ret,0,PyInt_FromLong(static_cast<char>( ret0 ) ));
194   PyTuple_SetItem(ret,1,PyUnicode_FromString(directory.c_str()));
195   return ret;
196 }
197
198 void SetVerbosityLevelSwig(const std::string& level)
199 {
200   SetVerbosityLevelStr(level);
201 }
202
203 std::string VerbosityLevelSwig()
204 {
205   return VerbosityLevelStr();
206 }
207
208 void SetPyExecutionModeStrSwig(const std::string& mode)
209 {
210   SetPyExecutionModeStr( mode );
211 }
212
213 std::string GetPyExecutionModeStrSwig()
214 {
215   return GetPyExecutionModeStr();
216 }
217
218 std::vector<std::string> GetAllPyExecutionModesSwig()
219 {
220   return GetAllPyExecutionModes();
221 }
222 }
223
224 %pythoncode %{
225 def ReadFloatsInFile( fileName ):
226   ret = ReadFloatsInFileSwig( fileName )
227   return ret
228 %}