class MemoryRangeMap(_Generic[_address.AddressType, _DataType]):
A map of non-overlapping memory ranges to some data.
The data of memory ranges that would overlap is merged/subtracted with the one of a memory range that would be added/removed from the map.
Method | __init__ |
Creates a new instance of MemoryRangeMap. |
Method | __iter__ |
Undocumented |
Method | __len__ |
Returns the number of memory ranges in this map. |
Method | add |
Adds the passed memory range with the associated data to the map. |
Method | intersection |
Iterates over the intersection of any memory range contained in the map with the passed memory range, returning their associated data. |
Method | keys |
Returns an iterator on all the memory ranges in the map. |
Method | remove |
Removes the passed memory range with the associated data from the map. |
Method | remove |
Removes the passed memory range with the associated data from the map, iterating on the removed elements. |
Method | _compare |
Returns: new index value where next element should be inserted, and whether we should stop immediately |
Method | _compare |
Returns: new index value where next element should be inserted, and whether we should stop immediately |
Method | _first |
Undocumented |
Method | _fuse |
Undocumented |
Method | _insert |
Undocumented |
Instance Variable | _merge |
Undocumented |
Instance Variable | _ranges |
Undocumented |
Instance Variable | _subtract |
Undocumented |
Creates a new instance of MemoryRangeMap.
Information
Parameters | |
merge:_Callable[ | Function indicating how to merge data when adding overlapping ranges. |
subtract:_Callable[ | Function indicating how to subtract data when removing overlapping ranges. A return value of None will remove the corresponding memory range. |
items:_Iterable[ | Initial (keys, values) for the map. If they overlap, they will be merged upon insertion. |
Undocumented
Returns | |
_Iterator[ | Undocumented |
Adds the passed memory range with the associated data to the map.
The memory range can overlap with keys already contained in the map. After the addition, the intersecting range will contain the data obtained by merging the passed data with the data of the overlapping existing range.
After the addition, contiguous ranges associated to the same data (in the sense of the data type's __eq__ method) will be replaced by their union.
Parameters | |
memory_Union[ | Undocumented |
data:_DataType | Undocumented |
Iterates over the intersection of any memory range contained in the map with the passed memory range, returning their associated data.
Parameters | |
memory_Union[ | Undocumented |
Returns | |
_Iterator[ | Undocumented |
Returns an iterator on all the memory ranges in the map.
Returns | |
_Iterator[ | Undocumented |
Removes the passed memory range with the associated data from the map.
The passed data will be subtracted from the data associated with any overlapping existing range, and the resulting data will be associated with the intersection of such ranges. If the subtracted data is None for a range after this operation, then the range will be removed from the map.
If the passed data is None, then the intersection of any range overlapping with the passed range will always be removed regardless of its data.
After the removal, contiguous ranges associated to the same data (in the sense of the data type's __eq__ method) will be replaced by their union.
Parameters | |
memory_Union[ | Undocumented |
data:_Optional[ | Undocumented |
Removes the passed memory range with the associated data from the map, iterating on the removed elements.
For each removed range, returns a tuple containing that range and the data that was removed from the map.
After this iterator is fully consumed or deleted, contiguous ranges associated to the same data (in the sense of the data type's __eq__ method) will be replaced by their union.
Parameters | |
memory_Union[ | Undocumented |
data:_Optional[ | Undocumented |
Returns | |
_Iterator[ | Undocumented |
Returns: new index value where next element should be inserted, and whether we should stop immediately
Parameters | |
new:_LexicographicKeyVal[ | Undocumented |
existing:_LexicographicKeyVal[ | Undocumented |
intersection:MemoryRange[ | Undocumented |
index:int | Undocumented |
Returns | |
_Tuple[ | Undocumented |
Returns: new index value where next element should be inserted, and whether we should stop immediately
Parameters | |
new:_LexicographicKeyVal[ | Undocumented |
existing:_LexicographicKeyVal[ | Undocumented |
intersection:MemoryRange[ | Undocumented |
index:int | Undocumented |
Returns | |
_Tuple[ | Undocumented |
Undocumented
Parameters | |
memory_Union[ | Undocumented |
Returns | |
_Tuple[ | Undocumented |
Undocumented
Parameters | |
beginint | Undocumented |
endint | Undocumented |
Undocumented
Parameters | |
index:int | Undocumented |
range:MemoryRange[ | Undocumented |
data:_DataType | Undocumented |
Returns | |
int | Undocumented |