author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright David Abrahams 2002. |
sl@0 | 2 |
// Distributed under the Boost Software License, Version 1.0. (See |
sl@0 | 3 |
// accompanying file LICENSE_1_0.txt or copy at |
sl@0 | 4 |
// http://www.boost.org/LICENSE_1_0.txt) |
sl@0 | 5 |
#ifndef REFCOUNT_DWA2002615_HPP |
sl@0 | 6 |
# define REFCOUNT_DWA2002615_HPP |
sl@0 | 7 |
|
sl@0 | 8 |
# include <boost/python/detail/prefix.hpp> |
sl@0 | 9 |
# include <boost/python/cast.hpp> |
sl@0 | 10 |
|
sl@0 | 11 |
namespace boost { namespace python { |
sl@0 | 12 |
|
sl@0 | 13 |
template <class T> |
sl@0 | 14 |
inline T* incref(T* p) |
sl@0 | 15 |
{ |
sl@0 | 16 |
Py_INCREF(python::upcast<PyObject>(p)); |
sl@0 | 17 |
return p; |
sl@0 | 18 |
} |
sl@0 | 19 |
|
sl@0 | 20 |
template <class T> |
sl@0 | 21 |
inline T* xincref(T* p) |
sl@0 | 22 |
{ |
sl@0 | 23 |
Py_XINCREF(python::upcast<PyObject>(p)); |
sl@0 | 24 |
return p; |
sl@0 | 25 |
} |
sl@0 | 26 |
|
sl@0 | 27 |
template <class T> |
sl@0 | 28 |
inline void decref(T* p) |
sl@0 | 29 |
{ |
sl@0 | 30 |
Py_DECREF(python::upcast<PyObject>(p)); |
sl@0 | 31 |
} |
sl@0 | 32 |
|
sl@0 | 33 |
template <class T> |
sl@0 | 34 |
inline void xdecref(T* p) |
sl@0 | 35 |
{ |
sl@0 | 36 |
Py_XDECREF(python::upcast<PyObject>(p)); |
sl@0 | 37 |
} |
sl@0 | 38 |
|
sl@0 | 39 |
}} // namespace boost::python |
sl@0 | 40 |
|
sl@0 | 41 |
#endif // REFCOUNT_DWA2002615_HPP |