vrpn 07.35
Virtual Reality Peripheral Network
|
A unique-ownership smart pointer, with the ability to transfer ownership, but only explicitly (aka, not like auto_ptr did it). More...
#include <vrpn_OwningPtr.h>
Public Types | |
typedef T | element_type |
typedef T & | reference_type |
typedef D | deleter_type |
typedef traits::OwningPtrPointerType< T >::type | pointer |
typedef OwningPtr< T, D > | type |
Public Member Functions | |
OwningPtr () | |
Construct empty. | |
OwningPtr (pointer p) | |
Construct with a raw pointer for a new object to take exclusive ownership of. | |
~OwningPtr () | |
Destructor: deletes owned object, if any. | |
void | reset (pointer p=pointer()) |
Deletes the owned object, if any, and takes ownership of a new object, if one is passed. | |
pointer | release () |
Returns the held pointer without performing the delete action. | |
void | swap (type &other) |
Swap pointers with another OwningPtr of the same type. | |
pointer | get () const |
Gets pointer value. | |
pointer | operator-> () const |
Smart pointer operator overload. | |
reference_type | operator* () const |
Smart pointer operator. | |
bool | valid () const |
Checks pointer validity. | |
bool | operator! () const |
Redundant way of checking pointer validity. | |
Safe bool idiom - in the absence of explicit operator bool() | |
typedef pointer type::* | unspecified_bool_type |
operator unspecified_bool_type () const | |
A unique-ownership smart pointer, with the ability to transfer ownership, but only explicitly (aka, not like auto_ptr did it).
Essentially, a hybrid of boost::scoped_ptr and std::unique_ptr that doesn't require C++11.
Limitations relative to unique_ptr: no move semantics (naturally, since no C++11, and have not implemented rvalue-reference-emulation), no stateful deleters, and no casting or conversions.
Definition at line 74 of file vrpn_OwningPtr.h.
typedef D vrpn::OwningPtr< T, D >::deleter_type |
Definition at line 78 of file vrpn_OwningPtr.h.
typedef T vrpn::OwningPtr< T, D >::element_type |
Definition at line 76 of file vrpn_OwningPtr.h.
typedef traits::OwningPtrPointerType<T>::type vrpn::OwningPtr< T, D >::pointer |
Definition at line 79 of file vrpn_OwningPtr.h.
typedef T& vrpn::OwningPtr< T, D >::reference_type |
Definition at line 77 of file vrpn_OwningPtr.h.
typedef OwningPtr<T, D> vrpn::OwningPtr< T, D >::type |
Definition at line 80 of file vrpn_OwningPtr.h.
typedef pointer type::* vrpn::OwningPtr< T, D >::unspecified_bool_type |
Definition at line 144 of file vrpn_OwningPtr.h.
|
inline |
Construct empty.
Definition at line 83 of file vrpn_OwningPtr.h.
|
inlineexplicit |
Construct with a raw pointer for a new object to take exclusive ownership of.
Definition at line 90 of file vrpn_OwningPtr.h.
|
inline |
Destructor: deletes owned object, if any.
Definition at line 96 of file vrpn_OwningPtr.h.
References vrpn::OwningPtr< T, D >::reset().
|
inline |
Gets pointer value.
Definition at line 121 of file vrpn_OwningPtr.h.
Referenced by vrpn::get_pointer(), vrpn::operator!=(), vrpn::operator!=(), vrpn::operator!=(), vrpn::operator==(), vrpn::operator==(), and vrpn::operator==().
|
inline |
Definition at line 145 of file vrpn_OwningPtr.h.
References vrpn::OwningPtr< T, D >::valid().
|
inline |
Redundant way of checking pointer validity.
Definition at line 152 of file vrpn_OwningPtr.h.
References vrpn::OwningPtr< T, D >::valid().
|
inline |
Smart pointer operator.
Definition at line 132 of file vrpn_OwningPtr.h.
References vrpn::OwningPtr< T, D >::valid(), and VRPN_ASSERT_MSG.
|
inline |
Smart pointer operator overload.
Definition at line 124 of file vrpn_OwningPtr.h.
References vrpn::OwningPtr< T, D >::valid(), and VRPN_ASSERT_MSG.
|
inline |
Returns the held pointer without performing the delete action.
Definition at line 110 of file vrpn_OwningPtr.h.
|
inline |
Deletes the owned object, if any, and takes ownership of a new object, if one is passed.
Definition at line 100 of file vrpn_OwningPtr.h.
Referenced by vrpn_Tracker_RazerHydra::vrpn_Tracker_RazerHydra(), vrpn_Tracker_RazerHydra::vrpn_Tracker_RazerHydra(), vrpn_Tracker_RazerHydra::vrpn_Tracker_RazerHydra(), and vrpn::OwningPtr< T, D >::~OwningPtr().
|
inline |
Swap pointers with another OwningPtr of the same type.
Definition at line 118 of file vrpn_OwningPtr.h.
Referenced by vrpn::swap().
|
inline |
Checks pointer validity.
Definition at line 140 of file vrpn_OwningPtr.h.
Referenced by vrpn::OwningPtr< T, D >::operator unspecified_bool_type(), vrpn::OwningPtr< T, D >::operator!(), vrpn::OwningPtr< T, D >::operator*(), and vrpn::OwningPtr< T, D >::operator->().