source: NonGTP/Boost/boost/python/refcount.hpp @ 857

Revision 857, 879 bytes checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright David Abrahams 2002.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#ifndef REFCOUNT_DWA2002615_HPP
6# define REFCOUNT_DWA2002615_HPP
7
8# include <boost/python/detail/prefix.hpp>
9# include <boost/python/cast.hpp>
10
11namespace boost { namespace python {
12
13template <class T>
14inline T* incref(T* p)
15{
16    Py_INCREF(python::upcast<PyObject>(p));
17    return p;
18}
19
20template <class T>
21inline T* xincref(T* p)
22{
23    Py_XINCREF(python::upcast<PyObject>(p));
24    return p;
25}
26
27template <class T>
28inline void decref(T* p)
29{
30    Py_DECREF(python::upcast<PyObject>(p));
31}
32
33template <class T>
34inline void xdecref(T* p)
35{
36    Py_XDECREF(python::upcast<PyObject>(p));
37}
38
39}} // namespace boost::python
40
41#endif // REFCOUNT_DWA2002615_HPP
Note: See TracBrowser for help on using the repository browser.