91 {
92
94
95
96 ASpaceSection* aSpaceSection =
97 dynamic_cast<ASpaceSection*>(section);
98 assert(aSpaceSection != NULL);
99
100 std::set<Byte> alreadyUsedIds;
101
102 bool undefFound = false;
103
104
106
107 if (!section->noBits()) {
108
110
111 while (elementStart +
header().elementSize <=
113
114 ASpaceElement *elem = new ASpaceElement();
115
116
117 Byte id = stream.readByte();
118
119
120 if (alreadyUsedIds.find(id) != alreadyUsedIds.end()) {
121 bool twoASpaceElementsWithSameId = false;
122 assert(twoASpaceElementsWithSameId);
123 } else {
124 alreadyUsedIds.insert(id);
125 }
126
127 SectionIndexKey sectionIndexKey(
128 dynamic_cast<TPEFReader*
>(
parent())->aSpaceId(),
id);
130
131 elem->setMAU(stream.readByte());
132 elem->setAlign(stream.readByte());
133 elem->setWordSize(stream.readByte());
134
135 SectionOffsetKey nameSectionOffset(
136 header().linkId, stream.readWord());
137
138 elem->setName(CREATE_SAFEPOINTER(nameSectionOffset));
139
140
141 if (id == 0) {
143 assert(elem->align() == 0);
144 assert(elem->wordSize() == 0);
145 assert(nameSectionOffset.offset() == 0);
146 aSpaceSection->setUndefinedASpace(elem);
147 undefFound = true;
148 }
149
150 section->addElement(elem);
151
153 stream.setReadPosition(elementStart);
154 }
155 }
156
157
158 if (!undefFound) {
159 ASpaceElement *elem = new ASpaceElement();
160 elem->setMAU(0);
161 elem->setAlign(0);
162 elem->setWordSize(0);
163 section->addElement(elem);
164 aSpaceSection->setUndefinedASpace(elem);
165 }
166}
#define assert(condition)
static void addObjectReference(SectionIndexKey key, const SafePointable *obj)
virtual BinaryReader * parent() const
virtual void readData(BinaryStream &stream, Section *section) const
static const Header & header()
Word SectionOffset
Type for storing offsets relative to a given base offset value.