Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / guicast / bchash.h
blob9c96f8ad5c09f56f42b4ba6b95f91c7d9a45dc85
1 #ifndef BCHASH_H
2 #define BCHASH_H
6 // Hash table with persistent storage in stringfiles.
9 #include "bcwindowbase.inc"
10 #include "stringfile.inc"
11 #include "units.h"
14 class BC_Hash
16 public:
17 BC_Hash();
18 BC_Hash(char *filename);
19 virtual ~BC_Hash();
21 int load(); // load from disk file
22 int save(); // save to disk file
23 int load_string(char *string); // load from string
24 int save_string(char* &string); // save to new string
25 void save_stringfile(StringFile *file);
26 void load_stringfile(StringFile *file);
27 int update(char *name, Freq value); // update a value if it exists
28 int update(char *name, double value); // update a value if it exists
29 int update(char *name, float value); // update a value if it exists
30 int update(char *name, int32_t value); // update a value if it exists
31 int update(char *name, int64_t value); // update a value if it exists
32 int update(char *name, char *value); // create it if it doesn't
34 double get(char *name, double default_); // retrieve a value if it exists
35 float get(char *name, float default_); // retrieve a value if it exists
36 int32_t get(char *name, int32_t default_); // retrieve a value if it exists
37 int64_t get(char *name, int64_t default_); // retrieve a value if it exists
38 char* get(char *name, char *default_); // return 1 if it doesn't
40 // Update values with values from another table.
41 // Adds values that don't exist and updates existing values.
42 void copy_from(BC_Hash *src);
43 // Return 1 if the tables are equivalent
44 int equivalent(BC_Hash *src);
46 void dump();
49 private:
50 // Reallocate table so at least total entries exist
51 void reallocate_table(int total);
53 char **names; // list of string names
54 char **values; // list of values
55 int total; // number of defaults
56 int allocated; // allocated defaults
57 char filename[BCTEXTLEN]; // filename the defaults are stored in
60 #endif
62 // Local Variables:
63 // mode: C++
64 // c-file-style: "linux"
65 // End: