00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef COIN_SBDICT_H
00021 #define COIN_SBDICT_H
00022
00023 #include <Inventor/SbBasic.h>
00024 #include <stddef.h>
00025
00026 class SbPList;
00027 class SbDictEntry;
00028
00029
00030 class COIN_DLL_API SbDict {
00031 public:
00032 SbDict(const int entries = 251);
00033 SbDict(const SbDict & from);
00034 ~SbDict();
00035
00036 SbDict & operator=(const SbDict & from);
00037
00038 void applyToAll(void (* rtn)(unsigned long key, void * value)) const;
00039 void applyToAll(void (* rtn)(unsigned long key, void * value, void * data),
00040 void * data) const;
00041 void clear(void);
00042
00043 SbBool enter(const unsigned long key, void * const value);
00044 SbBool find(const unsigned long key, void *& value) const;
00045 void makePList(SbPList & keys, SbPList & values);
00046 SbBool remove(const unsigned long key);
00047
00048 void setHashingFunction(unsigned long (*func)(const unsigned long key));
00049
00050 private:
00051 unsigned long (*hashfunc)(const unsigned long key);
00052 int tablesize;
00053 SbDictEntry ** buckets;
00054 SbDictEntry *findEntry(const unsigned long key,
00055 const unsigned long bucketnum,
00056 SbDictEntry **prev = (SbDictEntry **) NULL) const;
00057 static void copyval(unsigned long key, void * value, void * data);
00058
00059 };
00060
00061 #endif // !COIN_SBDICT_H