Mercurial > hg > orthanc-python
annotate Sources/PythonLock.h @ 155:71d305c29cfa
updated year to 2024
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 16 Mar 2024 11:58:51 +0100 |
parents | 65ec5597ec70 |
children | 6fada29b6759 |
rev | line source |
---|---|
0 | 1 /** |
2 * Python plugin for Orthanc | |
155
71d305c29cfa
updated year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
3 * Copyright (C) 2020-2024 Osimis S.A., Belgium |
71d305c29cfa
updated year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
4 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 5 * |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU Affero General Public License | |
8 * as published by the Free Software Foundation, either version 3 of | |
9 * the License, or (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * Affero General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU Affero General Public License | |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 **/ | |
19 | |
20 | |
21 #pragma once | |
22 | |
23 #include <orthanc/OrthancCPlugin.h> | |
24 | |
25 #define PY_SSIZE_T_CLEAN /* Make "s#" use Py_ssize_t rather than int. */ | |
26
b0d1308280d8
Added the PYTHON_WINDOWS_USE_RELEASE_LIBS CMake option
Benjamin Golinvaux <bgo@osimis.io>
parents:
0
diff
changeset
|
26 #include "PythonHeaderWrapper.h" |
0 | 27 |
28 #include <boost/noncopyable.hpp> | |
29 #include <string> | |
30 | |
31 class PythonLock : public boost::noncopyable | |
32 { | |
33 private: | |
34 PyGILState_STATE gstate_; | |
35 | |
36 public: | |
37 typedef void (*ModuleClassesInstaller) (PyObject* module); | |
38 | |
39 typedef PyMethodDef* (*ModuleFunctionsInstaller) (); | |
40 | |
41 PythonLock(); | |
42 | |
43 ~PythonLock(); | |
44 | |
45 void ExecuteCommand(const std::string& s); | |
46 | |
47 void ExecuteFile(const std::string& path); | |
48 | |
49 bool HasErrorOccurred(std::string& traceback); | |
50 | |
63
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
51 OrthancPluginErrorCode CheckCallbackSuccess(const std::string& callbackDetails); |
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
52 |
0 | 53 static void GlobalInitialize(const std::string& moduleName, |
54 const std::string& exceptionName, | |
55 ModuleFunctionsInstaller moduleFunctions, | |
56 ModuleClassesInstaller moduleClasses, | |
57 bool verbose); | |
58 | |
59 static void GlobalFinalize(); | |
60 | |
61 static void AddSysPath(const std::string& path); | |
62 | |
75
cbfc72a53970
refactoring calls to PythonLock::RaiseException()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
63 static void RaiseException(OrthancPluginErrorCode code); |
28
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
64 |
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
65 static void LogCall(const std::string& message); |
0 | 66 }; |