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