41 #ifndef __BASE_ADDR_RANGE_MAP_HH__ 42 #define __BASE_ADDR_RANGE_MAP_HH__ 58 template <
typename V,
int max_cache_size=0>
137 return tree.insert(std::make_pair(r, d)).first;
150 for (
auto it = p; it !=
q; it++) {
208 if (max_cache_size != 0) {
210 if (
cache.size() >= max_cache_size) {
214 auto last =
cache.end();
217 if (max_cache_size > 1)
220 cache.push_front(it);
242 if (
cond(it->first)) {
250 iterator next =
tree.upper_bound(r);
251 if (next !=
end() &&
cond(next->first)) {
262 if (
cond(i->first)) {
267 }
while (next !=
begin() &&
268 (--next)->first.mergesWith(i->first));
290 #endif //__BASE_ADDR_RANGE_MAP_HH__
AddrRange RangeSize(Addr start, Addr size)
std::map< AddrRange, V > RangeMap
void erase(iterator p, iterator q)
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
bool intersects(const AddrRange &r) const
Determine if another range intersects this one, i.e.
const_iterator begin() const
iterator insert(const AddrRange &r, const V &d)
const_iterator contains(const AddrRange &r) const
Find entry that contains the given address range.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
RangeMap::const_iterator const_iterator
iterator intersects(const AddrRange &r)
const_iterator end() const
The AddrRangeMap uses an STL map to implement an interval tree for address decoding.
iterator contains(Addr r)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void addNewEntryToCache(iterator it) const
Add an address range map entry to the cache.
iterator find(const AddrRange &r, std::function< bool(const AddrRange)> cond)
Find entry that satisfies a condition on an address range.
std::list< iterator > cache
A list of iterator that correspond to the max_cache_size most recently used entries in the address ra...
iterator contains(const AddrRange &r)
const_iterator contains(Addr r) const
Find entry that contains the given address.
const_iterator intersects(const AddrRange &r) const
Find entry that intersects with the given address range.
RangeMap::iterator iterator
const_iterator find(const AddrRange &r, std::function< bool(const AddrRange)> cond) const