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


#if !defined(_DYNQ_H_)
#define _DYNQ_H_

#include <queue.h>


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

    struct queueMember
    {
        TItem           index;         
        queueMember *   next;
    };

    queueMember *   first;
    queueMember *   last;
    TItem           n;
    TItem           length;

public:

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

    void            Insert(TItem,TKey = 0) throw(ERRange);
    TItem           Delete() throw(ERRejected);
    TItem           Peek() throw(ERRejected);
    char            Empty() throw() {return (first==NULL);};
    TItem           Cardinality() throw() {return length;};

};


#endif
