RefCountedPtr< T > Class Template Reference

Class Definition of RefCountedPtr, a smart pointer to reference counted objects. References to reference counted objects are Retain()d and Release()d as RefCountedPtrs are constructed, copied, assigned, and deleted. More...

List of all members.

Public Member Functions

bool IsNull () const
 Indicates if this RefCountedPtr points to NULL.
bool operator!= (const RefCountedPtr &in_rhs) const
 != comparison of the internal pointers of two RefCountedPtrs
bool operator!= (const T *in_rhs) const
 != comparison of the internal pointer of this RefCountedPtrs to a pointer to an object of T
T & operator* () const
 Dereference operator to obtain a reference to the referenced T. Be careful that this instance does not reference a NULL pointer.
T * operator-> () const
 Member by pointer operator to access T's members.
bool operator< (const RefCountedPtr &in_rhs) const
 < comparison of the internal pointers of two RefCountedPtrs (This is necessary for containing RefCountedPtr in a std::map)
RefCountedPtroperator= (const RefCountedPtr &in_autoRefCountedPtr)
 Copy an RefCountedPtr to re-assign what is being referenced. Releases a reference from the currently referenced object and Retains a reference to the newly referenced object.
bool operator== (const RefCountedPtr &in_rhs) const
 == comparison of the internal pointers of two RefCountedPtrs
bool operator== (const T *in_rhs) const
 == comparison of the internal pointer of this RefCountedPtrs to a pointer to an object of T
 RefCountedPtr (const RefCountedPtr &in_autoRefCountedPtr)
 Copy an RefCountedPtr. Retains a reference to the referenced object.
 RefCountedPtr (T *in_refCountedObject=NULL)
 Construct a new RefCountedPtr. Retains a reference to in_refCountedObject.
 ~RefCountedPtr ()
 Deletes this RefCountedPtr. Releases a reference to the referenced object.

Detailed Description

template<class T>
class Simba::Support::RefCountedPtr< T >

Class Definition of RefCountedPtr, a smart pointer to reference counted objects. References to reference counted objects are Retain()d and Release()d as RefCountedPtrs are constructed, copied, assigned, and deleted.

RefCountedPtr is an alternative to SharedPtr in that this implementation does not require the template type T to derive from UnsafedSharedObject (or otherwise implement Retain/Release).

Thread Safety: RefCountedPtr is not thread safe. Use TSRefCountedPtr for thread safe reference counting.

Parameters:
T Type of object to reference count.

Constructor & Destructor Documentation

RefCountedPtr ( T *  in_refCountedObject = NULL  )  [inline]

Construct a new RefCountedPtr. Retains a reference to in_refCountedObject.

Parameters:
in_refCountedObject A reference counted object to automatically count references for. (OWN)
RefCountedPtr ( const RefCountedPtr< T > &  in_autoRefCountedPtr  )  [inline]

Copy an RefCountedPtr. Retains a reference to the referenced object.

Parameters:
in_autoRefCountedPtr RefCountedPtr object to copy
~RefCountedPtr (  )  [inline]

Deletes this RefCountedPtr. Releases a reference to the referenced object.


Member Function Documentation

bool IsNull (  )  const [inline]

Indicates if this RefCountedPtr points to NULL.

Returns:
True if this points to NULL, false otherwise.
bool operator!= ( const RefCountedPtr< T > &  in_rhs  )  const [inline]

!= comparison of the internal pointers of two RefCountedPtrs

Parameters:
in_rhs Right hand side of the operator to compare
Returns:
True if this smart pointer does not point to the same as in_rhs
bool operator!= ( const T *  in_rhs  )  const [inline]

!= comparison of the internal pointer of this RefCountedPtrs to a pointer to an object of T

Parameters:
in_rhs Right hand side of the operator to compare. (NOT OWN)
Returns:
True if this smart pointer does not point to in_rhs
T& operator* (  )  const [inline]

Dereference operator to obtain a reference to the referenced T. Be careful that this instance does not reference a NULL pointer.

If you use this to get a pointer to the T, be sure to call Retain() and Release() on it if the lifetime of the pointer is potentially different than the lifetime of this RefCountedPtrs. Otherwise destruction of this RefCountedPtr may cause the T to be released during the lifetime of the pointer.

Returns:
The dereferenced object.
T* operator-> (  )  const [inline]

Member by pointer operator to access T's members.

DO NOT use this to call Retain() and Release() on the T unless you know what you are doing! RefCountedPtr does this for you whenever necessary.

Returns:
The referenced object.
bool operator< ( const RefCountedPtr< T > &  in_rhs  )  const [inline]

< comparison of the internal pointers of two RefCountedPtrs (This is necessary for containing RefCountedPtr in a std::map)

Parameters:
in_rhs Right hand side of the operator to compare
Returns:
True if this smart pointer does not point to the same as in_rhs
RefCountedPtr& operator= ( const RefCountedPtr< T > &  in_autoRefCountedPtr  )  [inline]

Copy an RefCountedPtr to re-assign what is being referenced. Releases a reference from the currently referenced object and Retains a reference to the newly referenced object.

Parameters:
in_autoRefCountedPtr RefCountedPtr to copy.
bool operator== ( const RefCountedPtr< T > &  in_rhs  )  const [inline]

== comparison of the internal pointers of two RefCountedPtrs

Parameters:
in_rhs Right hand side of the operator to compare
Returns:
True if this smart pointer points to the same as in_rhs
bool operator== ( const T *  in_rhs  )  const [inline]

== comparison of the internal pointer of this RefCountedPtrs to a pointer to an object of T

Parameters:
in_rhs Right hand side of the operator to compare. (NOT OWN)
Returns:
True if this smart pointer points to in_rhs

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

Generated on Wed May 17 14:21:19 2017 for SimbaEngine 10.1.3.1011 by simba