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_ADT_HASHENTRYFACTORY_H_ 10 #define MCLD_ADT_HASHENTRYFACTORY_H_ 11 12 namespace mcld { 13 14 /** \class HashEntryFactory 15 * \brief HashEntryFactoy is a factory wrapper for those entries who have 16 * factory methods. 17 */ 18 template <typename HashEntryTy> 19 class HashEntryFactory { 20 public: 21 typedef HashEntryTy entry_type; 22 typedef typename HashEntryTy::key_type key_type; 23 24 public: produce(const key_type & pKey)25 entry_type* produce(const key_type& pKey) { 26 return HashEntryTy::Create(pKey); 27 } 28 destroy(entry_type * & pEntry)29 void destroy(entry_type*& pEntry) { HashEntryTy::Destroy(pEntry); } 30 }; 31 32 } // namespace mcld 33 34 #endif // MCLD_ADT_HASHENTRYFACTORY_H_ 35