Lines Matching refs:Key
24 * Key needs
29 * Allows duplicate key entries but on find you may get
32 template <typename T, typename Key, size_t kHashBits> class GrTHashTable {
38 T* find(const Key&) const;
39 // return true if key was unique when inserted.
40 bool insert(const Key&, T*);
41 void remove(const Key&, const T*);
77 int searchArray(const Key&) const;
82 template <typename T, typename Key, size_t kHashBits>
83 int GrTHashTable<T, Key, kHashBits>::searchArray(const Key& key) const {
95 if (Key::LT(*array[index], key)) {
103 if (Key::EQ(*array[high], key)) {
106 GrAssert(0 == high || Key::LT(*array[high - 1], key));
111 if (Key::LT(*array[high], key)) {
117 template <typename T, typename Key, size_t kHashBits>
118 T* GrTHashTable<T, Key, kHashBits>::find(const Key& key) const {
119 int hashIndex = hash2Index(key.getHash());
122 if (NULL == elem || !Key::EQ(*elem, key)) {
123 // bsearch for the key in our sorted array
124 int index = this->searchArray(key);
135 template <typename T, typename Key, size_t kHashBits>
136 bool GrTHashTable<T, Key, kHashBits>::insert(const Key& key, T* elem) {
137 int index = this->searchArray(key);
146 fHash[hash2Index(key.getHash())] = elem;
150 template <typename T, typename Key, size_t kHashBits>
151 void GrTHashTable<T, Key, kHashBits>::remove(const Key& key, const T* elem) {
152 int index = hash2Index(key.getHash());
158 index = this->searchArray(key);
170 template <typename T, typename Key, size_t kHashBits>
171 T* GrTHashTable<T, Key, kHashBits>::removeAt(int elemIndex, uint32_t hash) {
182 template <typename T, typename Key, size_t kHashBits>
183 void GrTHashTable<T, Key, kHashBits>::removeAll() {
188 template <typename T, typename Key, size_t kHashBits>
189 void GrTHashTable<T, Key, kHashBits>::deleteAll() {
194 template <typename T, typename Key, size_t kHashBits>
195 void GrTHashTable<T, Key, kHashBits>::unrefAll() {
201 template <typename T, typename Key, size_t kHashBits>
202 void GrTHashTable<T, Key, kHashBits>::validate() const {
205 unsigned hashIndex = hash2Index(Key::GetHash(*fHash[i]));
212 GrAssert(Key::LT(*fSorted[i - 1], *fSorted[i]) ||
213 Key::EQ(*fSorted[i - 1], *fSorted[i]));
217 template <typename T, typename Key, size_t kHashBits>
218 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const {