Reads section data from TPEF binary file.
- Parameters
-
stream | Stream to be read from. |
section | Section where the information is to be stored. |
- Exceptions
-
Reimplemented from TPEF::TPEFSectionReader.
Definition at line 90 of file TPEFASpaceSectionReader.cc.
96 ASpaceSection* aSpaceSection =
97 dynamic_cast<ASpaceSection*
>(section);
98 assert(aSpaceSection != NULL);
100 std::set<Byte> alreadyUsedIds;
102 bool undefFound =
false;
107 if (!section->noBits()) {
111 while (elementStart +
header().elementSize <=
114 ASpaceElement *elem =
new ASpaceElement();
117 Byte id = stream.readByte();
120 if (alreadyUsedIds.find(
id) != alreadyUsedIds.end()) {
121 bool twoASpaceElementsWithSameId =
false;
122 assert(twoASpaceElementsWithSameId);
124 alreadyUsedIds.insert(
id);
127 SectionIndexKey sectionIndexKey(
128 dynamic_cast<TPEFReader*
>(
parent())->aSpaceId(),
id);
131 elem->setMAU(stream.readByte());
132 elem->setAlign(stream.readByte());
133 elem->setWordSize(stream.readByte());
135 SectionOffsetKey nameSectionOffset(
136 header().linkId, stream.readWord());
138 elem->setName(CREATE_SAFEPOINTER(nameSectionOffset));
143 assert(elem->align() == 0);
144 assert(elem->wordSize() == 0);
145 assert(nameSectionOffset.offset() == 0);
146 aSpaceSection->setUndefinedASpace(elem);
150 section->addElement(elem);
153 stream.setReadPosition(elementStart);
159 ASpaceElement *elem =
new ASpaceElement();
162 elem->setWordSize(0);
163 section->addElement(elem);
164 aSpaceSection->setUndefinedASpace(elem);
References TPEF::Section::addElement(), TPEF::ReferenceManager::SafePointer::addObjectReference(), TPEF::ASpaceElement::align(), assert, TPEF::TPEFSectionReader::Header::bodyOffset, TPEF::TPEFSectionReader::Header::elementSize, TPEF::TPEFSectionReader::header(), TPEF::ASpaceElement::MAU(), TPEF::Section::noBits(), TPEF::ReferenceManager::SectionOffsetKey::offset(), TPEF::TPEFSectionReader::parent(), TPEF::BinaryStream::readByte(), TPEF::TPEFSectionReader::readData(), TPEF::BinaryStream::readWord(), TPEF::ASpaceElement::setAlign(), TPEF::ASpaceElement::setMAU(), TPEF::ASpaceElement::setName(), TPEF::BinaryStream::setReadPosition(), TPEF::ASpaceSection::setUndefinedASpace(), TPEF::ASpaceElement::setWordSize(), and TPEF::ASpaceElement::wordSize().