Public Member Functions | Private Types | Private Attributes
CountedRefWeakPtr< PtrType > Class Template Reference

#include <countedref.h>

Public Types

Name template arguments
typedef PtrType ptr_type
 
typedef CountedRefPtr< CountedRefIndirectPtr< ptr_type > * > ptrptr_type
 

Public Member Functions

 CountedRefWeakPtr ()
 Construct unassigned weak reference. More...
 
 CountedRefWeakPtr (ptr_type ptr)
 Convert from pointer. More...
 
 CountedRefWeakPtr (const self &rhs)
 Construct copy. More...
 
 ~CountedRefWeakPtr ()
 Unlink one reference (handled by CountedRefPtr) More...
 
void invalidate ()
 Mark weak reference as invalid. More...
 
bool unassigned () const
 Test whether reference was never used. More...
 
 operator bool () const
 Pointer-style interface. More...
 
selfoperator= (const self &rhs)
 Pointer-style interface. More...
 
selfoperator= (ptr_type ptr)
 Pointer-style interface. More...
 
bool operator== (ptr_type ptr) const
 Pointer-style interface. More...
 
bool operator!= (ptr_type rhs) const
 Pointer-style interface. More...
 
const ptr_type operator-> () const
 Pointer-style interface. More...
 
ptr_type operator-> ()
 Pointer-style interface. More...
 

Private Types

typedef CountedRefWeakPtr self
 

Private Attributes

ptrptr_type m_indirect
 

Detailed Description

template<class PtrType>
class CountedRefWeakPtr< PtrType >

Definition at line 134 of file countedref.h.

Member Typedef Documentation

◆ ptr_type

template<class PtrType>
typedef PtrType CountedRefWeakPtr< PtrType >::ptr_type

Definition at line 161 of file countedref.h.

◆ ptrptr_type

template<class PtrType>
typedef CountedRefPtr<CountedRefIndirectPtr<ptr_type>*> CountedRefWeakPtr< PtrType >::ptrptr_type

Definition at line 162 of file countedref.h.

◆ self

template<class PtrType>
typedef CountedRefWeakPtr CountedRefWeakPtr< PtrType >::self
private

Definition at line 155 of file countedref.h.

Constructor & Destructor Documentation

◆ CountedRefWeakPtr() [1/3]

template<class PtrType>
CountedRefWeakPtr< PtrType >::CountedRefWeakPtr ( )
inline

Construct unassigned weak reference.

Definition at line 166 of file countedref.h.

166 : m_indirect(NULL) { }
#define NULL
Definition: omList.c:10
ptrptr_type m_indirect
Definition: countedref.h:204

◆ CountedRefWeakPtr() [2/3]

template<class PtrType>
CountedRefWeakPtr< PtrType >::CountedRefWeakPtr ( ptr_type  ptr)
inline

Convert from pointer.

Definition at line 169 of file countedref.h.

◆ CountedRefWeakPtr() [3/3]

template<class PtrType>
CountedRefWeakPtr< PtrType >::CountedRefWeakPtr ( const self rhs)
inline

Construct copy.

Definition at line 172 of file countedref.h.

172 : m_indirect(rhs.m_indirect) { }
ptrptr_type m_indirect
Definition: countedref.h:204

◆ ~CountedRefWeakPtr()

template<class PtrType>
CountedRefWeakPtr< PtrType >::~CountedRefWeakPtr ( )
inline

Unlink one reference (handled by CountedRefPtr)

Definition at line 175 of file countedref.h.

175 { }

Member Function Documentation

◆ invalidate()

template<class PtrType>
void CountedRefWeakPtr< PtrType >::invalidate ( )
inline

Mark weak reference as invalid.

Definition at line 178 of file countedref.h.

178 { *this = NULL; }
#define NULL
Definition: omList.c:10

◆ operator bool()

template<class PtrType>
CountedRefWeakPtr< PtrType >::operator bool ( ) const
inline

Pointer-style interface.

Definition at line 184 of file countedref.h.

184 { return operator->(); }
const ptr_type operator->() const
Pointer-style interface.
Definition: countedref.h:200

◆ operator!=()

template<class PtrType>
bool CountedRefWeakPtr< PtrType >::operator!= ( ptr_type  rhs) const
inline

Pointer-style interface.

Definition at line 199 of file countedref.h.

199 { return !operator==(rhs); }
bool operator==(ptr_type ptr) const
Pointer-style interface.
Definition: countedref.h:196

◆ operator->() [1/2]

template<class PtrType>
const ptr_type CountedRefWeakPtr< PtrType >::operator-> ( ) const
inline

Pointer-style interface.

Definition at line 200 of file countedref.h.

200 { return (m_indirect? m_indirect->m_ptr: NULL); }
ptr_type m_ptr
Store actual pointer.
Definition: countedref.h:105
#define NULL
Definition: omList.c:10
ptrptr_type m_indirect
Definition: countedref.h:204

◆ operator->() [2/2]

template<class PtrType>
ptr_type CountedRefWeakPtr< PtrType >::operator-> ( )
inline

Pointer-style interface.

Definition at line 201 of file countedref.h.

201 { return (m_indirect? m_indirect->m_ptr:NULL); }
ptr_type m_ptr
Store actual pointer.
Definition: countedref.h:105
#define NULL
Definition: omList.c:10
ptrptr_type m_indirect
Definition: countedref.h:204

◆ operator=() [1/2]

template<class PtrType>
self& CountedRefWeakPtr< PtrType >::operator= ( const self rhs)
inline

Pointer-style interface.

Definition at line 185 of file countedref.h.

185  {
186  m_indirect = rhs.m_indirect;
187  return *this;
188  }
ptrptr_type m_indirect
Definition: countedref.h:204

◆ operator=() [2/2]

template<class PtrType>
self& CountedRefWeakPtr< PtrType >::operator= ( ptr_type  ptr)
inline

Pointer-style interface.

Definition at line 189 of file countedref.h.

189  {
190  if (!m_indirect)
192  else
193  m_indirect->m_ptr = ptr;
194  return *this;
195  }
ptr_type m_ptr
Store actual pointer.
Definition: countedref.h:105
ptrptr_type m_indirect
Definition: countedref.h:204

◆ operator==()

template<class PtrType>
bool CountedRefWeakPtr< PtrType >::operator== ( ptr_type  ptr) const
inline

Pointer-style interface.

Definition at line 196 of file countedref.h.

196  {
197  return m_indirect &&(m_indirect->m_ptr == ptr);
198  }
ptr_type m_ptr
Store actual pointer.
Definition: countedref.h:105
ptrptr_type m_indirect
Definition: countedref.h:204

◆ unassigned()

template<class PtrType>
bool CountedRefWeakPtr< PtrType >::unassigned ( ) const
inline

Test whether reference was never used.

Definition at line 181 of file countedref.h.

181 { return !m_indirect; }
ptrptr_type m_indirect
Definition: countedref.h:204

Field Documentation

◆ m_indirect

template<class PtrType>
ptrptr_type CountedRefWeakPtr< PtrType >::m_indirect
private

Definition at line 204 of file countedref.h.


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