Ptr< T > Class Template Reference

Description: Smart Pointer Declaration. More...

#include <Ptr.h>

List of all members.

Public Member Functions

 Ptr ()
 Ptr (const Ptr< T > &other)
 Ptr (T *other)
 ~Ptr ()
Ptr< T > & operator= (const Ptr< T > &other)
T & operator* () const
T * operator-> () const
 operator T * () const
T * ptr () const


Detailed Description

template<class T>
class Ptr< T >

Description: Smart Pointer Declaration.

Note:
All the dynamic object instances that need to be released out of scope, need to use smart pointer.
Warning:
Don't use when the pointer need to be used out of scope.
Usage:
   void Function()
   {
                Test *test = new Test(); // wrong
 
                Ptr<Test> test(new Test); // right use of smart pointer
   } 

Constructor & Destructor Documentation

template<class T>
Ptr< T >::Ptr (  )  [inline]

Constructor

Note: Null object

template<class T>
Ptr< T >::Ptr ( const Ptr< T > &  other  )  [inline]

Constructor

Note: Stores the pointer to an object

Parameters:
other New pointer

template<class T>
Ptr< T >::Ptr ( T *  other  )  [inline]

Constructor

Note: Stores the pointer to an object

Parameters:
New pointer

template<class T>
Ptr< T >::~Ptr (  )  [inline]

Destructor


Member Function Documentation

template<class T>
Ptr<T>& Ptr< T >::operator= ( const Ptr< T > &  other  )  [inline]

Releases old reference if any and stores the new reference

Parameters:
other New pointer
Returns:
Return new reference

template<class T>
T& Ptr< T >::operator* (  )  const [inline]

Return reference to the object

Returns:
Return the reference

template<class T>
T* Ptr< T >::operator-> (  )  const [inline]

Access member of the object

Returns:
Return the value

template<class T>
Ptr< T >::operator T * (  )  const [inline]

Returns pointer to the object

Returns:
Return the pointer

template<class T>
T* Ptr< T >::ptr (  )  const [inline]

Returns pointer to the object

Returns:
Return the pointer


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

Generated on Mon Mar 3 10:53:09 2008 for Aika by  doxygen 1.5.5