00001 #ifndef BCHASH_H
00002 #define BCHASH_H
00003
00004
00005
00006
00007
00008
00009 #include "bcwindowbase.inc"
00010 #include "stringfile.inc"
00011 #include "units.h"
00012
00013
00014 class BC_Hash
00015 {
00016 public:
00017 BC_Hash();
00018 BC_Hash(char *filename);
00019 virtual ~BC_Hash();
00020
00021 int load();
00022 int save();
00023 int load_string(char *string);
00024 int save_string(char* &string);
00025 void save_stringfile(StringFile *file);
00026 void load_stringfile(StringFile *file);
00027 int update(char *name, Freq value);
00028 int update(char *name, double value);
00029 int update(char *name, float value);
00030 int update(char *name, int32_t value);
00031 int update(char *name, int64_t value);
00032 int update(char *name, char *value);
00033
00034 double get(char *name, double default_);
00035 float get(char *name, float default_);
00036 int32_t get(char *name, int32_t default_);
00037 int64_t get(char *name, int64_t default_);
00038 char* get(char *name, char *default_);
00039
00040
00041
00042 void copy_from(BC_Hash *src);
00043
00044 int equivalent(BC_Hash *src);
00045
00046 void dump();
00047
00048
00049 private:
00050
00051 void reallocate_table(int total);
00052
00053 char **names;
00054 char **values;
00055 int total;
00056 int allocated;
00057 char filename[BCTEXTLEN];
00058 };
00059
00060 #endif