Mercurial > hg > orthanc-python
annotate Sources/PythonFunction.h @ 164:519e285ce627 OrthancPython-4.2
hotfix to add Windows builders for Python 3.12
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 16 May 2024 23:09:09 +0200 |
parents | 71d305c29cfa |
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 "PythonObject.h" | |
24 | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
13
diff
changeset
|
25 #include <Compatibility.h> |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
13
diff
changeset
|
26 |
0 | 27 #include <memory> |
28 | |
29 class PythonModule; | |
30 | |
31 class PythonFunction : public boost::noncopyable | |
32 { | |
33 friend class PythonLock; | |
34 | |
35 private: | |
36 PythonLock& lock_; | |
37 std::unique_ptr<PythonObject> func_; | |
38 | |
39 PythonObject* CallUnchecked(PyObject* args); | |
40 | |
41 public: | |
42 PythonFunction(PythonLock& lock, | |
13 | 43 const PythonModule& module, |
0 | 44 const std::string& name); |
45 | |
46 bool IsValid() const | |
47 { | |
48 return func_.get() != NULL; | |
49 } | |
50 | |
51 PythonObject* Call(); | |
52 | |
13 | 53 PythonObject* Call(const PythonObject& args); |
0 | 54 |
55 void CallVoid() | |
56 { | |
57 std::unique_ptr<PythonObject> result(Call()); | |
58 } | |
59 }; |