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