Mercurial > hg > orthanc-python
annotate Sources/PythonFunction.h @ 79:068551520123
New Python function: "orthanc.RegisterStorageArea()"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 12 Aug 2021 17:52:17 +0200 |
parents | 23f3099bed47 |
children | eb6ac5a801d1 |
rev | line source |
---|---|
0 | 1 /** |
2 * Python plugin for Orthanc | |
56
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
36
diff
changeset
|
3 * Copyright (C) 2020-2021 Osimis S.A., Belgium |
0 | 4 * |
5 * This program is free software: you can redistribute it and/or | |
6 * modify it under the terms of the GNU Affero General Public License | |
7 * as published by the Free Software Foundation, either version 3 of | |
8 * the License, or (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, but | |
11 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Affero General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Affero General Public License | |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 **/ | |
18 | |
19 | |
20 #pragma once | |
21 | |
22 #include "PythonObject.h" | |
23 | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
13
diff
changeset
|
24 #include <Compatibility.h> |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
13
diff
changeset
|
25 |
0 | 26 #include <memory> |
27 | |
28 class PythonModule; | |
29 | |
30 class PythonFunction : public boost::noncopyable | |
31 { | |
32 friend class PythonLock; | |
33 | |
34 private: | |
35 PythonLock& lock_; | |
36 std::unique_ptr<PythonObject> func_; | |
37 | |
38 PythonObject* CallUnchecked(PyObject* args); | |
39 | |
40 public: | |
41 PythonFunction(PythonLock& lock, | |
13 | 42 const PythonModule& module, |
0 | 43 const std::string& name); |
44 | |
45 bool IsValid() const | |
46 { | |
47 return func_.get() != NULL; | |
48 } | |
49 | |
50 PythonObject* Call(); | |
51 | |
13 | 52 PythonObject* Call(const PythonObject& args); |
0 | 53 |
54 void CallVoid() | |
55 { | |
56 std::unique_ptr<PythonObject> result(Call()); | |
57 } | |
58 }; |