Home | History | Annotate | Download | only in ADT
      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 
     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 {
     21 public:
     22   typedef HashEntryTy           entry_type;
     23   typedef typename HashEntryTy::key_type key_type;
     24 
     25 public:
     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