1 //===- RegionFactory.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_REGION_FACTORY_H 10 #define MCLD_REGION_FACTORY_H 11 #ifdef ENABLE_UNITTEST 12 #include <gtest.h> 13 #endif 14 #include "mcld/Support/GCFactory.h" 15 #include "mcld/Support/MemoryRegion.h" 16 #include "mcld/Support/MemoryArea.h" 17 #include "mcld/Support/FileSystem.h" 18 19 namespace mcld 20 { 21 22 class MemoryArea; 23 24 /** \class RegionFactory 25 * \brief RegionFactory produces and destroys MemoryRegions 26 * 27 */ 28 class RegionFactory : public GCFactory<MemoryRegion, 0> 29 { 30 public: 31 typedef GCFactory<MemoryRegion, 0> Alloc; 32 33 public: 34 RegionFactory(size_t pNum); 35 ~RegionFactory(); 36 37 // ----- production ----- // 38 MemoryRegion* produce(MemoryArea::Space* pSpace, 39 const sys::fs::detail::Address pVMAStart, 40 size_t pSize); 41 42 void destruct(MemoryRegion* pRegion); 43 }; 44 45 } // namespace of mcld 46 47 #endif 48 49