PStack< T > Class Template Reference

#include <lists.h>

Inheritance diagram for PStack< T >:

PAbstractList PCollection PContainer PObject List of all members.

Public Member Functions

Construction
 PStack ()
Overrides from class PObject
virtual PObjectClone () const
New functions for class
virtual void Push (T *obj)
virtual T * Pop ()
virtual T & Top ()

Protected Member Functions

 PStack (int dummy, const PStack *c)

Detailed Description

template<class T>
class PStack< T >

This template class maps the PAbstractList to a specific object type, and adds functionality that allows the list to be used as a last in first out stack. The functions in this class primarily do all the appropriate casting of types.

By default, objects placed into the set will { not} be deleted when removed or when all references to the set are destroyed. This is different from the default on most collection classes.

Note that if templates are not used the PDECLARE_STACK# macro will simulate the template instantiation.


Constructor & Destructor Documentation

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

Create a new, empty, stack.

Note that by default, objects placed into the stack will { not} be deleted when removed or when all references to the stack are destroyed. This is different from the default on most collection classes.

template<class T>
PStack< T >::PStack ( int  dummy,
const PStack< T > *  c 
) [inline, protected]


Member Function Documentation

template<class T>
virtual PObject* PStack< T >::Clone (  )  const [inline, virtual]

Make a complete duplicate of the stack. Note that all objects in the array are also cloned, so this will make a complete copy of the stack.

Reimplemented from PObject.

template<class T>
virtual T* PStack< T >::Pop (  )  [inline, virtual]

Remove the last object pushed onto the stack.

Returns:
object on top of the stack.

template<class T>
virtual void PStack< T >::Push ( T *  obj  )  [inline, virtual]

Add an object to the stack. This object will be on "top" of the stack and will be the object returned by the Pop()# function.

Parameters:
obj  Object to add to the stack.

template<class T>
virtual T& PStack< T >::Top (  )  [inline, virtual]

Get the element that is currently on top of the stack without removing it.

Returns:
reference to object on top of the stack.


The documentation for this class was generated from the following file:
Generated on Thu May 27 01:36:49 2010 for PTLib by  doxygen 1.4.7