ELFSegmentFactory.h revision d8a752331fe7a30ce41835f139aa8a4c675ad07a
1//===- ELFSegmentFactory.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_ELFSEGMENT_FACTORY_H 10#define MCLD_ELFSEGMENT_FACTORY_H 11#ifdef ENABLE_UNITTEST 12#include <gtest.h> 13#endif 14#include <mcld/Support/GCFactory.h> 15#include <mcld/LD/ELFSegment.h> 16 17namespace mcld 18{ 19 20/** \class ELFSegmentFactory 21 * \brief provide the interface to create and delete an ELFSegment 22 */ 23class ELFSegmentFactory : public GCFactory<ELFSegment, 0> 24{ 25public: 26 /// ELFSegmentFactory - the factory of ELFSegment 27 /// pNum is the magic number of the ELF segments in the output 28 ELFSegmentFactory(size_t pNum); 29 ~ELFSegmentFactory(); 30 31 /// produce - produce an empty ELF segment information. 32 /// this function will create an ELF segment 33 /// @param pType - p_type in ELF program header 34 ELFSegment* produce(uint32_t pType); 35 36 /// destroy - destruct the ELF segment 37 void destroy(ELFSegment*& pSegment); 38}; 39 40} // namespace of mcld 41 42#endif 43