6.61 ABA_BSTACK< Type > Class Template Reference

a set of elements, following the last-in first-out (LIFO) principle the access to or the deletion of an element is restricted to the most recently inserted element.

#include <bstack.h>

Inheritance diagram for ABA_BSTACK< Type >::


PIC


Public Member Functions

Private Attributes

Friends

6.61.1 Detailed Description

template<class Type> class ABA_BSTACK< Type >

a set of elements, following the last-in first-out (LIFO) principle the access to or the deletion of an element is restricted to the most recently inserted element.

Definition at line 56 of file bstack.h.

6.61.2 Constructor & Destructor Documentation

6.61.2.1 template<class Type> ABA_BSTACK< Type >::ABA_BSTACK (ABA_GLOBAL * glob, int size)

The constructor initializes an empty stack.

Parameters:

glob
A pointer to the corresponding global object.
size
The maximal number of elements the stack can store.

6.61.3 Member Function Documentation

6.61.3.1 template<class Type> int ABA_BSTACK< Type >::size () const

Returns:

The maximal number of elements which can be inserted into the stack.

6.61.3.2 template<class Type> int ABA_BSTACK< Type >::tos () const

Returns:

The top of the stack, i.e., the number of the next free component of the stack. This is also the number of elements currently contained in the stack since the first element is inserted in position 0.

6.61.3.3 template<class Type> bool ABA_BSTACK< Type >::empty () const

Returns:

true If there is no element in the stack,

false otherwise.

6.61.3.4 template<class Type> bool ABA_BSTACK< Type >::full () const

Returns:

true If the maximal number of elements has been inserted in the stack,

false otherwise.

6.61.3.5 template<class Type> void ABA_BSTACK< Type >::push (Type item)

Adds an element to the stack.

It is a fatal error to insert an element if the stack is full. If this function is compiled with -DABACUSSAFE, then the program terminates if this error occurs.

Parameters:

item
The element added to the stack.

6.61.3.6 template<class Type> Type ABA_BSTACK< Type >::top () const

Accesses the last element pushed on the stack without removing it.

It is an error to perform this operation on an empty stack. If this function is compiled with -DABACUSSAFE, then the program terminates if this error occurs.

Returns:

The last element pushed on the stack.

6.61.3.7 template<class Type> Type ABA_BSTACK< Type >::pop ()

Accesses like top() the last element pushed on the stack and removes in addition this item from the stack.

It is an error to perform this operation on an empty stack. If this function is compiled with -DABACUSSAFE, then the program terminates if this error occurs.

Returns:

The last element pushed on the stack.

6.61.3.8 template<class Type> void ABA_BSTACK< Type >::realloc (int newSize)

Changes the maximal number of elements of the stack.

Parameters:

newSize
The new maximal number of elements on the stack. If newSize is less than the current number of elements in the stack, then the newSize oldest element are contained in the stack after the reallocation.

6.61.4 Friends And Related Function Documentation

6.61.4.1 template<class Type> ostream& operator<< (ostream & out, const ABA_BSTACK< Type > & rhs) [friend]

The output operator writes the numbers of all stacked elements and the elements line by line on an output stream.

Returns:

A reference to the output stream.

Parameters:

out
The output stream.
rhs
The stack being output.

6.61.5 Member Data Documentation

6.61.5.1 template<class Type> ABA_GLOBAL*ABA_BSTACK< Type >::glob_ [private]

A pointer to the corresponding global object.

Definition at line 157 of file bstack.h.

6.61.5.2 template<class Type> ABA_ARRAY<Type> ABA_BSTACK< Type >::stack_ [private]

The array storing the elements of the stack.

Definition at line 161 of file bstack.h.

6.61.5.3 template<class Type> int ABA_BSTACK< Type >::tos_ [private]

The top of stack (next free component).

Definition at line 165 of file bstack.h.

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