Home | History | Annotate | Download | only in Support
      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_SUPPORT_REGION_FACTORY_H
     10 #define MCLD_SUPPORT_REGION_FACTORY_H
     11 #ifdef ENABLE_UNITTEST
     12 #include <gtest.h>
     13 #endif
     14 #include <mcld/Config/Config.h>
     15 #include <mcld/Support/GCFactory.h>
     16 #include <mcld/Support/MemoryRegion.h>
     17 
     18 namespace mcld {
     19 
     20 class MemoryArea;
     21 
     22 /** \class RegionFactory
     23  *  \brief RegionFactory produces and destroys MemoryRegions
     24  *
     25  */
     26 class RegionFactory : public GCFactory<MemoryRegion, MCLD_REGION_CHUNK_SIZE>
     27 {
     28 public:
     29   typedef GCFactory<MemoryRegion, MCLD_REGION_CHUNK_SIZE> Alloc;
     30   typedef MemoryRegion::Address Address;
     31   typedef MemoryRegion::ConstAddress ConstAddress;
     32 
     33 public:
     34   MemoryRegion* produce(Address pVMAStart, size_t pSize);
     35 
     36   void destruct(MemoryRegion* pRegion);
     37 };
     38 
     39 } // namespace of mcld
     40 
     41 #endif
     42 
     43