Salome HOME
[EDF30062] : Steering proxy threshold/directory without environement considerations...
[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 (GetBigObjOnDiskDirectory) GetBigObjOnDiskDirectorySwig;
57 %rename (SetBigObjOnDiskDirectory) SetBigObjOnDiskDirectorySwig;
58 %rename (BigObjOnDiskDirectoryDefined) BigObjOnDiskDirectoryDefinedSwig;
59
60 bool getSSLMode();
61 void setSSLMode(bool sslMode);
62
63 bool getGUIMode();
64 void setGUIMode(bool guiMode);
65
66 std::string getIOROfEmbeddedNS();
67 void setIOROfEmbeddedNS(const std::string& ior);
68
69 double GetTimeAdjustmentCst();
70
71 long LaunchMonitoring(const std::string& pyScriptToEvaluate);
72
73 void StopMonitoring(long pid);
74
75 bool VerbosityActivated();
76
77 void SetVerbosityActivated(bool flag);
78
79 bool IsDebugLevel();
80
81 bool IsInfoLevel();
82
83 bool IsWarningLevel();
84
85 bool IsErrorLevel();
86
87 void WriteInStdout(const std::string& msg);
88
89 void WriteInStderr(const std::string& msg);
90
91 %rename (SetVerbosityLevel) SetVerbosityLevelSwig;
92 %rename (VerbosityLevel) VerbosityLevelSwig;
93 %rename (SetPyExecutionMode) SetPyExecutionModeStrSwig;
94 %rename (GetPyExecutionMode) GetPyExecutionModeStrSwig;
95 %rename (GetAllPyExecutionModes) GetAllPyExecutionModesSwig;
96
97 %inline
98 {
99 PyObject *HeatMarcelSwig(double timeAjustment, unsigned int nbThreads = 0)
100 {
101   double timeInS = 0.0;
102   long double piVal = HeatMarcel(timeAjustment,timeInS,nbThreads);
103   PyObject *ret(PyTuple_New(2));
104   PyTuple_SetItem(ret,0,SWIG_From_double((double)piVal));
105   PyTuple_SetItem(ret,1,SWIG_From_double(timeInS));
106   return ret;
107 }
108
109 std::vector<double> ReadFloatsInFileSwig(const std::string& fileName)
110 {
111   std::vector<double> ret;
112   try
113   {
114     ret = SALOME::ReadFloatsInFile( fileName );
115   }
116   catch(std::exception& e) { }
117   return ret;
118 }
119
120 int GetBigObjOnDiskThresholdSwig()
121 {
122   return SALOME::GetBigObjOnDiskThreshold();
123 }
124
125 void SetBigObjOnDiskThresholdSwig(int newThreshold)
126 {
127   return SALOME::SetBigObjOnDiskThreshold(newThreshold);
128 }
129
130 std::string GetBigObjOnDiskDirectorySwig()
131 {
132   return SALOME::GetBigObjOnDiskDirectory();
133 }
134
135 void SetBigObjOnDiskDirectorySwig(const std::string& directory)
136 {
137   return SALOME::SetBigObjOnDiskDirectory(directory);
138 }
139
140 bool BigObjOnDiskDirectoryDefinedSwig()
141 {
142   return SALOME::BigObjOnDiskDirectoryDefined();
143 }
144
145 void SetVerbosityLevelSwig(const std::string& level)
146 {
147   SetVerbosityLevelStr(level);
148 }
149
150 std::string VerbosityLevelSwig()
151 {
152   return VerbosityLevelStr();
153 }
154
155 void SetPyExecutionModeStrSwig(const std::string& mode)
156 {
157   SetPyExecutionModeStr( mode );
158 }
159
160 std::string GetPyExecutionModeStrSwig()
161 {
162   return GetPyExecutionModeStr();
163 }
164
165 std::vector<std::string> GetAllPyExecutionModesSwig()
166 {
167   return GetAllPyExecutionModes();
168 }
169 }
170
171 %pythoncode %{
172 def ReadFloatsInFile( fileName ):
173   ret = ReadFloatsInFileSwig( fileName )
174   return ret
175 %}