HashEntryFactory.h revision 22add6ff3426df1a85089fe6a6e1597ee3b6f300
1//===- HashEntryFactory.h --------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#ifndef MCLD_HASH_ENTRY_FACTORY_H
10#define MCLD_HASH_ENTRY_FACTORY_H
11
12namespace mcld {
13
14/** \class HashEntryFactory
15 *  \brief HashEntryFactoy is a factory wrapper for those entries who have
16 *  factory methods.
17 */
18template<typename HashEntryTy>
19class HashEntryFactory
20{
21public:
22  typedef HashEntryTy           entry_type;
23  typedef typename HashEntryTy::key_type key_type;
24
25public:
26  entry_type* produce(const key_type& pKey)
27  { return HashEntryTy::Create(pKey); }
28
29  void destroy(entry_type*& pEntry)
30  { HashEntryTy::Destroy(pEntry); }
31};
32
33} // namespace of mcld
34
35#endif
36
37