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


#if !defined(_DICTIONARY_H_)

#define _DICTIONARY_H_

#include "absobj.h"


template <class TKey>
class goblinDictionary : public goblinDataObject
{
private:

    TIndex*         first;
    TIndex*         next;
    char**          token;
    TIndex*         index;
    TKey*           key;         

    TIndex          nHash;
    TIndex          nMax;
    TKey            defaultKey;
    TIndex          free;
    TIndex          nz;

public:

    goblinDictionary(TIndex,TKey,goblinController&) throw();
    ~goblinDictionary() throw();
    
    void            Init() throw();
    unsigned long   Size() throw();
    unsigned long   Allocated() throw();

    char*           Display() throw();
    
    TIndex          NMax() throw() {return nMax;};
    TIndex          NZ() throw() {return nz;};

private:

    unsigned long   HashVal(char*,TIndex = NoIndex) throw();

public:

    TKey            Key(char*,TIndex = NoIndex) throw();
    void            ChangeKey(char*,TKey,TIndex = NoIndex,
                        TOwnership = OWNED_BY_RECEIVER) throw(ERRejected);

};


#endif
