template<class KEY, class VALUE, class HASH, class EQUAL>
class bdlcc::StripedUnorderedContainerImpl< KEY, VALUE, HASH, EQUAL >
This class implements the logic for a striped hash multimap with logic that supports a (unique) map as a special case.
|
| | StripedUnorderedContainerImpl (bsl::size_t numInitialBuckets=k_DEFAULT_NUM_BUCKETS, bsl::size_t numStripes=k_DEFAULT_NUM_STRIPES, bslma::Allocator *basicAllocator=0) |
| |
| | StripedUnorderedContainerImpl (StripedUnorderedContainerImplMaxLoadFactorFlag, float maxLoadFactor=1.0, bsl::size_t numInitialBuckets=k_DEFAULT_NUM_BUCKETS, bsl::size_t numStripes=k_DEFAULT_NUM_STRIPES, bslma::Allocator *basicAllocator=0) |
| |
| | ~StripedUnorderedContainerImpl () |
| |
| void | clear () |
| |
| void | disableRehash () |
| |
| void | enableRehash () |
| |
| bsl::size_t | eraseAll (const KEY &key) |
| |
| bsl::size_t | eraseAllIf (const KEY &key, const EraseIfValuePredicate &predicate) |
| |
| template<class RANDOM_ITER > |
| bsl::size_t | eraseBulkAll (RANDOM_ITER first, RANDOM_ITER last) |
| |
| template<class RANDOM_ITER > |
| bsl::size_t | eraseBulkFirst (RANDOM_ITER first, RANDOM_ITER last) |
| |
| bsl::size_t | eraseFirst (const KEY &key) |
| |
| bsl::size_t | eraseFirstIf (const KEY &key, const EraseIfValuePredicate &predicate) |
| |
| void | insertAlways (const KEY &key, const VALUE &value) |
| |
| void | insertAlways (const KEY &key, bslmf::MovableRef< VALUE > value) |
| |
| template<class RANDOM_ITER > |
| void | insertBulkAlways (RANDOM_ITER first, RANDOM_ITER last) |
| |
| template<class RANDOM_ITER > |
| bsl::size_t | insertBulkUnique (RANDOM_ITER first, RANDOM_ITER last) |
| |
| bsl::size_t | insertUnique (const KEY &key, const VALUE &value) |
| |
| bsl::size_t | insertUnique (const KEY &key, bslmf::MovableRef< VALUE > value) |
| |
| void | rehash (bsl::size_t numBuckets) |
| |
| int | setComputedValueAll (const KEY &key, const VisitorFunction &visitor) |
| |
| int | setComputedValueFirst (const KEY &key, const VisitorFunction &visitor) |
| |
| bsl::size_t | setValueAll (const KEY &key, const VALUE &value) |
| |
| bsl::size_t | setValueFirst (const KEY &key, const VALUE &value) |
| |
| bsl::size_t | setValueFirst (const KEY &key, bslmf::MovableRef< VALUE > value) |
| |
| int | update (const KEY &key, const VisitorFunction &visitor) |
| |
| int | visit (const VisitorFunction &visitor) |
| |
| int | visit (const KEY &key, const VisitorFunction &visitor) |
| |
| bsl::size_t | bucketIndex (const KEY &key) const |
| |
| bsl::size_t | bucketCount () const |
| |
| bsl::size_t | bucketSize (bsl::size_t index) const |
| |
| bool | canRehash () const |
| |
| bool | empty () const |
| |
| EQUAL | equalFunction () const |
| |
| bsl::size_t | getValue (VALUE *value, const KEY &key) const |
| |
| bsl::size_t | getValue (bsl::vector< VALUE > *valuesPtr, const KEY &key) const |
| |
| bsl::size_t | getValue (std::vector< VALUE > *valuesPtr, const KEY &key) const |
| |
| HASH | hashFunction () const |
| |
| bool | isRehashEnabled () const |
| |
| float | loadFactor () const |
| |
| float | maxLoadFactor () const |
| |
| bsl::size_t | numStripes () const |
| |
| int | visitReadOnly (const ReadOnlyVisitorFunction &visitor) const |
| |
| int | visitReadOnly (const KEY &key, const ReadOnlyVisitorFunction &visitor) const |
| |
| bsl::size_t | size () const |
| |
| bslma::Allocator * | allocator () const |
| |
template<class KEY , class VALUE , class HASH , class EQUAL >
template<class RANDOM_ITER >
Erase from this hash map elements in this hash map having any of the values in the keys contained between the specified first (inclusive) and last (exclusive) random-access iterators. The iterators provide read access to a sequence of KEY objects. All erasures are done by the calling thread and the order of erasure is not specified. Return the number of elements removed.
- Precondition
- The behavior is undefined unless
first <= last.
- Note
- Note that the map may not have an element for every value in
keys.
template<class KEY , class VALUE , class HASH , class EQUAL >
template<class RANDOM_ITER >
Erase from this hash map elements in this hash map having any of the values in the keys contained between the specified first (inclusive) and last (exclusive) random-access iterators. The iterators provide read access to a sequence of KEY objects. If there are multiple elements for any key value, erase just the first such element found. All erasures are done by the calling thread and the order of erasure is not specified. Return the number of elements removed.
- Precondition
- The behavior is undefined unless
first <= last.
- Note
- Note that the map may not have an element for every value in
keys.
template<class KEY , class VALUE , class HASH , class EQUAL >
Load, into the specified *value, the value attribute of the first element (of possibly many elements) found in this hash map having the specified key. Return 1 on success, and 0 if key does not exist in this hash.
- Note
- Note that the return value equals the number of values returned. Also note that, when there are multiple elements having
key, the selection of "first" is implementation specific and subject to change.
template<class KEY , class VALUE , class HASH , class EQUAL >
template<class RANDOM_ITER >
Insert into this hash map elements having the key-value pairs obtained between the specified first (inclusive) and last (exclusive) random-access iterators. The iterators provide read access to a sequence of bsl::pair<KEY, VALUE> objects. All insertions are done by the calling thread and the order of insertion is not specified.
- Precondition
- The behavior is undefined unless
first <= last.
template<class KEY , class VALUE , class HASH , class EQUAL >
template<class RANDOM_ITER >
Insert into this hash map elements having the key-value pairs obtained between the specified first (inclusive) and last (exclusive) random-access iterators. The iterators provide read access to a sequence of bsl::pair<KEY, VALUE> objects. If an element having one of the keys already exists in this hash map, set the value attribute to the corresponding value from data. All insertions are done by the calling thread and the order of insertion is not specified. Return the number of elements inserted.
- Precondition
- The behavior is undefined unless
first <= last.
template<class KEY , class VALUE , class HASH , class EQUAL >
Insert into this hash map an element having the specified key and the specified move-insertable value. If key already exists in this hash map, the value attribute of that element is set to value. Return 1 if an element is inserted, and 0 if an existing element is updated. The value object is left in a valid but unspecified state. If value is allocator-enabled and allocator() != value.allocator() this operation may cost as much as a copy.
- Note
- Note that the return value equals the number of elements inserted.
template<class KEY , class VALUE , class HASH , class EQUAL >
Insert into this hash map an element having the specified key and value. If key already exists in this hash map, the value attribute of that element is set to value. Return 1 if an element is inserted, and 0 if an existing element is updated.
- Note
- Note that the return value equals the number of elements inserted.
template<class KEY , class VALUE , class HASH , class EQUAL >
Serially invoke the specified visitor passing the specified key, and the address of the value of each element in this hash map having key. If key is not in the map, value will be default constructed. That is, for each (key, value) found, invoke:
bool visitor(VALUE *value, const Key& key);
If no element in the map has key, insert (key, VALUE()) and invoke visitor with value pointing to the defsult constructed value. Return the number of elements visited or the negation of that value if visitations stopped because visitor returned false. visitor, when invoked, has exclusive access (i.e., write access) to each element during each invocation.
- Precondition
- The behavior is undefined if hash map manipulators and
getValue* methods are invoked from within visitor, as it may lead to a deadlock.
- Note
- Note that the
setComputedValueFirst method is more performant than the when the hash map contains a single element for key. Also note that a return value of 0 implies that an element was inserted.
template<class KEY , class VALUE , class HASH , class EQUAL >
Invoke the specified visitor passing the specified key, and the address of the value attribute of the first element (of possibly many elements) found in this hash map having key. If key is not in the map, value will be default constructed. That is, for (key, value), invoke:
bool visitor(VALUE *value, const Key& key);
If no element in the map has key, insert (key, VALUE()) and invoke visitor with value pointing to the defsult constructed value. Return 1 if key was found and visitor returned true, 0 if key was not found, and -1 if key was found and visitor returned false. visitor, when invoked, has exclusive access (i.e., write access) to the element.
- Precondition
- The behavior is undefined if hash map manipulators and
getValue* methods are invoked from within visitor, as it may lead to a deadlock.
- Note
- Note that the return value equals the number of elements inserted. Also note that, when there are multiple elements having
key, the selection of "first" is implementation specific and subject to change. Also note that this method is more performant than the setComputedValueAll method when the hash map contains a single element for key. Also note that a return value of 0 implies that an element was inserted.
template<class KEY , class VALUE , class HASH , class EQUAL >
Set the value attribute of every element in this hash map having the specified key to the specified value. If no such such element exists, insert (key, value). Return the number of elements found with key.
- Note
- Note that if no elements were found, and a new value was inserted,
0 is returned.
template<class KEY , class VALUE , class HASH , class EQUAL >
Set the value attribute of the element in this hash map having the specified key to the specified value. If no such element exists, insert (key, value). If there are multiple elements in this hash map having key then set the value of the first such element found. Return the number of elements found having key.
- Note
- Note that if no elements were found, and a new value was inserted,
0 is returned. Also note that, when there are multiple elements having key, the selection of "first" is unspecified and subject to change.
template<class KEY , class VALUE , class HASH , class EQUAL >
Set the value attribute of the first element in this hash map (of possibly many) found to have the specified key to the specified value. If no such such element exists, insert (key, value). Return the number of elements found with key.
- Note
- Note that if no elements were found, and a new value was inserted,
0 is returned. Also note that this method is more performant than setValueAll when there is one element having key in the hash map.
template<class KEY , class VALUE , class HASH , class EQUAL >
Serially call the specified visitor on each element (if one exists) in this hash map having the specified key until every such element has been updated or visitor returns false. That is, for (key, value), invoke:
bool visitor(&value, key);
Return the number of elements visited or the negation of that value if visitations stopped because visitor returned false. visitor has exclusive access (i.e., write access) to each element for duration of each invocation.
- Precondition
- The behavior is undefined if hash map manipulators and
getValue* methods are invoked from within visitor, as it may lead to a deadlock.
- Deprecated:
- Use visit(key, visitor) instead.
template<class KEY , class VALUE , class HASH , class EQUAL >
Serially call the specified visitor on each element (if one exists) in this hash map having the specified key until every such element has been updated or visitor returns false. That is, for (key, value), invoke:
bool visitor(&value, key);
Return the number of elements visited or the negation of that value if visitations stopped because visitor returned false. visitor has exclusive access (i.e., write access) to each element for duration of each invocation.
- Precondition
- The behavior is undefined if hash map manipulators and
getValue* methods are invoked from within visitor, as it may lead to a deadlock.
template<class KEY , class VALUE , class HASH , class EQUAL >
Call the specified visitor (in an unspecified order) on the elements in this hash table until each element has been visited or visitor returns false. That is, for (key, value), invoke:
bool visitor(&value, key);
Return the number of elements visited or the negation of that value if visitations stopped because visitor returned false. visitor has exclusive access (i.e., write access) to each element for duration of each invocation. Every element present in this hash map at the time visit is invoked will be visited unless it is removed before visitor is called for that element. Each visitation is done by the calling thread and the order of visitation is not specified. Elements inserted during the execution of visit may or may not be visited.
- Precondition
- The behavior is undefined if hash map manipulators and
getValue* methods are invoked from within visitor, as it may lead to a deadlock.
- Note
- Note that
visitor can change the value of the visited elements.
template<class KEY , class VALUE , class HASH , class EQUAL >
Serially call the specified visitor on each element (if one exists) in this hash map having the specified key until every such element has been visited or visitor returns false. That is, for (key, value), invoke:
bool visitor(value, key);
Return the number of elements visited or the negation of that value if visitations stopped because visitor returned false. visitor has read-only access to each element for duration of each invocation.
- Precondition
- The behavior is undefined if hash map manipulators are invoked from within
visitor, as it may lead to a deadlock.
template<class KEY , class VALUE , class HASH , class EQUAL >
Call the specified visitor (in an unspecified order) on the elements in this hash table until each element has been visited or visitor returns false. That is, for (key, value), invoke:
bool visitor(value, key);
Return the number of elements visited or the negation of that value if visitations stopped because visitor returned false. visitor has read-only access to each element for duration of each invocation. Every element present in this hash map at the time visit is invoked will be visited unless it is removed before visitor is called for that element. Each visitation is done by the calling thread and the order of visitation is not specified.
- Precondition
- The behavior is undefined if hash map manipulators are invoked from within
visitor, as it may lead to a deadlock.
- Note
- Note that
visitor can not change the value of the visited elements.