bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
agg_util::WeakRCPtr< T > Class Template Reference

#include <RCObject.h>

Inheritance diagram for agg_util::WeakRCPtr< T >:
Inheritance graph
Collaboration diagram for agg_util::WeakRCPtr< T >:
Collaboration graph

Public Member Functions

void clear ()
 
bool empty () const
 
virtual void executeUseCountHitZeroCB (RCObject *pAboutToDie)
 
bool expired () const
 
RCPtr< T > lock () const
 
WeakRCPtroperator= (const WeakRCPtr &r)
 
 WeakRCPtr ()
 
 WeakRCPtr (RCPtr< T > src)
 

Detailed Description

template<class T>
class agg_util::WeakRCPtr< T >

A variant of boost::weak_ptr that uses our intrusive RCObject counting.

WeakRCPtr<T> is used to refer weakly to a class T where T inherits from RCObject.

NOTE: These are NOT thread-safe!!

By weak we mean that RCWeakPtr<T> does not change the use count of the wrapped object. Also it may transition from containing a valid ptr to containing NULL if the RCObject it wraps is deleted by its use count going to 0. Therefore, similarly to boost::weak_ptr, a lock() function is provided to return a new RCPtr<T> for the object which ups its ref count and therefore maintains the life of the object for the duration of the use of the ptr returned from lock().

get() is provided as access to the raw ptr BUT NOTE THAT IT IS NOT SAFE. The memory may go away during the use of the returned ptr, so lock() is the preferred method to get the resource. get() is useful for checking for null of the wrapped ptr.

Definition at line 412 of file RCObject.h.

Constructor & Destructor Documentation

◆ WeakRCPtr() [1/2]

template<class T>
agg_util::WeakRCPtr< T >::WeakRCPtr ( )
inline

Default contains NULL

Definition at line 418 of file RCObject.h.

◆ WeakRCPtr() [2/2]

template<class T>
agg_util::WeakRCPtr< T >::WeakRCPtr ( RCPtr< T > src)
inlineexplicit

Definition at line 423 of file RCObject.h.

◆ ~WeakRCPtr()

template<class T>
agg_util::WeakRCPtr< T >::~WeakRCPtr ( )
inline

Definition at line 430 of file RCObject.h.

Member Function Documentation

◆ clear()

template<class T>
void agg_util::WeakRCPtr< T >::clear ( )
inline

Remove any listener and NULL the wrapped pointer. On Exit: expired()

Definition at line 472 of file RCObject.h.

◆ empty()

template<class T>
bool agg_util::WeakRCPtr< T >::empty ( ) const
inline

Will getting a lock() return a null?

Definition at line 452 of file RCObject.h.

◆ executeUseCountHitZeroCB()

template<class T>
virtual void agg_util::WeakRCPtr< T >::executeUseCountHitZeroCB ( RCObject * pAboutToDie)
inlinevirtual

Listener callback from the RCObject to implement the interface. This is called when the wrapped RCObject ref count goes to 0 so we can safely disconnect.

Implements agg_util::UseCountHitZeroCB.

Definition at line 487 of file RCObject.h.

◆ expired()

template<class T>
bool agg_util::WeakRCPtr< T >::expired ( ) const
inline

Will getting a lock() return a null?

Definition at line 446 of file RCObject.h.

◆ lock()

template<class T>
RCPtr< T > agg_util::WeakRCPtr< T >::lock ( ) const
inline

Definition at line 457 of file RCObject.h.

◆ operator=()

template<class T>
WeakRCPtr & agg_util::WeakRCPtr< T >::operator= ( const WeakRCPtr< T > & r)
inline

Definition at line 435 of file RCObject.h.


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