Blender
V3.3
|
#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 | remove (const Iterator &it) |
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 107 of file BLI_set.hh.
using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::const_pointer = const Key * |
Definition at line 112 of file BLI_set.hh.
using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::const_reference = const Key & |
Definition at line 114 of file BLI_set.hh.
using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::iterator = Iterator |
Definition at line 115 of file BLI_set.hh.
using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::pointer = Key * |
Definition at line 111 of file BLI_set.hh.
using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reference = Key & |
Definition at line 113 of file BLI_set.hh.
using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size_type = int64_t |
Definition at line 116 of file BLI_set.hh.
using blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::value_type = Key |
Definition at line 110 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 169 of file BLI_set.hh.
|
inlinenoexcept |
Definition at line 178 of file BLI_set.hh.
|
inline |
Definition at line 182 of file BLI_set.hh.
|
inline |
Construct a set that contains the given keys. Duplicates will be removed automatically.
Definition at line 190 of file BLI_set.hh.
|
default |
|
default |
|
inlinenoexcept |
Definition at line 198 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 253 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_as().
Referenced by add_list_to_input_ids(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_multiple(), add_to_input_ids(), add_used_ids_from_sockets(), blender::bke::AttributeAccessor::all_ids(), blender::bke::BKE_armature_find_selected_bone_names(), BKE_main_namemap_get_name(), blender::fn::build_multi_function_procedure_for_fields(), check_tree_for_time_node(), blender::bke::AssetCatalogService::create_catalog_filter(), external_file_check_callback(), blender::gpu::shader::ShaderCreateInfo::finalize(), blender::compositor::find_constant_foldable_operations(), blender::bke::node_field_inferencing::find_group_output_dependencies(), find_sockets_to_preview_for_spreadsheet(), blender::fn::find_varying_fields(), blender::bke::attribute_accessor_functions::for_all(), generate_unique_instance_ids(), blender::nodes::node_geo_input_mesh_island_cc::IslandCountFieldInput::get_varray_for_context(), blender::deg::is_reachable(), main_namemap_populate(), main_namemap_validate_and_fix(), ntree_update_reroute_nodes(), blender::bke::AssetCatalogService::parse_catalog_file(), blender::fn::preprocess_field_tree(), process_nodes_for_depsgraph(), blender::bke::AssetCatalogService::prune_catalogs_by_path(), blender::bke::AssetCatalogService::purge_catalogs_not_listed(), blender::bke::AssetCatalogService::reload_catalogs(), blender::nodes::search_link_ops_for_declarations(), blender::nodes::search_link_ops_for_socket_templates(), blender::deg::AnimatedPropertyStorage::tagPropertyAsAnimated(), blender::bke::tests::TEST(), blender::tests::TEST(), blender::io::obj::Geometry::track_all_vertices(), blender::io::obj::Geometry::track_vertex_index(), update_visible_columns(), updateDepsgraph(), and blender::gpu::shader::ShaderCreateInfo::validate_merge().
|
inline |
Definition at line 257 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_as().
|
inline |
Definition at line 261 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::ed::asset::index::AssetLibraryIndex::init_unused_index_files(), 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 273 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 284 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 238 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_multiple_new(), blender::fn::MFProcedureDotExport::create_nodes(), blender::bke::curve_to_mesh_sweep(), blender::bke::attribute_accessor_functions::for_all(), pose_backup_create(), and blender::tests::TEST().
|
inline |
Definition at line 242 of file BLI_set.hh.
|
inline |
Definition at line 466 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::end().
Referenced by compute_geometry(), has_external_files(), and blender::tests::TEST().
|
inline |
Returns the number of available slots. This is mostly for debugging purposes.
Definition at line 555 of file BLI_set.hh.
|
inline |
Remove all elements from the set.
Definition at line 516 of file BLI_set.hh.
Referenced by blender::tests::TEST(), and blender::meshintersect::CDTArrangement< Arith_t >::~CDTArrangement().
|
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 296 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains_as().
Referenced by BKE_main_namemap_get_name(), can_read_node_type(), blender::fn::MFProcedureDotExport::create_nodes(), blender::fn::evaluate_fields(), blender::deg::AnimatedPropertyStorage::isAnyPropertyAnimated(), main_namemap_validate_and_fix(), blender::geometry::point_merge_by_distance(), pose_backup_create(), blender::bke::AssetCatalogService::purge_catalogs_not_listed(), blender::bke::retrieve_attributes_for_transfer(), and blender::tests::TEST().
|
inline |
Definition at line 300 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 508 of file BLI_set.hh.
|
inlinestatic |
Returns true if no key from a is also in b and vice versa.
Definition at line 617 of file BLI_set.hh.
References Freestyle::a, usdtokens::b(), and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::Intersects().
|
inline |
Definition at line 476 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::begin(), compute_geometry(), and blender::tests::TEST().
|
inlinestatic |
Returns true if there is a key that exists in both sets.
Definition at line 599 of file BLI_set.hh.
References Freestyle::a, and usdtokens::b().
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 547 of file BLI_set.hh.
Referenced by has_external_files(), pose_backup_create(), 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 309 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 313 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 322 of file BLI_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 327 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 353 of file BLI_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 357 of file BLI_set.hh.
|
inline |
Definition at line 361 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 340 of file BLI_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 344 of file BLI_set.hh.
Referenced by blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_ptr().
|
inline |
Definition at line 223 of file BLI_set.hh.
References blender::copy_assign_container().
|
inline |
Definition at line 228 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 498 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 531 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
|
inline |
Remove the key that the iterator is currently pointing at. It is valid to call this method while iterating over the set. However, after this method has been called, the removed element must not be accessed anymore.
Definition at line 486 of file BLI_set.hh.
References BLI_assert, and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::Iterator::current_slot().
|
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 371 of file BLI_set.hh.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_as().
Referenced by BKE_main_namemap_remove_name(), blender::ed::asset::index::AssetLibraryIndex::mark_as_used(), and blender::tests::TEST().
|
inline |
Definition at line 375 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 383 of file BLI_set.hh.
Referenced by blender::geometry::point_merge_by_distance(), and blender::tests::TEST().
|
inline |
Definition at line 387 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 563 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 589 of file BLI_set.hh.
Referenced by generate_unique_instance_ids(), and blender::io::obj::Geometry::track_all_vertices().
|
inline |
Returns the number of keys stored in the set.
Definition at line 539 of file BLI_set.hh.
Referenced by blender::meshintersect::cdt_draw(), blender::nodes::node_geo_input_mesh_island_cc::IslandCountFieldInput::get_varray_for_context(), blender::io::obj::Geometry::get_vertex_count(), has_external_files(), 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 580 of file BLI_set.hh.
Referenced by BKE_main_namemap_destroy().
|
inline |
Returns the bytes required per element. This is mostly for debugging purposes.
Definition at line 571 of file BLI_set.hh.