summaryrefslogtreecommitdiff
path: root/include/mcld/LD/ELFSegmentFactory.h
blob: 7b5e3055e713c4c53a30ef27cc24da40909a6255 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===- ELFSegmentFactory.h ------------------------------------------------===//
//
//                     The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef MCLD_ELFSEGMENT_FACTORY_H
#define MCLD_ELFSEGMENT_FACTORY_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif
#include <mcld/Support/GCFactory.h>
#include <mcld/LD/ELFSegment.h>

namespace mcld
{

/** \class ELFSegmentFactory
 *  \brief provide the interface to create and delete an ELFSegment
 */
class ELFSegmentFactory : public GCFactory<ELFSegment, 0>
{
public:
  /// ELFSegmentFactory - the factory of ELFSegment
  /// pNum is the magic number of the ELF segments in the output
  ELFSegmentFactory(size_t pNum);
  ~ELFSegmentFactory();

  /// produce - produce an empty ELF segment information.
  /// this function will create an ELF segment
  /// @param pType - p_type in ELF program header
  ELFSegment* produce(uint32_t pType);

  /// destroy - destruct the ELF segment
  void destroy(ELFSegment*& pSegment);
};

} // namespace of mcld

#endif