#include <bstack.h>
Inheritance diagram for ABA_BSTACK< Type >:
Public Member Functions | |
ABA_BSTACK (ABA_GLOBAL *glob, int size) | |
int | size () const |
int | tos () const |
bool | empty () const |
bool | full () const |
void | push (Type item) |
Type | top () const |
Type | pop () |
Accesses like top() the last element pushed on the stack and removes in addition this item from the stack. | |
void | realloc (int newSize) |
Private Attributes | |
ABA_GLOBAL * | glob_ |
ABA_ARRAY< Type > | stack_ |
int | tos_ |
Friends | |
ostream & | operator<< (ostream &out, const ABA_BSTACK< Type > &rhs) |
The output operator writes the numbers of all stacked elements and the elements line by line on an output stream. |
Definition at line 56 of file bstack.h.
ABA_BSTACK< Type >::ABA_BSTACK | ( | ABA_GLOBAL * | glob, | |
int | size | |||
) |
The constructor initializes an empty stack.
glob | A pointer to the corresponding global object. | |
size | The maximal number of elements the stack can store. |
int ABA_BSTACK< Type >::size | ( | ) | const |
int ABA_BSTACK< Type >::tos | ( | ) | const |
bool ABA_BSTACK< Type >::empty | ( | ) | const |
false otherwise.
bool ABA_BSTACK< Type >::full | ( | ) | const |
false otherwise.
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.
item | The element added to the stack. |
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.
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.
void ABA_BSTACK< Type >::realloc | ( | int | newSize | ) |
Changes the maximal number of elements of the stack.
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. |
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.
out | The output stream. | |
rhs | The stack being output. |
ABA_GLOBAL* ABA_BSTACK< Type >::glob_ [private] |
ABA_ARRAY<Type> ABA_BSTACK< Type >::stack_ [private] |
int ABA_BSTACK< Type >::tos_ [private] |