44 #ifndef __BASE_ADDR_RANGE_MAP_HH__ 45 #define __BASE_ADDR_RANGE_MAP_HH__ 61 template <
typename V,
int max_cache_size=0>
140 return tree.insert(std::make_pair(r, d)).first;
153 for (
auto it = p; it !=
q; it++) {
211 if (max_cache_size != 0) {
213 if (
cache.size() >= max_cache_size) {
217 auto last =
cache.end();
220 if (max_cache_size > 1)
223 cache.push_front(it);
245 if (
cond(it->first)) {
253 iterator next =
tree.upper_bound(r);
254 if (next !=
end() &&
cond(next->first)) {
265 if (
cond(i->first)) {
270 }
while (next !=
begin() &&
271 (--next)->first.mergesWith(i->first));
293 #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