Mercurial > hg > audiodb
comparison audioDB-internals.h @ 672:a35ca2d5f238
Extend results structure to include a key for the query.
Fill that key from the query datum, if given, defaulting to ""; patch up
bindings and tests.
This is so that (Instance x Instance) operations such as querying and
sampling can be supported.
author | mas01cr |
---|---|
date | Fri, 05 Mar 2010 16:00:53 +0000 |
parents | b82b90c6445e |
children | e1f7cab30701 |
comparison
equal
deleted
inserted
replaced
671:537bfd7e15a1 | 672:a35ca2d5f238 |
---|---|
121 LSH *cached_lsh; | 121 LSH *cached_lsh; |
122 }; | 122 }; |
123 | 123 |
124 typedef struct { | 124 typedef struct { |
125 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { | 125 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { |
126 return strcmp(r1.key, r2.key) < 0; | 126 return strcmp(r1.ikey, r2.ikey) < 0; |
127 } | 127 } |
128 } adb_result_key_lt; | 128 } adb_result_ikey_lt; |
129 | 129 |
130 typedef struct { | 130 typedef struct { |
131 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { | 131 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { |
132 return r1.qpos < r2.qpos; | 132 return r1.qpos < r2.qpos; |
133 } | 133 } |
148 typedef struct { | 148 typedef struct { |
149 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { | 149 bool operator() (const adb_result_t &r1, const adb_result_t &r2) { |
150 return ((r1.ipos < r2.ipos) || | 150 return ((r1.ipos < r2.ipos) || |
151 ((r1.ipos == r2.ipos) && | 151 ((r1.ipos == r2.ipos) && |
152 ((r1.qpos < r2.qpos) || | 152 ((r1.qpos < r2.qpos) || |
153 ((r1.qpos == r2.qpos) && (strcmp(r1.key, r2.key) < 0))))); | 153 ((r1.qpos == r2.qpos) && (strcmp(r1.ikey, r2.ikey) < 0))))); |
154 } | 154 } |
155 } adb_result_triple_lt; | 155 } adb_result_triple_lt; |
156 | 156 |
157 /* this struct is for maintaining per-query state. We don't want to | 157 /* this struct is for maintaining per-query state. We don't want to |
158 * store this stuff in the adb struct itself, because (a) it doesn't | 158 * store this stuff in the adb struct itself, because (a) it doesn't |
166 Accumulator *accumulator; | 166 Accumulator *accumulator; |
167 std::set<std::string> *allowed_keys; | 167 std::set<std::string> *allowed_keys; |
168 std::priority_queue<PointPair> *exact_evaluation_queue; | 168 std::priority_queue<PointPair> *exact_evaluation_queue; |
169 std::set< adb_result_t, adb_result_triple_lt > *set; | 169 std::set< adb_result_t, adb_result_triple_lt > *set; |
170 LSH *lsh; | 170 LSH *lsh; |
171 const char *qkey; | |
171 } adb_qstate_internal_t; | 172 } adb_qstate_internal_t; |
172 | 173 |
173 /* We could go gcc-specific here and use typeof() instead of passing | 174 /* We could go gcc-specific here and use typeof() instead of passing |
174 * in an explicit type. Answers on a postcard as to whether that's a | 175 * in an explicit type. Answers on a postcard as to whether that's a |
175 * good plan or not. */ | 176 * good plan or not. */ |