Grafalgo
Library of useful data structures and algorithms
|
00001 00009 #ifndef TREEMAP_H 00010 #define TREEMAP_H 00011 00012 #include "Adt.h" 00013 #include "BalBstSet.h" 00014 #include "SetPair.h" 00015 00016 namespace grafalgo { 00017 00028 class TreeMap : Adt { 00029 public: 00030 TreeMap(int); 00031 ~TreeMap(); 00032 00033 // common methods 00034 void clear(); 00035 void resize(int); 00036 void expand(int); 00037 void copyFrom(const TreeMap&); 00038 00039 int get(keytyp); 00040 bool put(keytyp, uint32_t); 00041 void remove(keytyp); 00042 string& toString(string&) const; 00043 private: 00044 static const int UNDEF_VAL = INT_MIN; 00045 bst root; 00046 BalBstSet *st; 00047 uint32_t *values; 00048 SetPair *nodes; 00049 00050 void makeSpace(int); 00051 void freeSpace(); 00052 }; 00053 00054 } //ends namespace 00055 00056 #endif