00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00036 #ifndef _atoms_h_
00037 #define _atoms_h_
00038
00039 #include <glib.h>
00040
00041
00042
00043
00044
00045 #define ATOM_STRING 0
00046 #define ATOM_GUID 1
00047 #define ATOM_SHA1 2
00048 #define ATOM_UINT64 3
00050
00051
00052
00053
00054 #ifdef TRACK_ATOMS
00055
00056 #define atom_str_get(k) atom_get_track(ATOM_STRING, (k), _WHERE_, __LINE__)
00057 #define atom_str_free(k) atom_free_track(ATOM_STRING, (k), _WHERE_, __LINE__)
00058
00059 #define atom_guid_get(k) atom_get_track(ATOM_GUID, (k), _WHERE_, __LINE__)
00060 #define atom_guid_free(k) atom_free_track(ATOM_GUID, (k), _WHERE_, __LINE__)
00061
00062 #define atom_sha1_get(k) atom_get_track(ATOM_SHA1, (k), _WHERE_, __LINE__)
00063 #define atom_sha1_free(k) atom_free_track(ATOM_SHA1, (k), _WHERE_, __LINE__)
00064
00065 #define atom_uint64_get(k) atom_get_track(ATOM_UINT64, (k), _WHERE_, __LINE__)
00066 #define atom_uint64_free(k) atom_free_track(ATOM_UINT64, (k), _WHERE_, __LINE__)
00067
00068 #ifndef ATOMS_SOURCE
00069 #define atom_get(t,k) atom_get_track(t, (k), _WHERE_, __LINE__)
00070 #define atom_free(t,k) atom_free_track(t, (k), _WHERE_, __LINE__)
00071 #endif
00072
00073 #else
00074
00075 #define atom_str_get(k) atom_get(ATOM_STRING, k)
00076 #define atom_str_free(k) atom_free(ATOM_STRING, k)
00077
00078 #define atom_guid_get(k) atom_get(ATOM_GUID, k)
00079 #define atom_guid_free(k) atom_free(ATOM_GUID, k)
00080
00081 #define atom_sha1_get(k) atom_get(ATOM_SHA1, k)
00082 #define atom_sha1_free(k) atom_free(ATOM_SHA1, k)
00083
00084 #define atom_uint64_get(k) atom_get(ATOM_UINT64, k)
00085 #define atom_uint64_free(k) atom_free(ATOM_UINT64, k)
00086
00087 #endif
00088
00089
00090
00091
00092
00093 void atoms_init(void);
00094 void atoms_close(void);
00095
00096
00097
00098
00099 guint uint64_hash(gconstpointer key);
00100 gint uint64_eq(gconstpointer a, gconstpointer b);
00101 guint sha1_hash(gconstpointer key);
00102 gint sha1_eq(gconstpointer a, gconstpointer b);
00103 guint guid_hash(gconstpointer key);
00104 gint guid_eq(gconstpointer a, gconstpointer b);
00105 guint uint64_hash(gconstpointer key);
00106 gint uint64_eq(gconstpointer a, gconstpointer b);
00107 guint binary_hash(const guchar *key, guint len);
00108
00109 #ifdef TRACK_ATOMS
00110 gpointer atom_get_track(gint type, gconstpointer key, gchar *file, gint line);
00111 void atom_free_track(gint type, gconstpointer key, gchar *file, gint line);
00112 #endif
00113
00114 #if !defined(TRACK_ATOMS) || defined(ATOMS_SOURCE)
00115 gpointer atom_get(gint type, gconstpointer key);
00116 void atom_free(gint type, gconstpointer key);
00117 #endif
00118
00119 #endif
00120
00121
00122