File indexing completed on 2025-01-18 09:50:42
0001
0002
0003
0004
0005 #ifndef REFCOUNT_DWA2002615_HPP
0006 # define REFCOUNT_DWA2002615_HPP
0007
0008 # include <boost/python/detail/prefix.hpp>
0009 # include <boost/python/cast.hpp>
0010
0011 namespace boost { namespace python {
0012
0013 template <class T>
0014 inline T* incref(T* p)
0015 {
0016 Py_INCREF(python::upcast<PyObject>(p));
0017 return p;
0018 }
0019
0020 template <class T>
0021 inline T* xincref(T* p)
0022 {
0023 Py_XINCREF(python::upcast<PyObject>(p));
0024 return p;
0025 }
0026
0027 template <class T>
0028 inline void decref(T* p)
0029 {
0030 assert( Py_REFCNT(python::upcast<PyObject>(p)) > 0 );
0031 Py_DECREF(python::upcast<PyObject>(p));
0032 }
0033
0034 template <class T>
0035 inline void xdecref(T* p)
0036 {
0037 assert( !p || Py_REFCNT(python::upcast<PyObject>(p)) > 0 );
0038 Py_XDECREF(python::upcast<PyObject>(p));
0039 }
0040
0041 }}
0042
0043 #endif