Debian Codegraph @

src/Base/BindingManager.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /***************************************************************************
4 * Copyright (c) 2021 Werner Mayer <wmayer[at]users.sourceforge.net> *
5 * *
6 * This file is part of the FreeCAD CAx development system. *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Library General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Library General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Library General Public *
19 * License along with this library; see the file COPYING.LIB. If not, *
20 * write to the Free Software Foundation, Inc., 59 Temple Place, *
21 * Suite 330, Boston, MA 02111-1307, USA *
22 * *
23 ***************************************************************************/
24
25
26 #ifndef BASE_BINDINGMANAGER_H
27 #define BASE_BINDINGMANAGER_H
28
29 #include <memory>
30 #include <FCGlobal.h>
31
32 using PyObject = struct _object;
33
34 namespace Base
35 {
36
37 class BaseExport BindingManager
38 {
39 public:
40 static BindingManager& instance();
41
42 bool hasWrapper(const void* cptr);
43
44 void registerWrapper(const void* cptr, PyObject* pyObj);
45 void releaseWrapper(const void* cptr, PyObject* pyObj);
46
47 PyObject* retrieveWrapper(const void* cptr);
48
49 BindingManager(const BindingManager&) = delete;
50 BindingManager(BindingManager&&) = delete;
51 BindingManager& operator=(const BindingManager&) = delete;
52 BindingManager& operator=(BindingManager&&) = delete;
53
54 private:
55 BindingManager();
56 ~BindingManager();
57
58 struct BindingManagerPrivate;
59 std::unique_ptr<BindingManagerPrivate> p;
60 };
61
62 } // namespace Base
63
64 #endif // BASE_BINDINGMANAGER_H