MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / handle

Class handle

include/win/boost/python/handle.hpp:62–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61template <class T>
62class handle
63{
64 typedef T* (handle::* bool_type )() const;
65
66 public: // types
67 typedef T element_type;
68
69 public: // member functions
70 handle();
71 ~handle();
72
73 template <class Y>
74 explicit handle(Y* p)
75 : m_p(
76 python::upcast<T>(
77 detail::manage_ptr(p, 0)
78 )
79 )
80 {
81 }
82
83 handle& operator=(handle const& r)
84 {
85 python::xdecref(m_p);
86 m_p = python::xincref(r.m_p);
87 return *this;
88 }
89
90 template<typename Y>
91 handle& operator=(handle<Y> const & r) // never throws
92 {
93 python::xdecref(m_p);
94 m_p = python::xincref(python::upcast<T>(r.get()));
95 return *this;
96 }
97
98 template <typename Y>
99 handle(handle<Y> const& r)
100 : m_p(python::xincref(python::upcast<T>(r.get())))
101 {
102 }
103
104 handle(handle const& r)
105 : m_p(python::xincref(r.m_p))
106 {
107 }
108
109 T* operator-> () const;
110 T& operator* () const;
111 T* get() const;
112 T* release();
113 void reset();
114
115 operator bool_type() const // never throws
116 {
117 return m_p ? &handle<T>::get : 0;
118 }
119 bool operator! () const; // never throws

Callers 1

Calls 3

xdecrefFunction · 0.85
xincrefFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected