00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef INTDOUBLEMAP_H_
00010 #define INTDOUBLEMAP_H_
00011
00012 #include <pthread.h>
00013
00019 class IntDoubleMap {
00020 public:
00024 IntDoubleMap(int capacity);
00025 virtual ~IntDoubleMap();
00026
00031 int getSize();
00032
00039 void insert(int x, double y);
00040
00045 bool find(int x, double * y);
00046
00050 double getHits();
00051
00055 double getMisses();
00056
00057 private:
00058 int * table;
00059 double * value;
00060 bool * filled;
00061 int size;
00062 int lastIndex;
00063 int tableSize;
00064 int maxSize;
00065 double hits;
00066 double misses;
00067
00068 void init(int capacity);
00069
00070 int insertHelper(int x, double y);
00071 int hash_function(int x);
00072 int getIndex(int i);
00073
00074 pthread_mutex_t tableMutex;
00075 pthread_mutex_t counterMutex;
00076 };
00077
00078 #endif