1//===- RegionFragment.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_LD_REGION_FRAGMENT_H
10#define MCLD_LD_REGION_FRAGMENT_H
11#ifdef ENABLE_UNITTEST
12#include <gtest.h>
13#endif
14
15#include <mcld/Fragment/Fragment.h>
16
17namespace mcld {
18
19class MemoryRegion;
20
21/** \class RegionFragment
22 *  \brief RegionFragment is a kind of Fragment containing mcld::MemoryRegion
23 */
24class RegionFragment : public Fragment
25{
26public:
27  RegionFragment(MemoryRegion& pRegion, SectionData* pSD = NULL);
28
29  ~RegionFragment();
30
31  const MemoryRegion& getRegion() const { return m_Region; }
32  MemoryRegion&       getRegion()       { return m_Region; }
33
34  static bool classof(const Fragment *F)
35  { return F->getKind() == Fragment::Region; }
36
37  static bool classof(const RegionFragment *)
38  { return true; }
39
40  size_t size() const;
41
42private:
43  MemoryRegion& m_Region;
44};
45
46} // namespace of mcld
47
48#endif
49
50