Data Structures in C++
Public Member Functions
Stack< T > Class Template Referenceabstract

Abstract stack interface. More...

#include <Stack.hpp>

Inheritance diagram for Stack< T >:
Collaboration diagram for Stack< T >:

Public Member Functions

std::string getName ()
 Provides the name of the data structure as a string representation. More...
 
virtual void push (T val)=0
 Add an element to the top of the stack. More...
 
virtual T pop ()=0
 Remove an element from the top of the stack. More...
 
virtual T peek ()=0
 See the value from the top of the stack, without removing it. More...
 
- Public Member Functions inherited from DataStructure
virtual int getSize ()=0
 Outputs the number of elements stored in the structure. More...
 
virtual bool isEmpty ()=0
 Check whether the structure is empty. More...
 
virtual bool isFull ()=0
 Check whether the structure is full. More...
 

Detailed Description

template<class T>
class Stack< T >

Abstract stack interface.

Author
Douglas De Rizzo Meneghetti (dougl.nosp@m.asri.nosp@m.zzom@.nosp@m.gmai.nosp@m.l.com)
Date
2017-6-14Abstract stack interface.
Template Parameters
TThe type of object the data structure will contain

Definition at line 16 of file Stack.hpp.

Member Function Documentation

◆ getName()

template<class T>
std::string Stack< T >::getName ( )
inlinevirtual

Provides the name of the data structure as a string representation.

Returns
name of the data structure

Implements DataStructure.

Reimplemented in StaticStack< T >.

Definition at line 19 of file Stack.hpp.

19 { return "Stack Interface"; }

◆ peek()

template<class T>
virtual T Stack< T >::peek ( )
pure virtual

See the value from the top of the stack, without removing it.

Returns
The value on the top of the stack

Implemented in StaticStack< T >, and DynamicStack< T >.

◆ pop()

template<class T>
virtual T Stack< T >::pop ( )
pure virtual

Remove an element from the top of the stack.

Returns
the value that is being removed

Implemented in StaticStack< T >, and DynamicStack< T >.

◆ push()

template<class T>
virtual void Stack< T >::push ( val)
pure virtual

Add an element to the top of the stack.

Parameters
valthe value to be added to the stack

Implemented in StaticStack< T >, and DynamicStack< T >.


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