MP4
Stacks and Queues
OrderingStructure< T > Class Template Referenceabstract

OrderingStructure: represents an interface for a structure that orders items placed into it. More...

#include "ordering_structure.h"

+ Inheritance diagram for OrderingStructure< T >:

Public Member Functions

virtual ~OrderingStructure ()
 Destructor for the OrderingStructure. More...
 
virtual void add (const T &theItem)=0
 Adds the given element to the ordering structure. More...
 
virtual T remove ()=0
 Removes an element from the ordering structure. More...
 
virtual T peek ()=0
 Looks at the next element of the ordering structure, but does not remove it. More...
 
virtual bool isEmpty () const =0
 Determines if the ordering structure is empty. More...
 

Detailed Description

template<class T>
class OrderingStructure< T >

OrderingStructure: represents an interface for a structure that orders items placed into it.

Your Stack and Queue classes will implement this interface.

Author
Chase Geigle
Date
Fall 2012

Constructor & Destructor Documentation

template<class T >
virtual OrderingStructure< T >::~OrderingStructure ( )
inlinevirtual

Destructor for the OrderingStructure.

Virtual so as to allow derived classes to override if necessary.

Member Function Documentation

template<class T >
virtual void OrderingStructure< T >::add ( const T &  theItem)
pure virtual

Adds the given element to the ordering structure.

Parameters
theItemThe item to be added.

Implemented in Queue< T >, and Stack< T >.

template<class T >
virtual T OrderingStructure< T >::remove ( )
pure virtual

Removes an element from the ordering structure.

You may assume that this function is only called when the ordering structure is not empty.

Returns
An element from the ordering structure.

Implemented in Queue< T >, and Stack< T >.

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

Looks at the next element of the ordering structure, but does not remove it.

Returns
The next element on the ordering structure.

Implemented in Queue< T >, and Stack< T >.

template<class T >
virtual bool OrderingStructure< T >::isEmpty ( ) const
pure virtual

Determines if the ordering structure is empty.

Returns
Whether or not there are still elements in the ordering structure.

Implemented in Queue< T >, and Stack< T >.


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