thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
ThePEG::Pointer::RCPtr< T > Class Template Reference

RCPtr is a reference counted (smart) pointer. More...

#include <RCPtr.h>

Inheritance diagram for ThePEG::Pointer::RCPtr< T >:

Public Types

typedef void iterator_category
 Template argument typedef. More...
 
typedef void difference_type
 Template argument typedef. More...
 
typedef T * pointer
 Template argument typedef. More...
 
typedef const T * const_pointer
 Template argument typedef. More...
 
typedef T & reference
 Template argument typedef. More...
 
typedef const T & const_reference
 Template argument typedef. More...
 
typedef T value_type
 Template argument typedef. More...
 

Public Member Functions

 RCPtr ()
  More...
 
 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. More...
 
RCPtrcreate ()
 Allocate and construct an object of class T and point to it, possibly deleting the object pointed to before.
 
RCPtrcreate (const_reference t)
 Allocate and copy-construct an object of class T and point to it, possibly deleting the object pointed to before.
 
RCPtroperator= (const RCPtr &p)
 Assignment.
 
template<typename UPtr >
RCPtroperator= (const UPtr &u)
 Assignment from class UPtr which has operator-> defined resulting in a value implicitly convertible to T *.
 
template<typename UPtr >
RCPtrassignDynamic (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 >
RCPtrassignConst (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.
 

Detailed Description

template<typename T>
class ThePEG::Pointer::RCPtr< T >

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.

See also
ReferenceCounted

Definition at line 60 of file RCPtr.h.

Member Typedef Documentation

◆ const_pointer

template<typename T>
typedef const T* ThePEG::Pointer::RCPtr< T >::const_pointer

Template argument typedef.

Definition at line 71 of file RCPtr.h.

◆ const_reference

template<typename T>
typedef const T& ThePEG::Pointer::RCPtr< T >::const_reference

Template argument typedef.

Definition at line 75 of file RCPtr.h.

◆ difference_type

template<typename T>
typedef void ThePEG::Pointer::RCPtr< T >::difference_type

Template argument typedef.

Definition at line 67 of file RCPtr.h.

◆ iterator_category

template<typename T>
typedef void ThePEG::Pointer::RCPtr< T >::iterator_category

Template argument typedef.

Definition at line 65 of file RCPtr.h.

◆ pointer

template<typename T>
typedef T* ThePEG::Pointer::RCPtr< T >::pointer

Template argument typedef.

Definition at line 69 of file RCPtr.h.

◆ reference

template<typename T>
typedef T& ThePEG::Pointer::RCPtr< T >::reference

Template argument typedef.

Definition at line 73 of file RCPtr.h.

◆ value_type

template<typename T>
typedef T ThePEG::Pointer::RCPtr< T >::value_type

Template argument typedef.

Definition at line 77 of file RCPtr.h.

Constructor & Destructor Documentation

◆ RCPtr()

template<typename T>
ThePEG::Pointer::RCPtr< T >::RCPtr ( )
inline

Constructor for null pointer.

Definition at line 85 of file RCPtr.h.

◆ ~RCPtr()

template<typename T>
ThePEG::Pointer::RCPtr< T >::~RCPtr ( )
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::RCPtrBase::release().


The documentation for this class was generated from the following file: