Reference counting helper. More...
#include </builds/ipbus/ipbus-software/uhal/python/pybind11-python2/tests/object.h>
Public Member Functions | |
ref () | |
Create a nullptr reference. More... | |
ref (T *ptr) | |
Construct a reference from a pointer. More... | |
ref (const ref &r) | |
Copy constructor. More... | |
ref (ref &&r) noexcept | |
Move constructor. More... | |
~ref () | |
Destroy this reference. More... | |
ref & | operator= (ref &&r) noexcept |
Move another reference into the current one. More... | |
ref & | operator= (const ref &r) |
Overwrite this reference with another reference. More... | |
ref & | operator= (T *ptr) |
Overwrite this reference with a pointer to another object. More... | |
bool | operator== (const ref &r) const |
Compare this reference with another reference. More... | |
bool | operator!= (const ref &r) const |
Compare this reference with another reference. More... | |
bool | operator== (const T *ptr) const |
Compare this reference with a pointer. More... | |
bool | operator!= (const T *ptr) const |
Compare this reference with a pointer. More... | |
T * | operator-> () |
Access the object referenced by this reference. More... | |
const T * | operator-> () const |
Access the object referenced by this reference. More... | |
T & | operator* () |
Return a C++ reference to the referenced object. More... | |
const T & | operator* () const |
Return a const C++ reference to the referenced object. More... | |
operator T* () | |
Return a pointer to the referenced object. More... | |
T * | get_ptr () |
Return a const pointer to the referenced object. More... | |
const T * | get_ptr () const |
Return a pointer to the referenced object. More... | |
ref () | |
Create a nullptr reference. More... | |
ref (T *ptr) | |
Construct a reference from a pointer. More... | |
ref (const ref &r) | |
Copy constructor. More... | |
ref (ref &&r) noexcept | |
Move constructor. More... | |
~ref () | |
Destroy this reference. More... | |
ref & | operator= (ref &&r) noexcept |
Move another reference into the current one. More... | |
ref & | operator= (const ref &r) |
Overwrite this reference with another reference. More... | |
ref & | operator= (T *ptr) |
Overwrite this reference with a pointer to another object. More... | |
bool | operator== (const ref &r) const |
Compare this reference with another reference. More... | |
bool | operator!= (const ref &r) const |
Compare this reference with another reference. More... | |
bool | operator== (const T *ptr) const |
Compare this reference with a pointer. More... | |
bool | operator!= (const T *ptr) const |
Compare this reference with a pointer. More... | |
T * | operator-> () |
Access the object referenced by this reference. More... | |
const T * | operator-> () const |
Access the object referenced by this reference. More... | |
T & | operator* () |
Return a C++ reference to the referenced object. More... | |
const T & | operator* () const |
Return a const C++ reference to the referenced object. More... | |
operator T* () | |
Return a pointer to the referenced object. More... | |
T * | get_ptr () |
Return a const pointer to the referenced object. More... | |
const T * | get_ptr () const |
Return a pointer to the referenced object. More... | |
Private Attributes | |
T * | m_ptr |
Reference counting helper.
The ref refeference template is a simple wrapper to store a pointer to an object. It takes care of increasing and decreasing the reference count of the object. When the last reference goes out of scope, the associated object will be deallocated.
Create a nullptr reference.
Definition at line 70 of file object.h.
References print_default_created(), and track_default_created().
Construct a reference from a pointer.
Definition at line 76 of file object.h.
References ref< T >::m_ptr, print_created(), and track_created().
Copy constructor.
Definition at line 86 of file object.h.
References ref< T >::m_ptr, print_copy_created(), and track_copy_created().
Move constructor.
Definition at line 96 of file object.h.
References ref< T >::m_ptr, print_move_created(), and track_move_created().
Destroy this reference.
Definition at line 104 of file object.h.
References ref< T >::m_ptr, print_destroyed(), and track_destroyed().
Create a nullptr reference.
Definition at line 70 of file object.h.
References print_default_created(), and track_default_created().
Construct a reference from a pointer.
Definition at line 76 of file object.h.
References ref< T >::m_ptr, print_created(), and track_created().
Copy constructor.
Definition at line 86 of file object.h.
References ref< T >::m_ptr, print_copy_created(), and track_copy_created().
Move constructor.
Definition at line 96 of file object.h.
References ref< T >::m_ptr, print_move_created(), and track_move_created().
Destroy this reference.
Definition at line 104 of file object.h.
References ref< T >::m_ptr, print_destroyed(), and track_destroyed().
|
inline |
Return a const pointer to the referenced object.
Definition at line 196 of file object.h.
References ref< T >::m_ptr.
Referenced by pybind11::detail::holder_helper< ref< T > >::get(), and PYBIND11_NAMESPACE::detail::holder_helper< ref< T > >::get().
|
inline |
Return a const pointer to the referenced object.
Definition at line 196 of file object.h.
References ref< T >::m_ptr.
|
inline |
Return a pointer to the referenced object.
Definition at line 199 of file object.h.
References ref< T >::m_ptr.
|
inline |
Return a pointer to the referenced object.
Definition at line 199 of file object.h.
References ref< T >::m_ptr.
|
inlineexplicit |
Return a pointer to the referenced object.
Definition at line 193 of file object.h.
References ref< T >::m_ptr.
|
inlineexplicit |
Return a pointer to the referenced object.
Definition at line 193 of file object.h.
References ref< T >::m_ptr.
Compare this reference with another reference.
Definition at line 172 of file object.h.
References ref< T >::m_ptr.
Compare this reference with another reference.
Definition at line 172 of file object.h.
References ref< T >::m_ptr.
|
inline |
Compare this reference with a pointer.
Definition at line 178 of file object.h.
References ref< T >::m_ptr.
|
inline |
Compare this reference with a pointer.
Definition at line 178 of file object.h.
References ref< T >::m_ptr.
|
inline |
Return a C++ reference to the referenced object.
Definition at line 187 of file object.h.
References ref< T >::m_ptr.
|
inline |
Return a C++ reference to the referenced object.
Definition at line 187 of file object.h.
References ref< T >::m_ptr.
|
inline |
Return a const C++ reference to the referenced object.
Definition at line 190 of file object.h.
References ref< T >::m_ptr.
|
inline |
Return a const C++ reference to the referenced object.
Definition at line 190 of file object.h.
References ref< T >::m_ptr.
|
inline |
Access the object referenced by this reference.
Definition at line 181 of file object.h.
References ref< T >::m_ptr.
|
inline |
Access the object referenced by this reference.
Definition at line 181 of file object.h.
References ref< T >::m_ptr.
|
inline |
Access the object referenced by this reference.
Definition at line 184 of file object.h.
References ref< T >::m_ptr.
|
inline |
Access the object referenced by this reference.
Definition at line 184 of file object.h.
References ref< T >::m_ptr.
Overwrite this reference with another reference.
Definition at line 130 of file object.h.
References ref< T >::m_ptr, print_copy_assigned(), and track_copy_assigned().
Overwrite this reference with another reference.
Definition at line 130 of file object.h.
References ref< T >::m_ptr, print_copy_assigned(), and track_copy_assigned().
Move another reference into the current one.
Definition at line 114 of file object.h.
References ref< T >::m_ptr, print_move_assigned(), and track_move_assigned().
Move another reference into the current one.
Definition at line 114 of file object.h.
References ref< T >::m_ptr, print_move_assigned(), and track_move_assigned().
Overwrite this reference with a pointer to another object.
Definition at line 151 of file object.h.
References ref< T >::m_ptr, print_values(), and track_values().
Overwrite this reference with a pointer to another object.
Definition at line 151 of file object.h.
References ref< T >::m_ptr, print_values(), and track_values().
Compare this reference with another reference.
Definition at line 169 of file object.h.
References ref< T >::m_ptr.
Compare this reference with another reference.
Definition at line 169 of file object.h.
References ref< T >::m_ptr.
|
inline |
Compare this reference with a pointer.
Definition at line 175 of file object.h.
References ref< T >::m_ptr.
|
inline |
Compare this reference with a pointer.
Definition at line 175 of file object.h.
References ref< T >::m_ptr.
|
private |
Definition at line 202 of file object.h.
Referenced by ref< T >::get_ptr(), ref< T >::operator T*(), ref< T >::operator!=(), ref< T >::operator*(), ref< T >::operator->(), ref< T >::operator=(), ref< T >::operator==(), ref< T >::ref(), and ref< T >::~ref().