nux-0.9.48

nux::GenericSP< T > Class Template Reference

A smart pointer class. Implemented as an intrusive smart pointer. More...

#include <NuxCore/SmartPtr/GenericSmartPointer.h>

Public Member Functions

 GenericSP ()
 Constructor.
 GenericSP (const GenericSP< T > &other)
 Copy constructor.
template<typename O >
 GenericSP (const GenericSP< O > &other)
 Copy constructor.
 GenericSP (T *ptr, bool deletewhenrefcounthitzero=true)
 Construction with a base pointer of type T.
template<typename O >
 GenericSP (O *ptr, bool deletewhenrefcounthitzero=true)
 Construction with a base pointer of type O that inherits from type T.
GenericSPoperator= (const GenericSP< T > &other)
 Assignment of a smart pointer of type T.
template<typename O >
GenericSPoperator= (const GenericSP< O > &other)
 Assignment of a smart pointer of type O that inherits from type T.
 ~GenericSP ()
T & operator* () const
T * operator-> () const
void Swap (GenericSP< T > &other)
 Swap the content of 2 smart pointers.
bool operator() () const
 Test validity of the smart pointer.
bool IsNull () const
 Test validity of the smart pointer.
bool IsValid () const
 Test validity of the smart pointer.
bool operator< (T *ptr) const
bool operator> (T *ptr) const
bool operator< (GenericSP< T > other) const
bool operator> (GenericSP< T > other) const
bool operator!= (T *ptr) const
bool operator== (T *ptr) const
template<typename U >
bool operator!= (U *ptr) const
template<typename U >
bool operator== (U *ptr) const
template<typename U >
bool operator!= (const GenericSP< U > &other) const
template<typename U >
bool operator== (const GenericSP< U > &other) const
template<typename U >
bool operator!= (const GenericWeakSP< U > &other) const
template<typename U >
bool operator== (const GenericWeakSP< U > &other) const
void Release ()

Friends

class GenericSP
class GenericWeakSP
template<typename U >
GenericSP< U > Create ()
template<typename U , typename P1 >
GenericSP< U > Create (P1 p1)
template<typename U , typename P1 , typename P2 >
GenericSP< U > Create (P1 p1, P2 p2)
template<typename U , typename P1 , typename P2 , typename P3 >
GenericSP< U > Create (P1 p1, P2 p2, P3 p3)
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 >
GenericSP< U > Create (P1 p1, P2 p2, P3 p3, P4 p4)
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
GenericSP< U > Create (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
GenericSP< U > Create (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
GenericSP< U > Create (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
template<typename U >
GenericSP< U > WrapWSPtr (U *u)
template<typename U >
bool operator== (U *, const GenericSP< U > &a)
template<typename U >
bool operator!= (U *, const GenericSP< U > &a)
template<typename U , typename F >
GenericSP< U > staticCast (const GenericSP< F > &from)
template<typename U , typename F >
GenericSP< U > constCast (const GenericSP< F > &from)
template<typename U , typename F >
GenericSP< U > dynamicCast (const GenericSP< F > &from)
template<typename U , typename F >
GenericSP< U > checkedCast (const GenericSP< F > &from)
template<typename U , typename F >
GenericSP< U > queryCast (const GenericSP< F > &from)

Detailed Description

template<typename T>
class nux::GenericSP< T >

A smart pointer class. Implemented as an intrusive smart pointer.


Constructor & Destructor Documentation

template<typename T>
nux::GenericSP< T >::GenericSP ( ) [inline]

Constructor.

template<typename T>
nux::GenericSP< T >::GenericSP ( const GenericSP< T > &  other) [inline]
template<typename T>
template<typename O >
nux::GenericSP< T >::GenericSP ( const GenericSP< O > &  other) [inline]

Copy constructor.

Parameters:
otherParameter with a type derived from T.

References nux::NThreadSafeCounter::Increment(), nux::RefCounts::strongRefs_, and nux::RefCounts::totalRefs_.

template<typename T>
nux::GenericSP< T >::GenericSP ( T *  ptr,
bool  deletewhenrefcounthitzero = true 
) [inline, explicit]

Construction with a base pointer of type T.

Parameters:
ptrStart maintaining a reference count of the passed pointer.
deletewhenrefcounthitzeroif True, the pointer is deleted when the ref count reach 0 (to be deprecated).
template<typename T>
template<typename O >
nux::GenericSP< T >::GenericSP ( O *  ptr,
bool  deletewhenrefcounthitzero = true 
) [inline, explicit]

Construction with a base pointer of type O that inherits from type T.

Parameters:
ptrStart maintaining a reference count of the passed pointer.
deletewhenrefcounthitzeroif True, the pointer is deleted when the ref count reach 0 (to be deprecated).

References nuxAssert.

template<typename T>
nux::GenericSP< T >::~GenericSP ( ) [inline]

Member Function Documentation

template<typename T>
bool nux::GenericSP< T >::IsNull ( ) const [inline]

Test validity of the smart pointer.

Return True if the internal pointer is null.

template<typename T>
bool nux::GenericSP< T >::IsValid ( ) const [inline]

Test validity of the smart pointer.

Return True if the internal pointer is not null.

template<typename T>
template<typename U >
bool nux::GenericSP< T >::operator!= ( const GenericSP< U > &  other) const [inline]
template<typename T>
template<typename U >
bool nux::GenericSP< T >::operator!= ( const GenericWeakSP< U > &  other) const [inline]
template<typename T>
bool nux::GenericSP< T >::operator!= ( T *  ptr) const [inline]
template<typename T>
template<typename U >
bool nux::GenericSP< T >::operator!= ( U *  ptr) const [inline]
template<typename T>
bool nux::GenericSP< T >::operator() ( ) const [inline]

Test validity of the smart pointer.

Return True if the internal pointer is not null.

template<typename T>
T& nux::GenericSP< T >::operator* ( void  ) const [inline]

References nuxAssert.

template<typename T>
T* nux::GenericSP< T >::operator-> ( ) const [inline]

References nuxAssert.

template<typename T>
bool nux::GenericSP< T >::operator< ( T *  ptr) const [inline]
template<typename T>
bool nux::GenericSP< T >::operator< ( GenericSP< T >  other) const [inline]
template<typename T>
template<typename O >
GenericSP& nux::GenericSP< T >::operator= ( const GenericSP< O > &  other) [inline]

Assignment of a smart pointer of type O that inherits from type T.

Parameters:
otherSmart pointer of type O.

References nux::NThreadSafeCounter::Increment(), nux::RefCounts::strongRefs_, and nux::RefCounts::totalRefs_.

template<typename T>
GenericSP& nux::GenericSP< T >::operator= ( const GenericSP< T > &  other) [inline]

Assignment of a smart pointer of type T.

Parameters:
otherSmart pointer of type T.

References nux::NThreadSafeCounter::Increment(), nux::RefCounts::strongRefs_, and nux::RefCounts::totalRefs_.

template<typename T>
bool nux::GenericSP< T >::operator== ( T *  ptr) const [inline]
template<typename T>
template<typename U >
bool nux::GenericSP< T >::operator== ( const GenericSP< U > &  other) const [inline]
template<typename T>
template<typename U >
bool nux::GenericSP< T >::operator== ( const GenericWeakSP< U > &  other) const [inline]
template<typename T>
template<typename U >
bool nux::GenericSP< T >::operator== ( U *  ptr) const [inline]
template<typename T>
bool nux::GenericSP< T >::operator> ( T *  ptr) const [inline]
template<typename T>
bool nux::GenericSP< T >::operator> ( GenericSP< T >  other) const [inline]
template<typename T>
void nux::GenericSP< T >::Release ( ) [inline]
template<typename T>
void nux::GenericSP< T >::Swap ( GenericSP< T > &  other) [inline]

Swap the content of 2 smart pointers.

Parameters:
otherSmart pointer to swap with.

References nux::swap().


Friends And Related Function Documentation

template<typename T>
template<typename U , typename F >
GenericSP<U> checkedCast ( const GenericSP< F > &  from) [friend]
template<typename T>
template<typename U , typename F >
GenericSP<U> constCast ( const GenericSP< F > &  from) [friend]
template<typename T>
template<typename U , typename P1 >
GenericSP<U> Create ( P1  p1) [friend]
template<typename T>
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
GenericSP<U> Create ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
) [friend]
template<typename T>
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 >
GenericSP<U> Create ( P1  p1,
P2  p2,
P3  p3,
P4  p4 
) [friend]
template<typename T>
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
GenericSP<U> Create ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6 
) [friend]
template<typename T>
template<typename U , typename P1 , typename P2 >
GenericSP<U> Create ( P1  p1,
P2  p2 
) [friend]
template<typename T>
template<typename U , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
GenericSP<U> Create ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7 
) [friend]
template<typename T>
template<typename U >
GenericSP<U> Create ( ) [friend]
template<typename T>
template<typename U , typename P1 , typename P2 , typename P3 >
GenericSP<U> Create ( P1  p1,
P2  p2,
P3  p3 
) [friend]
template<typename T>
template<typename U , typename F >
GenericSP<U> dynamicCast ( const GenericSP< F > &  from) [friend]
template<typename T>
friend class GenericSP [friend]
template<typename T>
friend class GenericWeakSP [friend]
template<typename T>
template<typename U >
bool operator!= ( U *  ,
const GenericSP< U > &  a 
) [friend]
template<typename T>
template<typename U >
bool operator== ( U *  ,
const GenericSP< U > &  a 
) [friend]
template<typename T>
template<typename U , typename F >
GenericSP<U> queryCast ( const GenericSP< F > &  from) [friend]
template<typename T>
template<typename U , typename F >
GenericSP<U> staticCast ( const GenericSP< F > &  from) [friend]
template<typename T>
template<typename U >
GenericSP<U> WrapWSPtr ( U *  u) [friend]

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