summaryrefslogtreecommitdiff
path: root/include/mcld/ADT/HashEntry.tcc
blob: f397f2347392647adca6a7e9f471f3beabc7c18b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===- HashEntry.tcc ------------------------------------------------------===//
//
//                     The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

//===--------------------------------------------------------------------===//
// template implementation of HashEntry
template <typename KeyType, typename ValueType, typename KeyCompare>
HashEntry<KeyType, ValueType, KeyCompare>::HashEntry(const KeyType& pKey)
  : m_Key(pKey) {
}

template <typename KeyType, typename ValueType, typename KeyCompare>
HashEntry<KeyType, ValueType, KeyCompare>::~HashEntry()
{
}

template <typename KeyType, typename ValueType, typename KeyCompare>
bool HashEntry<KeyType, ValueType, KeyCompare>::compare(const KeyType& pKey)
{
  static KeyCompare comparator;
  return comparator(m_Key, pKey);
}

//===--------------------------------------------------------------------===//
// template implementation of EntryFactory
template <typename HashEntryTy>
EntryFactory<HashEntryTy>::EntryFactory()
{
}

template <typename HashEntryTy>
EntryFactory<HashEntryTy>::~EntryFactory()
{
}

template <typename HashEntryTy>
void EntryFactory<HashEntryTy>::destroy(HashEntryTy* pEntry)
{
  delete pEntry;
}

template <typename HashEntryTy>
HashEntryTy*
EntryFactory<HashEntryTy>::produce(const typename EntryFactory<HashEntryTy>::key_type& pKey)
{
  return new HashEntryTy(pKey);
}