Template Class MemoryMap¶
Defined in File MemoryMap.hpp
Class Documentation¶
-
template<typename
V
>
classMemoryMap
¶ A fast replacement for std::map<void*,Value> for a generic Value.
This uses FixedMallocPool and Judy arrays and provides forward const and non-const iterators.
Public Types
-
template<>
usingKey
= void *¶
-
template<>
usingValue
= V¶
-
template<>
usingIterator
= Iterator_<false>¶
-
template<>
usingConstIterator
= Iterator_<true>¶
Public Functions
-
MemoryMap
()¶
-
~MemoryMap
()¶
-
std::pair<typename MemoryMap<V>::Iterator, bool>
insert
(Key ptr, const Value &val)¶ Insert Value at ptr in the map if ptr does not exist. Uses copy constructor on Value once.
- Return
Pair of iterator position into map and boolean value whether entry was added. The iterator will be set to end() if no insertion was made.
-
template<typename
P
>
std::pair<Iterator, bool>insert
(P &&pair)¶ Insert a key-value pair if pair.first does not exist as a key. Must have first and second fields. Calls the first version.
- Return
See alternative version.
-
template<typename ...
Args
>
std::pair<Iterator, bool>insert
(Key ptr, Args&&... args)¶ Emplaces a new value at ptr in the map, forwarding args to the placement new constructor.
- Return
See alternative version.
-
MemoryMap<V>::Iterator
findOrBefore
(Key ptr)¶ Find a value at ptr.
- Return
iterator into map at ptr or preceeding position.
-
MemoryMap<V>::ConstIterator
findOrBefore
(Key ptr) const¶
-
MemoryMap<V>::Iterator
find
(Key ptr)¶ Find a value at ptr.
- Return
iterator into map at ptr or end() if not found.
-
MemoryMap<V>::ConstIterator
find
(Key ptr) const¶
-
MemoryMap<V>::Iterator
begin
()¶
-
MemoryMap<V>::ConstIterator
end
() const¶ Iterator to one-past-last value.
-
MemoryMap<V>::Iterator
end
()¶
-
void
erase
(Key ptr)¶ Remove an entry from the map.
-
void
erase
(Iterator iter)¶
-
void
erase
(ConstIterator oter)¶
-
void
removeLast
()¶ Remove/deallocate the last found entry.
WARNING: Use this with caution, only directly after using a method above. erase(Key) is safer, but requires an additional lookup.
-
void
clear
()¶ Clear all entris from the map.
-
std::size_t
size
() const¶ Return number of entries in the map.
Friends
-
friend
umpire::util::MemoryMap::Iterator_
-
template<bool
Const
= false>
classIterator_
: public std::iterator<std::forward_iterator_tag, Value>¶ Public Types
-
template<>
template<>
usingMap
= typename std::conditional<Const, const MemoryMap<Value>, MemoryMap<Value>>::type¶
-
template<>
template<>
usingValuePtr
= typename std::conditional<Const, const Value *, Value *>::type¶
Public Functions
-
template<>
Iterator_
(Map *map, iterator_begin)¶
-
template<>
Iterator_
(Map *map, iterator_end)¶
-
template<>
MemoryMap<V>::template Iterator_<Const> &operator++
()¶
-
template<>
MemoryMap<V>::template Iterator_<Const>operator++
(int)¶
-
template<bool
OtherConst
>
booloperator==
(const Iterator_<OtherConst> &other) const¶
-
template<bool
OtherConst
>
booloperator!=
(const Iterator_<OtherConst> &other) const¶
-
template<bool
OtherConst
>
booloperator==
(const MemoryMap<V>::Iterator_<OtherConst> &other) const¶
-
template<bool
OtherConst
>
booloperator!=
(const MemoryMap<V>::Iterator_<OtherConst> &other) const¶
-
template<>
-
template<>