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
19namespace mcld
20{
21
22class MemoryArea;
23
24/** \class RegionFactory
25 *  \brief RegionFactory produces and destroys MemoryRegions
26 *
27 */
28class RegionFactory : public GCFactory<MemoryRegion, 0>
29{
30public:
31  typedef GCFactory<MemoryRegion, 0> Alloc;
32
33public:
34  RegionFactory(size_t pNum);
35  ~RegionFactory();
36
37  // ----- production ----- //
38  MemoryRegion* produce(Space& pSpace, void* pVMAStart, size_t pSize);
39
40  void destruct(MemoryRegion* pRegion);
41};
42
43} // namespace of mcld
44
45#endif
46
47