Public Member Functions | Protected Types | Protected Member Functions

nsCountedRef< T > Class Template Reference

template <class t>=""> class nsCountedRef More...

#include <nsAutoRef.h>

Inheritance diagram for nsCountedRef< T >:
Collaboration diagram for nsCountedRef< T >:

List of all members.

Public Member Functions

 nsCountedRef ()
 nsCountedRef (const ThisClass &aRefToCopy)
ThisClassoperator= (const ThisClass &aRefToCopy)
 nsCountedRef (RawRef aRefToCopy)
ThisClassoperator= (RawRef aRefToCopy)
 nsCountedRef (const nsReturningRef< T > &aReturning)
ThisClassoperator= (const nsReturningRef< T > &aReturning)

Protected Types

typedef nsCountedRef< T > ThisClass
typedef nsAutoRef< T > BaseClass
typedef nsSimpleRef< T > SimpleRef
typedef BaseClass::RawRef RawRef

Protected Member Functions

void SafeAddRef ()

Detailed Description

template<class T>
class nsCountedRef< T >

template <class t>=""> class nsCountedRef

A class that creates (adds) a new reference to a resource on construction or assignment and releases on destruction.

This class is similar to nsAutoRef<T> and inherits its methods, but also provides copy construction and assignment operators that enable more than one concurrent reference to the same resource.

Specialize |nsAutoRefTraits<T>| or |nsSimpleRef<T>| to use this. This class assumes that the resource itself counts references and so can only be used when |T| represents a reference-counting resource.


Member Typedef Documentation

template<class T >
typedef nsAutoRef<T> nsCountedRef< T >::BaseClass [protected]

Reimplemented from nsAutoRef< T >.

template<class T >
typedef BaseClass::RawRef nsCountedRef< T >::RawRef [protected]

Reimplemented from nsAutoRefBase< T >.

template<class T >
typedef nsSimpleRef<T> nsCountedRef< T >::SimpleRef [protected]

Reimplemented from nsAutoRef< T >.

template<class T >
typedef nsCountedRef<T> nsCountedRef< T >::ThisClass [protected]

Reimplemented from nsAutoRef< T >.


Constructor & Destructor Documentation

template<class T >
nsCountedRef< T >::nsCountedRef (  )  [inline]
template<class T >
nsCountedRef< T >::nsCountedRef ( const ThisClass aRefToCopy  )  [inline]
template<class T >
nsCountedRef< T >::nsCountedRef ( RawRef  aRefToCopy  )  [inline, explicit]
template<class T >
nsCountedRef< T >::nsCountedRef ( const nsReturningRef< T > &  aReturning  )  [inline, explicit]

Member Function Documentation

template<class T >
ThisClass& nsCountedRef< T >::operator= ( const ThisClass aRefToCopy  )  [inline]
template<class T >
ThisClass& nsCountedRef< T >::operator= ( RawRef  aRefToCopy  )  [inline]
template<class T >
ThisClass& nsCountedRef< T >::operator= ( const nsReturningRef< T > &  aReturning  )  [inline]

Reimplemented from nsAutoRef< T >.

template<class T >
void nsCountedRef< T >::SafeAddRef (  )  [inline, protected]

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