
/*
**  This file forms part of the GOBLIN C++ Class Library.
**
**  Written by Christian Fremuth-Paeger, September 1998.
**  
**  Copying, compiling, distribution and modification
**  of this source code is permitted only in accordance
**  with the GOBLIN general licence information.
*/             


#if !defined(_DYNSTAQ_H_)

#define _DYNSTAQ_H_

#include <queue.h>


template <class TItem,class TKey>
class dynamicStack : public goblinQueue<TItem,TKey>
{
private:

    struct stackMember
    {
        TItem           index;         
        stackMember*    prev;
    };

    stackMember*    top;         
    TItem           n;
    TItem           depth;

public:

    dynamicStack(TItem nn,goblinController &thisContext) throw();
    ~dynamicStack() throw();
    
    unsigned long   Size() throw();
    unsigned long   Allocated() throw();
    char*           Display() throw();

    void            Insert(TItem,TKey = 0) throw(ERRange);
    void            Delete(TItem) throw(ERRange);
    TItem           Delete() throw(ERRejected);
    TItem           Peek() throw(ERRejected);
    bool            Empty() throw() {return (top==NULL);};
    TItem           Cardinality() throw() {return depth;};

};


#endif
