| 57 | } |
| 58 | |
| 59 | int add(HashKeyType1 key1, HashKeyType2 key2, HashValueType value, |
| 60 | bool useRef = false) |
| 61 | { |
| 62 | HashEntry *entry = NULL; |
| 63 | |
| 64 | if(!key1) THROW("Invalid argument"); |
| 65 | util::CriticalSection::SafeLock l(mutex); |
| 66 | |
| 67 | if((entry = findEntry(key1, key2)) != NULL) |
| 68 | { |
| 69 | if(value) entry->value = value; |
| 70 | if(useRef) entry->refCount++; |
| 71 | return 0; |
| 72 | } |
| 73 | entry = new HashEntry; |
| 74 | memset(entry, 0, sizeof(HashEntry)); |
| 75 | entry->prev = end; if(end) end->next = entry; |
| 76 | if(!start) start = entry; |
| 77 | end = entry; |
| 78 | end->key1 = key1; end->key2 = key2; end->value = value; |
| 79 | if(useRef) end->refCount = 1; |
| 80 | count++; |
| 81 | return 1; |
| 82 | } |
| 83 | |
| 84 | HashValueType find(HashKeyType1 key1, HashKeyType2 key2) |
| 85 | { |
no outgoing calls
no test coverage detected