|
Blender
V2.93
|
#include <BLI_set.hh>
Classes | |
| class | Iterator |
Public Types | |
| using | value_type = Key |
| using | pointer = Key * |
| using | const_pointer = const Key * |
| using | reference = Key & |
| using | const_reference = const Key & |
| using | iterator = Iterator |
| using | size_type = int64_t |
Public Member Functions | |
| Set (Allocator allocator={}) noexcept | |
| Set (NoExceptConstructor, Allocator allocator={}) noexcept | |
| Set (Span< Key > values, Allocator allocator={}) | |
| Set (const std::initializer_list< Key > &values) | |
| ~Set ()=default | |
| Set (const Set &other)=default | |
| Set (Set &&other) noexcept(std::is_nothrow_move_constructible_v< SlotArray >) | |
| Set & | operator= (const Set &other) |
| Set & | operator= (Set &&other) |
| void | add_new (const Key &key) |
| void | add_new (Key &&key) |
| bool | add (const Key &key) |
| bool | add (Key &&key) |
| template<typename ForwardKey > | |
| bool | add_as (ForwardKey &&key) |
| void | add_multiple (Span< Key > keys) |
| void | add_multiple_new (Span< Key > keys) |
| bool | contains (const Key &key) const |
| template<typename ForwardKey > | |
| bool | contains_as (const ForwardKey &key) const |
| const Key & | lookup_key (const Key &key) const |
| template<typename ForwardKey > | |
| const Key & | lookup_key_as (const ForwardKey &key) const |
| const Key & | lookup_key_default (const Key &key, const Key &default_value) const |
| template<typename ForwardKey > | |
| const Key & | lookup_key_default_as (const ForwardKey &key, const Key &default_key) const |
| const Key * | lookup_key_ptr (const Key &key) const |
| template<typename ForwardKey > | |
| const Key * | lookup_key_ptr_as (const ForwardKey &key) const |
| const Key & | lookup_key_or_add (const Key &key) |
| const Key & | lookup_key_or_add (Key &&key) |
| template<typename ForwardKey > | |
| const Key & | lookup_key_or_add_as (ForwardKey &&key) |
| bool | remove (const Key &key) |
| template<typename ForwardKey > | |
| bool | remove_as (const ForwardKey &key) |
| void | remove_contained (const Key &key) |
| template<typename ForwardKey > | |
| void | remove_contained_as (const ForwardKey &key) |
| Iterator | begin () const |
| Iterator | end () const |
| void | print_stats (StringRef name="") const |
| int64_t | count_collisions (const Key &key) const |
| void | clear () |
| void | rehash () |
| int64_t | size () const |
| bool | is_empty () const |
| int64_t | capacity () const |
| int64_t | removed_amount () const |
| int64_t | size_per_element () const |
| int64_t | size_in_bytes () const |
| void | reserve (const int64_t n) |
Static Public Member Functions | |
| static bool | Intersects (const Set &a, const Set &b) |
| static bool | Disjoint (const Set &a, const Set &b) |
Definition at line 121 of file BLI_set.hh.
| using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::const_pointer = const Key * |
Definition at line 126 of file BLI_set.hh.
| using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::const_reference = const Key & |
Definition at line 128 of file BLI_set.hh.
| using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::iterator = Iterator |
Definition at line 129 of file BLI_set.hh.
| using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::pointer = Key * |
Definition at line 125 of file BLI_set.hh.
| using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reference = Key & |
Definition at line 127 of file BLI_set.hh.
| using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size_type = int64_t |
Definition at line 130 of file BLI_set.hh.
| using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::value_type = Key |
Definition at line 124 of file BLI_set.hh.
|
inlinenoexcept |
Initialize an empty set. This is a cheap operation no matter how large the inline buffer is. This is necessary to avoid a high cost when no elements are added at all. An optimized grow operation is performed on the first insertion.
Definition at line 183 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::clear().
|
inlinenoexcept |
Definition at line 192 of file BLI_set.hh.
|
inline |
Definition at line 196 of file BLI_set.hh.
|
inline |
Construct a set that contains the given keys. Duplicates will be removed automatically.
Definition at line 204 of file BLI_set.hh.
|
default |
|
default |
|
inlinenoexcept |
Definition at line 212 of file BLI_set.hh.
|
inline |
Add a key to the set. If the key exists in the set already, nothing is done. The return value is true if the key was newly added to the set.
This is similar to std::unordered_set::insert.
Definition at line 267 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_as().
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_multiple(), addIdsUsedBySocket(), GeometryComponent::attribute_foreach(), GeometryComponent::attribute_names(), blender::nodes::find_all_attribute_names(), blender::fn::MFNetwork::find_dependencies(), find_used_ids_from_nodes(), generate_unique_instance_ids(), blender::deg::is_reachable(), blender::tests::TEST(), and update_visible_columns().
|
inline |
Definition at line 271 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_as().
|
inline |
Definition at line 275 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_nodetree_attribute_hint_add(), and blender::tests::TEST().
|
inline |
Convenience function to add many keys to the set at once. Duplicates are removed automatically.
We might be able to make this faster than sequentially adding all keys, but that is not implemented yet.
Definition at line 287 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add().
|
inline |
Convenience function to add many new keys to the set at once. The keys must not exist in the set before and there must not be duplicates in the array.
Definition at line 298 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new().
|
inline |
Add a new key to the set. This invokes undefined behavior when the key is in the set already. When you know for certain that a key is not in the set yet, use this method for better performance. This also expresses the intent better.
Definition at line 252 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_multiple_new(), GeometryComponent::attribute_foreach(), and blender::tests::TEST().
|
inline |
Definition at line 256 of file BLI_set.hh.
|
inline |
Definition at line 472 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::end().
Referenced by blender::tests::TEST().
|
inline |
Returns the number of available slots. This is mostly for debugging purposes.
Definition at line 542 of file BLI_set.hh.
|
inline |
Remove all elements from the set.
Definition at line 508 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::Set(), and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::~Set().
Referenced by blender::tests::TEST().
|
inline |
Returns true if the key is in the set.
This is similar to std::unordered_set::find() != std::unordered_set::end().
Definition at line 310 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains_as().
Referenced by attribute_search_update_fn(), blender::bke::geometry_set_gather_instances_attribute_info(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::Intersects(), and blender::tests::TEST().
|
inline |
Definition at line 314 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), and blender::tests::TEST().
|
inline |
Get the number of collisions that the probing strategy has to go through to find the key or determine that it is not in the set.
Definition at line 500 of file BLI_set.hh.
|
inlinestatic |
Returns true if no key from a is also in b and vice versa.
Definition at line 604 of file BLI_set.hh.
References Freestyle::a, and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::Intersects().
|
inline |
Definition at line 482 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::begin(), and blender::tests::TEST().
|
inlinestatic |
Returns true if there is a key that exists in both sets.
Definition at line 586 of file BLI_set.hh.
References Freestyle::a, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::Disjoint(), and blender::deg::RootPChanMap::has_common_root().
|
inline |
Returns true if no keys are stored.
Definition at line 534 of file BLI_set.hh.
Referenced by blender::tests::TEST(), and blender::gpu::GLContext::~GLContext().
|
inline |
Returns the key that is stored in the set that compares equal to the given key. This invokes undefined behavior when the key is not in the set.
Definition at line 323 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_as().
Referenced by blender::tests::TEST().
|
inline |
Definition at line 327 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key().
|
inline |
Returns the key that is stored in the set that compares equal to the given key. If the key is not in the set, the given default value is returned instead.
Definition at line 336 of file BLI_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 341 of file BLI_set.hh.
References ptr.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_default().
|
inline |
Returns the key in the set that compares equal to the given key. If it does not exist, the key is newly added.
Definition at line 367 of file BLI_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 371 of file BLI_set.hh.
|
inline |
Definition at line 375 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_or_add().
|
inline |
Returns a pointer to the key that is stored in the set that compares equal to the given key. If the key is not in the set, nullptr is returned instead.
Definition at line 354 of file BLI_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 358 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_ptr().
|
inline |
Definition at line 237 of file BLI_set.hh.
References blender::copy_assign_container().
|
inline |
Definition at line 242 of file BLI_set.hh.
References blender::move_assign_container().
|
inline |
Print common statistics like size and collision count. This is useful for debugging purposes.
Definition at line 490 of file BLI_set.hh.
References blender::HashTableStats::print().
|
inline |
Creates a new slot array and reinserts all keys inside of that. This method can be used to get rid of removed slots. Also this is useful for benchmarking the grow function.
Definition at line 518 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
|
inline |
Deletes the key from the set. Returns true when the key did exist beforehand, otherwise false.
This is similar to std::unordered_set::erase.
Definition at line 385 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_as().
Referenced by blender::tests::TEST().
|
inline |
Definition at line 389 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove(), and blender::tests::TEST().
|
inline |
Deletes the key from the set. This invokes undefined behavior when the key is not in the map.
Definition at line 397 of file BLI_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 401 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_contained(), and blender::tests::TEST().
|
inline |
Returns the amount of removed slots in the set. This is mostly for debugging purposes.
Definition at line 550 of file BLI_set.hh.
|
inline |
Potentially resize the set such that it can hold the specified number of keys without another grow operation.
Definition at line 576 of file BLI_set.hh.
Referenced by generate_unique_instance_ids().
|
inline |
Returns the number of keys stored in the set.
Definition at line 526 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::Intersects(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::rehash(), and blender::tests::TEST().
|
inline |
Returns the approximate memory requirements of the set in bytes. This is more correct for larger sets.
Definition at line 567 of file BLI_set.hh.
|
inline |
Returns the bytes required per element. This is mostly for debugging purposes.
Definition at line 558 of file BLI_set.hh.