ucc::pointer< T, P > Class Template Reference

Typed smart pointer class. More...

#include <object.h>

Inherits P.


Public Member Functions

 pointer ()
 Create a pointer with no reference.
 pointer (T *object)
 Create a pointer with a reference to a heap object.
T * operator* () const
 Reference object we are pointing to through pointer indirection.
T & operator() () const
 Reference object we are pointing to through function reference.
T * operator-> () const
 Reference member of object we are pointing to.
T * get (void) const
 Get pointer to object.
T * operator++ ()
 Iterate our pointer if we reference an array on the heap.
void operator-- ()
 Iterate our pointer if we reference an array on the heap.
void operator= (T *typed)
 Perform assignment operator to existing object.


Detailed Description

template<class T, class P = auto_pointer>
class ucc::pointer< T, P >

Typed smart pointer class.

This is used to manage references to a specific typed object on the heap that is derived from the base Object class. This is most commonly used to manage references to reference counted heap objects so their heap usage can be auto-managed while there is active references to such objects. Pointers are usually created on the stack frame and used to reference an object during the life of a member function. They can be created in other objects that live on the heap and can be used to maintain active references so long as the object they are contained in remains in scope as well.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 482 of file object.h.


Constructor & Destructor Documentation

template<class T , class P = auto_pointer>
ucc::pointer< T, P >::pointer ( T *  object  )  [inline]

Create a pointer with a reference to a heap object.

Parameters:
object we are referencing.

Definition at line 494 of file object.h.


Member Function Documentation

template<class T , class P = auto_pointer>
T* ucc::pointer< T, P >::get ( void   )  const [inline]

Get pointer to object.

Returns:
pointer or NULL if we are not referencing an object.

Definition at line 521 of file object.h.

template<class T , class P = auto_pointer>
T& ucc::pointer< T, P >::operator() ( void   )  const [inline]

Reference object we are pointing to through function reference.

Returns:
object we are pointing to.

Definition at line 507 of file object.h.

template<class T , class P = auto_pointer>
T* ucc::pointer< T, P >::operator* (  )  const [inline]

Reference object we are pointing to through pointer indirection.

Returns:
pointer to object we are pointing to.

Definition at line 500 of file object.h.

template<class T , class P = auto_pointer>
T* ucc::pointer< T, P >::operator++ ( void   )  [inline]

Iterate our pointer if we reference an array on the heap.

Returns:
next object in array.

Definition at line 528 of file object.h.

template<class T , class P = auto_pointer>
void ucc::pointer< T, P >::operator-- ( void   )  [inline]

Iterate our pointer if we reference an array on the heap.

Returns:
previous object in array.

Definition at line 535 of file object.h.

template<class T , class P = auto_pointer>
T* ucc::pointer< T, P >::operator-> (  )  const [inline]

Reference member of object we are pointing to.

Returns:
reference to member of pointed object.

Definition at line 514 of file object.h.

template<class T , class P = auto_pointer>
void ucc::pointer< T, P >::operator= ( T *  typed  )  [inline]

Perform assignment operator to existing object.

Parameters:
typed object to assign.

Definition at line 542 of file object.h.


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

Generated on Tue Jul 28 21:43:32 2009 for UCommon by  doxygen 1.5.9