Nebula
Loading...
Searching...
No Matches
WeakPtr< TYPE > Class Template Reference

#include <weakptr.h>

Detailed Description

template<class TYPE>
class WeakPtr< TYPE >

A smart pointer which does not change the reference count of the target object.

Use this to prevent cyclic dependencies between objects. NOTE: The weak ptr only has a subset of methods of Ptr<>.

Public Member Functions

 WeakPtr ()
 constructor
 
 WeakPtr (TYPE *p)
 construct from C++ pointer
 
 WeakPtr (const Ptr< TYPE > &p)
 construct from Ptr<> pointer
 
 WeakPtr (const WeakPtr< TYPE > &p)
 construct from WeakPtr<> pointer
 
 ~WeakPtr ()
 destructor
 
void operator= (const Ptr< TYPE > &rhs)
 assignment operator from Ptr<>
 
void operator= (const WeakPtr< TYPE > &rhs)
 assignment operator from WeakPtr<>
 
void operator= (TYPE *rhs)
 assignment operator
 
TYPE * operator-> () const
 safe -> operator
 
TYPE & operator* () const
 safe dereference operator
 
 operator TYPE * () const
 safe pointer cast operator
 
bool isvalid () const
 check if pointer is valid
 
TYPE * get () const
 return direct pointer (asserts if null pointer)
 
TYPE * get_unsafe () const
 return direct pointer (returns null pointer)
 

Private Attributes

TYPE * ptr
 

Constructor & Destructor Documentation

◆ WeakPtr() [1/4]

template<class TYPE >
WeakPtr< TYPE >::WeakPtr ( )

constructor

◆ WeakPtr() [2/4]

template<class TYPE >
WeakPtr< TYPE >::WeakPtr ( TYPE * p)

construct from C++ pointer

◆ WeakPtr() [3/4]

template<class TYPE >
WeakPtr< TYPE >::WeakPtr ( const Ptr< TYPE > & p)

construct from Ptr<> pointer

◆ WeakPtr() [4/4]

template<class TYPE >
WeakPtr< TYPE >::WeakPtr ( const WeakPtr< TYPE > & p)

construct from WeakPtr<> pointer

◆ ~WeakPtr()

template<class TYPE >
WeakPtr< TYPE >::~WeakPtr ( )

destructor

Member Function Documentation

◆ get()

template<class TYPE >
TYPE * WeakPtr< TYPE >::get ( ) const

return direct pointer (asserts if null pointer)

◆ get_unsafe()

template<class TYPE >
TYPE * WeakPtr< TYPE >::get_unsafe ( ) const

return direct pointer (returns null pointer)

◆ isvalid()

template<class TYPE >
bool WeakPtr< TYPE >::isvalid ( ) const

check if pointer is valid

◆ operator TYPE *()

template<class TYPE >
WeakPtr< TYPE >::operator TYPE * ( ) const

safe pointer cast operator

◆ operator*()

template<class TYPE >
TYPE & WeakPtr< TYPE >::operator* ( ) const

safe dereference operator

◆ operator->()

template<class TYPE >
TYPE * WeakPtr< TYPE >::operator-> ( ) const

safe -> operator

◆ operator=() [1/3]

template<class TYPE >
void WeakPtr< TYPE >::operator= ( const Ptr< TYPE > & rhs)

assignment operator from Ptr<>

◆ operator=() [2/3]

template<class TYPE >
void WeakPtr< TYPE >::operator= ( const WeakPtr< TYPE > & rhs)

assignment operator from WeakPtr<>

◆ operator=() [3/3]

template<class TYPE >
void WeakPtr< TYPE >::operator= ( TYPE * rhs)

assignment operator

Member Data Documentation

◆ ptr

template<class TYPE >
TYPE* WeakPtr< TYPE >::ptr
private

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