os/ossrv/ossrv_pub/boost_apis/boost/python/refcount.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 
    11 namespace boost { namespace python { 
    12 
    13 template <class T>
    14 inline T* incref(T* p)
    15 {
    16     Py_INCREF(python::upcast<PyObject>(p));
    17     return p;
    18 }
    19 
    20 template <class T>
    21 inline T* xincref(T* p)
    22 {
    23     Py_XINCREF(python::upcast<PyObject>(p));
    24     return p;
    25 }
    26 
    27 template <class T>
    28 inline void decref(T* p)
    29 {
    30     Py_DECREF(python::upcast<PyObject>(p));
    31 }
    32 
    33 template <class T>
    34 inline void xdecref(T* p)
    35 {
    36     Py_XDECREF(python::upcast<PyObject>(p));
    37 }
    38 
    39 }} // namespace boost::python
    40 
    41 #endif // REFCOUNT_DWA2002615_HPP