class is NoVoHT. to create an instance the constructor is:
NoVoHT(string filename, int size, int rewrite) OR NoVoHT(string filename, int size, int rewrite, float resize)
where filename is the file to write persistant version to, set this to NULL for no persistance. size is the number of slots in the hash table array. (map can overfill) rewrite is number of removes before total rewrite of file -1 here would set no rewriting
resize is the ratio at which to resize array. 2/3 means at two thirds capacity. keep in mind array size doubles by default unless you modify the source code.
standard hash table methods put(key, value) where key is string and value is int (i can change this if necessary) 0 = success -1 = didnt insert/failed -2 = insert but didnt write get(key) returns pointer to value
remove(key) removes key-value pair 0 = success -1 = didnt remove/failed >=-2 = removed but didnt rewrite
added: writeFile() as public so if wanted, one could set no rewrites and rewrite based on the client program such as with a timer so rewrite based on time rather than number of removes returns 0 if successful and -2 if fails
also, simple get functions getSize() returns number of pairs in the map getCap() returns number of buckets in the base array of the map.
Documentation:
NoVoHT(string filename, int size, int rewrite) OR NoVoHT(string filename, int size, int rewrite, float resize) filename = persistent file (empty string for no persistance) size = initial number of slots in map rewrite = number of removes before garbage collection (-1 to not rewrite based on number of removals) resize = percentage of size before size is doubled
int put(string key, string val) returns 0 if succesful -1 if it fails, and -2 if it fails to write
*string get(string key) returns pointer to string value, or NULL if not found
int remove(string key) returns 0 if succesful -1 if it fails, and -2 if it fails to write
int append(string key, string val)
writeFile() writes file. best used on a timer