# FoundationClasses
TKernel
NCollection

# FoundationClasses
TKernel
NCollection

# NCollection_Stack< TheItemType > Class Template Reference

`#include <NCollection_Stack.hxx>`

Inheritance diagram for NCollection_Stack< TheItemType >:

[legend]

## Public Types

typedef NCollection_TListNode< TheItemType > | StackNode
typedef NCollection_TListIterator< TheItemType > | Iterator

## Public Member Functions

| NCollection_Stack (const Handle(NCollection_BaseAllocator)&theAllocator=0L)
| Constructor.
| NCollection_Stack (const NCollection_Stack &theOther)
| Copy constructor.
virtual Standard_Integer | Size (void) const
| Size - Number of items.
Standard_Integer | Depth (void) const
| Depth - Number of items.
virtual void | Assign (const NCollection_BaseCollection< TheItemType > &theOther)
| Replace this list by the items of theOther collection.
NCollection_Stack & | operator= (const NCollection_Stack &theOther)
| Replace this list by the items of theOther Stack.
void | Clear (void)
| Clear this stack.
const TheItemType & | Top (void) const
| Top item - constant.
TheItemType & | ChangeTop (void)
| Top item - variable.
void | Push (const TheItemType &theItem)
| Push one item.
void | Pop (void)
| Pop top item.
| ~NCollection_Stack (void)
| Destructor - clears the List.

## Private Member Functions

virtual TYPENAME NCollection_BaseCollection< TheItemType >::Iterator & | CreateIterator (void) const
| Creates Iterator for use on BaseCollection.

## Detailed Description

### template<class TheItemType>
class NCollection_Stack< TheItemType >

Purpose: A stack is a structure where item can be added and removed from the top. Like a stack of plates in a kitchen. The last entered item will be be the first removed. This is called a LIFO (last In First Out). Inherits BaseList, adding the data item to each node.

## Member Typedef Documentation

template<class TheItemType>
typedef NCollection_TListIterator<TheItemType> NCollection_Stack< TheItemType >::Iterator

| Reimplemented from NCollection_BaseList.

template<class TheItemType>
typedef NCollection_TListNode<TheItemType> NCollection_Stack< TheItemType >::StackNode

## Constructor & Destructor Documentation

template<class TheItemType>
NCollection_Stack< TheItemType >::NCollection_Stack | ( | const Handle(NCollection_BaseAllocator)& | theAllocator = `0L` | ) | `[inline]`

template<class TheItemType>
NCollection_Stack< TheItemType >::NCollection_Stack | ( | const NCollection_Stack< TheItemType > & | theOther | ) | `[inline]`

template<class TheItemType>
NCollection_Stack< TheItemType >::~NCollection_Stack | ( | void |  | ) | `[inline]`

## Member Function Documentation

template<class TheItemType>
virtual void NCollection_Stack< TheItemType >::Assign | ( | const NCollection_BaseCollection< TheItemType > & | theOther | ) | `[inline, virtual]`

template<class TheItemType>
TheItemType& NCollection_Stack< TheItemType >::ChangeTop | ( | void |  | ) | `[inline]`

template<class TheItemType>
void NCollection_Stack< TheItemType >::Clear | ( | void |  | ) | `[inline]`

template<class TheItemType>
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& NCollection_Stack< TheItemType >::CreateIterator | ( | void |  | ) | const`[inline, private, virtual]`

| Implements NCollection_BaseCollection< TheItemType >.

template<class TheItemType>
Standard_Integer NCollection_Stack< TheItemType >::Depth | ( | void |  | ) | const`[inline]`

template<class TheItemType>
NCollection_Stack& NCollection_Stack< TheItemType >::operator= | ( | const NCollection_Stack< TheItemType > & | theOther | ) | `[inline]`

template<class TheItemType>
void NCollection_Stack< TheItemType >::Pop | ( | void |  | ) | `[inline]`

template<class TheItemType>
void NCollection_Stack< TheItemType >::Push | ( | const TheItemType & | theItem | ) | `[inline]`

template<class TheItemType>
virtual Standard_Integer NCollection_Stack< TheItemType >::Size | ( | void |  | ) | const`[inline, virtual]`

| Implements NCollection_BaseCollection< TheItemType >.

template<class TheItemType>
const TheItemType& NCollection_Stack< TheItemType >::Top | ( | void |  | ) | const`[inline]`

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

- NCollection_Stack.hxx