Added getIntersectingMemorySegmentDescriptors() member function to address space descriptor struct
This commit is contained in:
@@ -46,4 +46,20 @@ namespace Targets
|
|||||||
|
|
||||||
return segment->get();
|
return segment->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<
|
||||||
|
const TargetMemorySegmentDescriptor*
|
||||||
|
> TargetAddressSpaceDescriptor::getIntersectingMemorySegmentDescriptors(
|
||||||
|
const TargetMemoryAddressRange& addressRange
|
||||||
|
) const {
|
||||||
|
auto output = std::vector<const TargetMemorySegmentDescriptor*>();
|
||||||
|
|
||||||
|
for (const auto& [key, segmentDescriptor] : this->segmentDescriptorsByKey) {
|
||||||
|
if (segmentDescriptor.addressRange.intersectsWith(addressRange)) {
|
||||||
|
output.push_back(&segmentDescriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,19 @@ namespace Targets
|
|||||||
*/
|
*/
|
||||||
const TargetMemorySegmentDescriptor& getMemorySegmentDescriptor(const std::string& key) const;
|
const TargetMemorySegmentDescriptor& getMemorySegmentDescriptor(const std::string& key) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches all memory segments in the address space that intersect with the given address range.
|
||||||
|
*
|
||||||
|
* @param addressRange
|
||||||
|
* The address range with which the memory segments must intersect.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* Pointers to descriptors of all intersecting memory segments.
|
||||||
|
*/
|
||||||
|
std::vector<const TargetMemorySegmentDescriptor*> getIntersectingMemorySegmentDescriptors(
|
||||||
|
const TargetMemoryAddressRange& addressRange
|
||||||
|
) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline std::atomic<TargetAddressSpaceDescriptorId> lastAddressSpaceDescriptorId = 0;
|
static inline std::atomic<TargetAddressSpaceDescriptorId> lastAddressSpaceDescriptorId = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user