33 #include "mongo/base/static_assert.h" 34 #include "mongo/util/assert_util.h" 51 template <
class KeyType,
class ValueType>
65 typedef typename std::deque<PreallocEntry>
Container;
78 template <
class MapType,
class IteratorValueType,
class IteratorType>
85 operator bool()
const {
107 return (
_it == _map._fastAccess.end());
115 invariant(!finished());
117 return &(
_it->value);
124 const KeyType&
key()
const {
125 invariant(!finished());
135 invariant(!finished());
136 while (++
_it != _map._fastAccess.end()) {
148 invariant(!finished());
149 invariant(
_it->inUse);
152 _map._fastAccessUsedSize--;
163 while (
_it != _map._fastAccess.end()) {
173 invariant(
_it != _map._fastAccess.end());
178 while (
_it != _map._fastAccess.end()) {
179 if (
_it->inUse &&
_it->key == key) {
196 typedef IteratorImpl<FastMapNoAlloc<KeyType, ValueType>, ValueType, map_iterator>
Iterator;
198 typedef IteratorImpl<const FastMapNoAlloc<KeyType, ValueType>,
220 invariant(it !=
_fastAccess.end() && !(it->inUse));
void next()
Advances the iterator to the next entry.
Definition: fast_map_noalloc.h:134
std::deque< PreallocEntry > Container
Definition: fast_map_noalloc.h:65
Container::iterator map_iterator
Definition: fast_map_noalloc.h:69
bool empty() const
Definition: fast_map_noalloc.h:260
NOTE: This structure should not be used for anything other than the Lock Manager. ...
Definition: fast_map_noalloc.h:52
Forward-only iterator.
Definition: fast_map_noalloc.h:79
IteratorImpl< const FastMapNoAlloc< KeyType, ValueType >, const ValueType, const_map_iterator > ConstIterator
Definition: fast_map_noalloc.h:201
bool inUse
Definition: fast_map_noalloc.h:59
ConstIterator find(const KeyType &key) const
Definition: fast_map_noalloc.h:253
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
MapType & _map
Definition: fast_map_noalloc.h:189
IteratorType _it
Definition: fast_map_noalloc.h:192
KeyType key
Definition: fast_map_noalloc.h:61
Map entry through which we avoid releasing memory: we mark it as inUse or not.
Definition: fast_map_noalloc.h:58
IteratorValueType & operator*() const
Definition: fast_map_noalloc.h:89
Iterator begin()
Returns an iterator to the first element in the map.
Definition: fast_map_noalloc.h:232
const KeyType & key() const
Returns the key of the value at the current position.
Definition: fast_map_noalloc.h:124
IteratorImpl(MapType &map, IteratorType it)
Definition: fast_map_noalloc.h:172
Iterator find(const KeyType &key)
Returns an iterator pointing to the first position, which has entry with the specified key...
Definition: fast_map_noalloc.h:249
IndexSet::const_iterator it
Definition: ephemeral_for_test_btree_impl.cpp:458
ValueType value
Definition: fast_map_noalloc.h:62
Container::const_iterator const_map_iterator
Definition: fast_map_noalloc.h:71
IndexSet::const_iterator _it
Definition: ephemeral_for_test_btree_impl.cpp:452
ConstIterator begin() const
Definition: fast_map_noalloc.h:236
size_t size() const
Definition: fast_map_noalloc.h:257
IteratorImpl< FastMapNoAlloc< KeyType, ValueType >, ValueType, map_iterator > Iterator
Definition: fast_map_noalloc.h:196
IteratorValueType * operator->() const
Definition: fast_map_noalloc.h:93
IteratorImpl(MapType &map, const KeyType &key)
Definition: fast_map_noalloc.h:177
FastMapNoAlloc()
Definition: fast_map_noalloc.h:203
Iterator insert(const KeyType &key)
Inserts the specified entry in the map and returns a reference to the memory for the entry just inser...
Definition: fast_map_noalloc.h:209
IteratorValueType * objAddr() const
Returns the address of the object at the current position.
Definition: fast_map_noalloc.h:114
size_type _fastAccessUsedSize
Definition: fast_map_noalloc.h:270
bool finished() const
Returns whether the iterator has been exhausted through calls to next.
Definition: fast_map_noalloc.h:106
IteratorImpl(MapType &map)
Definition: fast_map_noalloc.h:162
std::deque< PreallocEntry > _fastAccess
Definition: fast_map_noalloc.h:268
Container::size_type size_type
Definition: fast_map_noalloc.h:67