GroupReader.h revision f33f6de54db174aa679a4b6d1e040d37e95541c0
1//===- GroupReader.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_GROUPREADER_H 10#define MCLD_LD_GROUPREADER_H 11#ifdef ENABLE_UNITTEST 12#include <gtest.h> 13#endif 14 15#include <mcld/Module.h> 16 17namespace mcld 18{ 19class Archive; 20class ArchiveReader; 21class DynObjReader; 22class LinkerConfig; 23class ObjectReader; 24class BinaryReader; 25 26/** \class GroupReader 27 * \brief GroupReader handles the Group Node in InputTree 28 * 29 * Group Node is the root of sub-tree in InputTree which includes the iputs in 30 * the command line options --start-group and --end-group options 31 */ 32class GroupReader 33{ 34public: 35 GroupReader(Module& pModule, 36 ObjectReader& pObjectReader, 37 DynObjReader& pDynObjReader, 38 ArchiveReader& pArchiveReader, 39 BinaryReader& pBinaryReader); 40 41 ~GroupReader(); 42 43 /// readGroup - handle the input sub-tree wich its root is pRoot 44 /// @param pRoot - the root Group node of the sub-tree 45 bool readGroup(Module::input_iterator pRoot, 46 Module::input_iterator pEnd, 47 InputBuilder& pBuilder, 48 const LinkerConfig& pConfig); 49 50private: 51 /// ArchiveListEntry - record the Archive and the corresponding input iterator 52 /// of the archive node 53 struct ArchiveListEntry { 54 ArchiveListEntry(Archive& pArchive, Module::input_iterator pIterator) 55 : archive(pArchive), input(pIterator) { 56 } 57 Archive& archive; 58 Module::input_iterator input; 59 }; 60 61private: 62 Module& m_Module; 63 ObjectReader& m_ObjectReader; 64 DynObjReader& m_DynObjReader; 65 ArchiveReader& m_ArchiveReader; 66 BinaryReader& m_BinaryReader; 67}; 68 69} // namespace of mcld 70 71#endif 72 73