
/*
**  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(_BASHEAP_H_)

#define _BASHEAP_H_

#include <queue.h>


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

    TItem*          v;
    TKey*           key;         
    TItem           maxIndex;
    TItem           n;

public:

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

    void            Insert(TItem w,TKey alpha) throw(ERRange,ERRejected);
    void            Delete(TItem w) throw(ERRange,ERRejected);
    TKey            Key(TItem w) throw(ERRange);
    void            ChangeKey(TItem w,TKey alpha) throw(ERRange,ERRejected);
    TItem           Delete() throw(ERRejected);
    TItem           Peek() throw(ERRejected);
    bool            Empty() throw() {return (maxIndex==0);};
    TItem           Cardinality() throw() {return maxIndex;};

};


#endif
