CL_WeakPtr< Type > Class Template Reference
[clanCore System]

Weak pointer class (pointer to a CL_SharedPtr object that dont increase reference count). More...

#include <weakptr.h>

Inheritance diagram for CL_WeakPtr< Type >:

CL_SharedPtr_Link List of all members.

Public Member Functions

 CL_WeakPtr ()
 CL_WeakPtr (const CL_WeakPtr< Type > &copy)
 CL_WeakPtr (const CL_SharedPtr< Type > &copy)
 CL_WeakPtr (const CL_UnknownSharedPtr &copy)
 ~CL_WeakPtr ()
CL_WeakPtroperator= (const CL_UnknownSharedPtr &copy)
CL_WeakPtroperator= (const CL_SharedPtr< Type > &copy)
CL_WeakPtroperator= (const CL_WeakPtr &copy)
bool disconnect ()
 Disconnect from linked list and unset the pointer.
bool is_null () const
 Tests if the pointer is unset, or the weak link is no longer valid.
Type * get ()
 Retrieves the pointer.
const Type * get () const
 Retrieves the pointer.
CL_UnknownSharedPtr to_unknownptr () const
CL_SharedPtr< Type > to_sharedptr () const
 operator Type * ()
 operator const Type * () const
 operator CL_UnknownSharedPtr ()
 operator CL_UnknownSharedPtr () const
 operator CL_SharedPtr ()
 operator CL_SharedPtr () const
Type * operator-> ()
const Type * operator-> () const
template<typename OtherType>
bool operator== (OtherType *other) const
template<typename OtherType>
bool operator!= (OtherType *other) const
template<typename OtherType>
bool operator< (OtherType *other) const
template<typename OtherType>
bool operator<= (OtherType *other) const
template<typename OtherType>
bool operator> (OtherType *other) const
template<typename OtherType>
bool operator>= (OtherType *other) const
template<typename Type>
void create_deleter (Type *instance)
template<typename Type>
void create_deleter (Type *ptr, CL_MemoryPool *pool)
template<typename Type>
void create_deleter (Type *ptr, void(*free_callback)(Type *ptr))
template<typename Type, typename FreeClass>
void create_deleter (Type *ptr, FreeClass *free_class, void(FreeClass::*free_callback)(Type *ptr))
void call_deleter ()
void connect (const CL_SharedPtr_Link &copy)
void set_weak_link ()
bool is_invalid_weak_link () const

Public Attributes

Type * ptr
CL_Mutexmutex

Detailed Description

template<typename Type>
class CL_WeakPtr< Type >

Weak pointer class (pointer to a CL_SharedPtr object that dont increase reference count).

Use CL_WeakPtr when you want to have a pointer that is reference counted by CL_SharedPtr but want a pointer that dont increase the reference count.

The purpose of CL_WeakPtr is to avoid circular loop issues. By using CL_WeakPtr you can construct new CL_SharedPtr'ed objects based on the weak pointer.


Constructor & Destructor Documentation

template<typename Type>
CL_WeakPtr< Type >::CL_WeakPtr  )  [inline]
 

template<typename Type>
CL_WeakPtr< Type >::CL_WeakPtr const CL_WeakPtr< Type > &  copy  )  [inline]
 

template<typename Type>
CL_WeakPtr< Type >::CL_WeakPtr const CL_SharedPtr< Type > &  copy  )  [inline, explicit]
 

template<typename Type>
CL_WeakPtr< Type >::CL_WeakPtr const CL_UnknownSharedPtr copy  )  [inline, explicit]
 

template<typename Type>
CL_WeakPtr< Type >::~CL_WeakPtr  )  [inline]
 


Member Function Documentation

void CL_SharedPtr_Link::call_deleter  )  [inline, inherited]
 

void CL_SharedPtr_Link::connect const CL_SharedPtr_Link copy  )  [inline, inherited]
 

template<typename Type, typename FreeClass>
void CL_SharedPtr_Link::create_deleter Type *  ptr,
FreeClass *  free_class,
void(FreeClass::*)(Type *ptr)  free_callback
[inline, inherited]
 

template<typename Type>
void CL_SharedPtr_Link::create_deleter Type *  ptr,
void(*)(Type *ptr)  free_callback
[inline, inherited]
 

template<typename Type>
void CL_SharedPtr_Link::create_deleter Type *  ptr,
CL_MemoryPool pool
[inline, inherited]
 

template<typename Type>
void CL_SharedPtr_Link::create_deleter Type *  instance  )  [inline, inherited]
 

template<typename Type>
bool CL_WeakPtr< Type >::disconnect  )  [inline]
 

Disconnect from linked list and unset the pointer.

Returns:
true if the list is empty or only contains weak links

Reimplemented from CL_SharedPtr_Link.

template<typename Type>
const Type* CL_WeakPtr< Type >::get  )  const [inline]
 

Retrieves the pointer.

Returns:
The pointer (May be NULL, if it has not been set or the weak link is no longer valid)

template<typename Type>
Type* CL_WeakPtr< Type >::get  )  [inline]
 

Retrieves the pointer.

Returns:
The pointer (May be NULL, if it has not been set or the weak link is no longer valid)

bool CL_SharedPtr_Link::is_invalid_weak_link  )  const [inline, inherited]
 

template<typename Type>
bool CL_WeakPtr< Type >::is_null  )  const [inline]
 

Tests if the pointer is unset, or the weak link is no longer valid.

Returns:
true, pointer not set (or not valid)

template<typename Type>
CL_WeakPtr< Type >::operator CL_SharedPtr  )  const [inline]
 

template<typename Type>
CL_WeakPtr< Type >::operator CL_SharedPtr  )  [inline]
 

template<typename Type>
CL_WeakPtr< Type >::operator CL_UnknownSharedPtr  )  const [inline]
 

template<typename Type>
CL_WeakPtr< Type >::operator CL_UnknownSharedPtr  )  [inline]
 

template<typename Type>
CL_WeakPtr< Type >::operator const Type *  )  const [inline]
 

template<typename Type>
CL_WeakPtr< Type >::operator Type *  )  [inline]
 

template<typename Type>
template<typename OtherType>
bool CL_WeakPtr< Type >::operator!= OtherType *  other  )  const [inline]
 

template<typename Type>
const Type* CL_WeakPtr< Type >::operator->  )  const [inline]
 

template<typename Type>
Type* CL_WeakPtr< Type >::operator->  )  [inline]
 

template<typename Type>
template<typename OtherType>
bool CL_WeakPtr< Type >::operator< OtherType *  other  )  const [inline]
 

template<typename Type>
template<typename OtherType>
bool CL_WeakPtr< Type >::operator<= OtherType *  other  )  const [inline]
 

template<typename Type>
CL_WeakPtr& CL_WeakPtr< Type >::operator= const CL_WeakPtr< Type > &  copy  )  [inline]
 

template<typename Type>
CL_WeakPtr& CL_WeakPtr< Type >::operator= const CL_SharedPtr< Type > &  copy  )  [inline]
 

template<typename Type>
CL_WeakPtr& CL_WeakPtr< Type >::operator= const CL_UnknownSharedPtr copy  )  [inline]
 

template<typename Type>
template<typename OtherType>
bool CL_WeakPtr< Type >::operator== OtherType *  other  )  const [inline]
 

template<typename Type>
template<typename OtherType>
bool CL_WeakPtr< Type >::operator> OtherType *  other  )  const [inline]
 

template<typename Type>
template<typename OtherType>
bool CL_WeakPtr< Type >::operator>= OtherType *  other  )  const [inline]
 

void CL_SharedPtr_Link::set_weak_link  )  [inline, inherited]
 

template<typename Type>
CL_SharedPtr<Type> CL_WeakPtr< Type >::to_sharedptr  )  const [inline]
 

template<typename Type>
CL_UnknownSharedPtr CL_WeakPtr< Type >::to_unknownptr  )  const [inline]
 


Member Data Documentation

CL_Mutex* CL_SharedPtr_Link::mutex [mutable, inherited]
 

template<typename Type>
Type* CL_WeakPtr< Type >::ptr
 


The documentation for this class was generated from the following file:
Generated on Thu Dec 3 02:39:43 2009 for ClanLib by  doxygen 1.4.6