]> SALOME platform Git repositories - tools/ydefx.git/blob - src/pydefx/studyresult.py
Salome HOME
Add insitu example as a test.
[tools/ydefx.git] / src / pydefx / studyresult.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2019  EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 class StudyResult:
22   """
23   This class gathers global information about the execution of the study (global
24   errors, global result).
25   """
26   def __init__(self):
27     self.result = None
28     self.exit_code = None
29     self.error_message = None
30
31   def isExitCodeAvailable(self):
32     return not self.exit_code is None
33
34   def getExitCode(self):
35     return self.exit_code
36
37   def isResultAvailable(self):
38     return not self.exit_code is None
39
40   def getResult(self):
41     return self.result
42
43   def hasErrors(self):
44     return not self.error_message is None and len(self.error_message) > 0
45
46   def getErrors(self):
47     return self.error_message
48
49   def __str__(self):
50     result = """Exit code : {}
51 Error message : {}
52 Result:
53 {}""".format(self.exit_code, self.error_message, self.result)
54     return result