00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
#ifndef DIME_DICT_H
00031
#define DIME_DICT_H
00032
00033
#include <dime/Basic.h>
00034
#include <string.h>
00035
00036 class DIME_DLL_API dimeDictEntry
00037 {
00038
friend class dimeDict;
00039
00040
private:
00041 dimeDictEntry *next;
00042 dimeDictEntry(
const char *
const k,
void *v) {key = strdup(k); value = v; };
00043 ~dimeDictEntry() {free(key);}
00044
char *key;
00045
void *value;
00046
00047 };
00048
00049 class DIME_DLL_API dimeDict
00050 {
00051
public:
00052 dimeDict(
const int entries = 17989);
00053 ~dimeDict();
00054
void clear();
00055
00056
bool enter(
const char *
const key,
char *&ptr,
void *value);
00057
const char *enter(
const char *
const key,
void *value);
00058
const char *find(
const char *
const key)
const;
00059
bool find(
const char *
const key,
void *&value)
const;
00060
bool remove(
const char *
const key);
00061
void dump(
void);
00062
00063
private:
00064
int tableSize;
00065 dimeDictEntry **buckets;
00066 dimeDictEntry *&findEntry(
const char *
const key)
const;
00067
unsigned int bucketNr(
const char *key)
const;
00068
00069
public:
00070
void print_info();
00071
00072 };
00073
00074
#endif // ! DIME_DICT_H
00075