RCPtr is a reference counted (smart) pointer. More...
#include <RCPtr.h>
Public Types | |
typedef void | iterator_category |
Template argument typedef. | |
typedef void | difference_type |
Template argument typedef. | |
typedef T * | pointer |
Template argument typedef. | |
typedef const T * | const_pointer |
Template argument typedef. | |
typedef T & | reference |
Template argument typedef. | |
typedef const T & | const_reference |
Template argument typedef. | |
typedef T | value_type |
Template argument typedef. | |
Public Member Functions | |
RCPtr () | |
| |
RCPtr (decltype(nullptr)) | |
Constructor for nullptr. | |
RCPtr (const RCPtr &p) | |
Copy constructor. | |
template<typename UPtr > | |
RCPtr (const UPtr &u) | |
Copy constructor for class UPtr which has operator-> defined resulting in a value implicitly convertible to T *. | |
RCPtr (pointer p) | |
Construction from real pointer. | |
~RCPtr () | |
Destructor. | |
RCPtr & | create () |
Allocate and construct an object of class T and point to it, possibly deleting the object pointed to before. | |
RCPtr & | create (const_reference t) |
Allocate and copy-construct an object of class T and point to it, possibly deleting the object pointed to before. | |
RCPtr & | operator= (const RCPtr &p) |
Assignment. | |
template<typename UPtr > | |
RCPtr & | operator= (const UPtr &u) |
Assignment from class UPtr which has operator-> defined resulting in a value implicitly convertible to T *. | |
template<typename UPtr > | |
RCPtr & | assignDynamic (const UPtr &u) |
Assignment from class UPtr which has operator-> defined resulting in a value which can be cast dynamically to T *. | |
template<typename UPtr > | |
RCPtr & | assignConst (const UPtr &u) |
Assignment from class UPtr which has operator-> defined resulting in a value which can be const_cast'ed to T *. | |
void | swap (RCPtr &p) |
Make p point to the object pointed to by this and vice versa. | |
bool | operator== (const RCPtr &p) const |
Test for equality of the underlying pointers. | |
bool | operator!= (const RCPtr &p) const |
Test for inequality of the underlying pointers. | |
bool | operator== (const_pointer p) const |
Test for equality of the underlying pointers. | |
bool | operator!= (const_pointer p) const |
Test for inequality of the underlying pointers. | |
template<typename UPtr > | |
bool | operator== (const UPtr &u) const |
Test for equality of the underlying pointers. | |
template<typename UPtr > | |
bool | operator!= (const UPtr &u) const |
Test for inequality of the underlying pointers. | |
bool | operator< (const RCPtr &p) const |
Test for ordering. | |
bool | operator< (const_pointer p) const |
Test for ordering. | |
bool | operator! () const |
Returns true if the underlying pointer is null. | |
operator T* () const | |
Returns the underlying pointer. | |
pointer | operator-> () const |
Member access. | |
reference | operator* () const |
Dereferencing. | |
Static Public Member Functions | |
static RCPtr | Create () |
Allocate and construct an object of class T and return a RCPtr to it. | |
static RCPtr | Create (const_reference t) |
Allocate and copy-construct an object of class T and return a RCPtr to it. | |
Private Member Functions | |
void | increment () |
Increment the counter of the object pointed to. | |
void | release () |
Stop pointing to the current object and delete it if this was the last pointer to it. | |
Private Attributes | |
pointer | ptr |
The actual pointer. | |
Additional Inherited Members | |
Protected Member Functions inherited from ThePEG::Pointer::RCPtrBase | |
void | increment (const ReferenceCounted *rcp) |
Increment the counter of a reference counted object. | |
bool | release (const ReferenceCounted *rcp) |
Decrement the counter of a reference counted object. | |
RCPtr is a reference counted (smart) pointer.
Objects created using the RCPtr::create() methods will continue living until no RCPtr or ConstRCPtr are pointing to it, at which point it will be deleted.
typedef const T* ThePEG::Pointer::RCPtr< T >::const_pointer |
typedef const T& ThePEG::Pointer::RCPtr< T >::const_reference |
typedef void ThePEG::Pointer::RCPtr< T >::difference_type |
typedef void ThePEG::Pointer::RCPtr< T >::iterator_category |
typedef T* ThePEG::Pointer::RCPtr< T >::pointer |
typedef T& ThePEG::Pointer::RCPtr< T >::reference |
typedef T ThePEG::Pointer::RCPtr< T >::value_type |
|
inline |
|
inline |
|
inline |
Copy constructor.
Definition at line 95 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::increment().
|
inline |
Copy constructor for class UPtr which has operator-> defined resulting in a value implicitly convertible to T *.
Definition at line 102 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::increment().
|
inlineexplicit |
Construction from real pointer.
Definition at line 108 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::increment().
|
inline |
Destructor.
Deletes the object pointed to if this is the last pointer to it.
Definition at line 114 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::release().
|
inline |
Assignment from class UPtr which has operator-> defined resulting in a value which can be const_cast'ed to T *.
Definition at line 200 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::increment(), ThePEG::Pointer::RCPtr< T >::ptr, and ThePEG::Pointer::RCPtr< T >::release().
|
inline |
Assignment from class UPtr which has operator-> defined resulting in a value which can be cast dynamically to T *.
Definition at line 186 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::increment(), ThePEG::Pointer::RCPtr< T >::ptr, and ThePEG::Pointer::RCPtr< T >::release().
|
inlinestatic |
Allocate and construct an object of class T and return a RCPtr to it.
Definition at line 120 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::create().
Referenced by ThePEG::Pointer::PtrTraits< RCPtr< T > >::create(), ThePEG::Pointer::PtrTraits< ConstRCPtr< T > >::create(), and ThePEG::ClassTraitsBase< T >::create().
|
inline |
Allocate and construct an object of class T and point to it, possibly deleting the object pointed to before.
Definition at line 139 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr, and ThePEG::Pointer::RCPtr< T >::release().
Referenced by ThePEG::Pointer::RCPtr< T >::Create().
|
inlinestatic |
Allocate and copy-construct an object of class T and return a RCPtr to it.
Definition at line 129 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::create().
|
inline |
Allocate and copy-construct an object of class T and point to it, possibly deleting the object pointed to before.
Definition at line 150 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr, and ThePEG::Pointer::RCPtr< T >::release().
|
inlineprivate |
Increment the counter of the object pointed to.
Definition at line 296 of file RCPtr.h.
References ThePEG::Pointer::RCPtrBase::increment(), and ThePEG::Pointer::RCPtr< T >::ptr.
Referenced by ThePEG::Pointer::RCPtr< T >::assignConst(), ThePEG::Pointer::RCPtr< T >::assignDynamic(), ThePEG::Pointer::RCPtr< T >::operator=(), and ThePEG::Pointer::RCPtr< T >::RCPtr().
|
inline |
Returns the underlying pointer.
Definition at line 279 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Returns true if the underlying pointer is null.
Definition at line 274 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Test for inequality of the underlying pointers.
Definition at line 227 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Test for inequality of the underlying pointers.
Definition at line 251 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Test for inequality of the underlying pointers.
Definition at line 237 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
|
inline |
|
inline |
Test for ordering.
Definition at line 258 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Test for ordering.
Definition at line 266 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Assignment.
Definition at line 160 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::increment(), ThePEG::Pointer::RCPtr< T >::ptr, and ThePEG::Pointer::RCPtr< T >::release().
|
inline |
Assignment from class UPtr which has operator-> defined resulting in a value implicitly convertible to T *.
Definition at line 173 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::increment(), ThePEG::Pointer::RCPtr< T >::ptr, and ThePEG::Pointer::RCPtr< T >::release().
|
inline |
Test for equality of the underlying pointers.
Definition at line 222 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Test for equality of the underlying pointers.
Definition at line 243 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inline |
Test for equality of the underlying pointers.
Definition at line 232 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
|
inlineprivate |
Stop pointing to the current object and delete it if this was the last pointer to it.
Definition at line 302 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr, and ThePEG::Pointer::RCPtrBase::release().
Referenced by ThePEG::Pointer::RCPtr< T >::assignConst(), ThePEG::Pointer::RCPtr< T >::assignDynamic(), ThePEG::Pointer::RCPtr< T >::create(), ThePEG::Pointer::RCPtr< T >::operator=(), and ThePEG::Pointer::RCPtr< T >::~RCPtr().
|
inline |
Make p point to the object pointed to by this and vice versa.
Definition at line 212 of file RCPtr.h.
References ThePEG::Pointer::RCPtr< T >::ptr.
Referenced by std::swap().
|
private |
The actual pointer.
Definition at line 307 of file RCPtr.h.
Referenced by ThePEG::Pointer::RCPtr< T >::assignConst(), ThePEG::Pointer::RCPtr< T >::assignDynamic(), ThePEG::Pointer::RCPtr< T >::create(), ThePEG::Pointer::RCPtr< T >::increment(), ThePEG::Pointer::RCPtr< T >::operator T*(), ThePEG::Pointer::RCPtr< T >::operator!(), ThePEG::Pointer::RCPtr< T >::operator!=(), ThePEG::Pointer::RCPtr< T >::operator*(), ThePEG::Pointer::RCPtr< T >::operator->(), ThePEG::Pointer::RCPtr< T >::operator<(), ThePEG::Pointer::RCPtr< T >::operator=(), ThePEG::Pointer::RCPtr< T >::operator==(), ThePEG::Pointer::RCPtr< T >::release(), and ThePEG::Pointer::RCPtr< T >::swap().