TSRefCountedPtr< T > Class Template Reference

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

List of all members.

Public Member Functions

bool IsNull () const
 Indicates if this TSRefCountedPtr points to NULL.
bool operator!= (const TSRefCountedPtr &in_rhs) const
 != comparison of the internal pointers of two TSRefCountedPtrs
bool operator!= (const T *in_rhs) const
 != comparison of the internal pointer of this TSRefCountedPtrs 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 TSRefCountedPtr &in_rhs) const
 < comparison of the internal pointers of two TSRefCountedPtrs (This is necessary for containing TSRefCountedPtr in a std::map)
TSRefCountedPtroperator= (const TSRefCountedPtr &in_autoRefCountedPtr)
 Copy an TSRefCountedPtr 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 TSRefCountedPtr &in_rhs) const
 == comparison of the internal pointers of two TSRefCountedPtrs
bool operator== (const T *in_rhs) const
 == comparison of the internal pointer of this TSRefCountedPtrs to a pointer to an object of T
 TSRefCountedPtr (const TSRefCountedPtr &in_autoRefCountedPtr)
 Copy an TSRefCountedPtr. Retains a reference to the referenced object.
 TSRefCountedPtr (T *in_refCountedObject=NULL)
 Construct a new TSRefCountedPtr. Retains a reference to in_refCountedObject.
 ~TSRefCountedPtr ()
 Deletes this TSRefCountedPtr. Releases a reference to the referenced object.

Detailed Description

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

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

TSRefCountedPtr 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: TSRefCountedPtr is thread safe due to use of TSRefCountHolder for the internal reference counting. As always, some things are unavoidably unsafe an no amount of internal thread safety can fix bad programming practices externally. That is, modifying the *SAME* TSRefCountedPtr (not just the pointed to object) simultaneously from multiple threads.

Parameters:
T Type of object to reference count.

Constructor & Destructor Documentation

TSRefCountedPtr ( T *  in_refCountedObject = NULL  )  [inline]

Construct a new TSRefCountedPtr. Retains a reference to in_refCountedObject.

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

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

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

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


Member Function Documentation

bool IsNull (  )  const [inline]

Indicates if this TSRefCountedPtr points to NULL.

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

!= comparison of the internal pointers of two TSRefCountedPtrs

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 TSRefCountedPtrs 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 TSRefCountedPtrs. Otherwise destruction of this TSRefCountedPtr 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! TSRefCountedPtr does this for you whenever necessary.

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

< comparison of the internal pointers of two TSRefCountedPtrs (This is necessary for containing TSRefCountedPtr 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
TSRefCountedPtr& operator= ( const TSRefCountedPtr< T > &  in_autoRefCountedPtr  )  [inline]

Copy an TSRefCountedPtr 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 TSRefCountedPtr to copy.
bool operator== ( const TSRefCountedPtr< T > &  in_rhs  )  const [inline]

== comparison of the internal pointers of two TSRefCountedPtrs

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 TSRefCountedPtrs 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