sqrat  0.9
sqrat
 All Classes Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
Sqrat::SharedPtr< T > Class Template Reference

#include <sqratUtil.h>

Public Member Functions

 SharedPtr ()
 
 SharedPtr (T *ptr)
 
template<class U >
 SharedPtr (U *ptr)
 
 SharedPtr (const SharedPtr< T > &copy)
 
template<class U >
 SharedPtr (const SharedPtr< U > &copy)
 
 ~SharedPtr ()
 
SharedPtr< T > & operator= (const SharedPtr< T > &copy)
 
template<class U >
SharedPtr< T > & operator= (const SharedPtr< U > &copy)
 
void Init (T *ptr)
 
template<class U >
void Init (U *ptr)
 
void Reset ()
 
 operator bool () const
 
bool operator! () const
 
template<typename U >
bool operator== (const SharedPtr< U > &right) const
 
bool operator== (const SharedPtr< T > &right) const
 
template<typename U >
bool friend operator== (const SharedPtr< T > &left, const U *right)
 
bool friend operator== (const SharedPtr< T > &left, const T *right)
 
template<typename U >
bool friend operator== (const U *left, const SharedPtr< T > &right)
 
bool friend operator== (const T *left, const SharedPtr< T > &right)
 
template<typename U >
bool operator!= (const SharedPtr< U > &right) const
 
bool operator!= (const SharedPtr< T > &right) const
 
template<typename U >
bool friend operator!= (const SharedPtr< T > &left, const U *right)
 
bool friend operator!= (const SharedPtr< T > &left, const T *right)
 
template<typename U >
bool friend operator!= (const U *left, const SharedPtr< T > &right)
 
bool friend operator!= (const T *left, const SharedPtr< T > &right)
 
T & operator* () const
 
T * operator-> () const
 
T * Get () const
 

Detailed Description

template<class T>
class Sqrat::SharedPtr< T >

A smart pointer that retains shared ownership of an object through a pointer (see std::shared_ptr)

Template Parameters
TType of pointer
Remarks
SharedPtr exists to automatically delete an object when all references to it are destroyed.
std::shared_ptr was not used because it is a C++11 feature.

Constructor & Destructor Documentation

template<class T>
Sqrat::SharedPtr< T >::SharedPtr ( )
inline

Constructs a new SharedPtr

template<class T>
Sqrat::SharedPtr< T >::SharedPtr ( T *  ptr)
inline

Constructs a new SharedPtr from an object allocated with the new operator

Parameters
ptrShould be the return value from a call to the new operator
template<class T>
template<class U >
Sqrat::SharedPtr< T >::SharedPtr ( U *  ptr)
inline

Constructs a new SharedPtr from an object allocated with the new operator

Parameters
ptrShould be the return value from a call to the new operator
Template Parameters
UType of pointer (usually doesnt need to be defined explicitly)
template<class T>
Sqrat::SharedPtr< T >::SharedPtr ( const SharedPtr< T > &  copy)
inline

Copy constructor

Parameters
copySharedPtr to copy
template<class T>
template<class U >
Sqrat::SharedPtr< T >::SharedPtr ( const SharedPtr< U > &  copy)
inline

Copy constructor

Parameters
copySharedPtr to copy
Template Parameters
UType of copy (usually doesnt need to be defined explicitly)
template<class T>
Sqrat::SharedPtr< T >::~SharedPtr ( )
inline

Destructs the owned object if no more SharedPtr link to it

Member Function Documentation

template<class T>
T* Sqrat::SharedPtr< T >::Get ( ) const
inline

Gets the underlying pointer

Returns
Pointer to the managed object
template<class T>
void Sqrat::SharedPtr< T >::Init ( T *  ptr)
inline

Sets up a new object to be managed by the SharedPtr

Parameters
ptrShould be the return value from a call to the new operator
template<class T>
template<class U >
void Sqrat::SharedPtr< T >::Init ( U *  ptr)
inline

Sets up a new object to be managed by the SharedPtr

Parameters
ptrShould be the return value from a call to the new operator
Template Parameters
UType of copy (usually doesnt need to be defined explicitly)
template<class T>
Sqrat::SharedPtr< T >::operator bool ( ) const
inline

Checks if there is an associated managed object

template<class T>
bool Sqrat::SharedPtr< T >::operator! ( ) const
inline

Checks if there is NOT an associated managed object

template<class T>
template<typename U >
bool Sqrat::SharedPtr< T >::operator!= ( const SharedPtr< U > &  right) const
inline

Compares with another SharedPtr

template<class T>
bool Sqrat::SharedPtr< T >::operator!= ( const SharedPtr< T > &  right) const
inline

Compares with another SharedPtr

template<class T>
template<typename U >
bool friend Sqrat::SharedPtr< T >::operator!= ( const SharedPtr< T > &  left,
const U *  right 
)
inline

Compares with another pointer

template<class T>
bool friend Sqrat::SharedPtr< T >::operator!= ( const SharedPtr< T > &  left,
const T *  right 
)
inline

Compares with another pointer

template<class T>
template<typename U >
bool friend Sqrat::SharedPtr< T >::operator!= ( const U *  left,
const SharedPtr< T > &  right 
)
inline

Compares with another pointer

template<class T>
bool friend Sqrat::SharedPtr< T >::operator!= ( const T *  left,
const SharedPtr< T > &  right 
)
inline

Compares with another pointer

template<class T>
T& Sqrat::SharedPtr< T >::operator* ( ) const
inline

Dereferences pointer to the managed object

template<class T>
T* Sqrat::SharedPtr< T >::operator-> ( ) const
inline

Dereferences pointer to the managed object

template<class T>
SharedPtr<T>& Sqrat::SharedPtr< T >::operator= ( const SharedPtr< T > &  copy)
inline

Assigns the SharedPtr

Parameters
copySharedPtr to copy
Returns
The SharedPtr itself
template<class T>
template<class U >
SharedPtr<T>& Sqrat::SharedPtr< T >::operator= ( const SharedPtr< U > &  copy)
inline

Assigns the SharedPtr

Parameters
copySharedPtr to copy
Template Parameters
UType of copy (usually doesnt need to be defined explicitly)
Returns
The SharedPtr itself
template<class T>
template<typename U >
bool Sqrat::SharedPtr< T >::operator== ( const SharedPtr< U > &  right) const
inline

Compares with another SharedPtr

template<class T>
bool Sqrat::SharedPtr< T >::operator== ( const SharedPtr< T > &  right) const
inline

Compares with another SharedPtr

template<class T>
template<typename U >
bool friend Sqrat::SharedPtr< T >::operator== ( const SharedPtr< T > &  left,
const U *  right 
)
inline

Compares with another pointer

template<class T>
bool friend Sqrat::SharedPtr< T >::operator== ( const SharedPtr< T > &  left,
const T *  right 
)
inline

Compares with another pointer

template<class T>
template<typename U >
bool friend Sqrat::SharedPtr< T >::operator== ( const U *  left,
const SharedPtr< T > &  right 
)
inline

Compares with another pointer

template<class T>
bool friend Sqrat::SharedPtr< T >::operator== ( const T *  left,
const SharedPtr< T > &  right 
)
inline

Compares with another pointer

template<class T>
void Sqrat::SharedPtr< T >::Reset ( )
inline

Clears the owned object for this SharedPtr and deletes it if no more SharedPtr link to it


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