Blender
V3.3
|
#include <BLI_vector_set.hh>
Public Types | |
using | value_type = Key |
using | pointer = Key * |
using | const_pointer = const Key * |
using | reference = Key & |
using | const_reference = const Key & |
using | iterator = Key * |
using | const_iterator = const Key * |
using | size_type = int64_t |
Public Member Functions | |
VectorSet (Allocator allocator={}) noexcept | |
VectorSet (NoExceptConstructor, Allocator allocator={}) | |
VectorSet (Span< Key > keys, Allocator allocator={}) | |
VectorSet (const std::initializer_list< Key > &keys, Allocator allocator={}) | |
~VectorSet () | |
VectorSet (const VectorSet &other) | |
VectorSet (VectorSet &&other) noexcept | |
VectorSet & | operator= (const VectorSet &other) |
VectorSet & | operator= (VectorSet &&other) |
const Key & | operator[] (const int64_t index) const |
operator Span< Key > () const | |
Span< Key > | as_span () const |
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) |
bool | contains (const Key &key) const |
template<typename ForwardKey > | |
bool | contains_as (const ForwardKey &key) const |
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) |
Key | pop () |
int64_t | index_of (const Key &key) const |
template<typename ForwardKey > | |
int64_t | index_of_as (const ForwardKey &key) const |
int64_t | index_of_try (const Key &key) const |
template<typename ForwardKey > | |
int64_t | index_of_try_as (const ForwardKey &key) const |
int64_t | index_of_or_add (const Key &key) |
int64_t | index_of_or_add (Key &&key) |
template<typename ForwardKey > | |
int64_t | index_of_or_add_as (ForwardKey &&key) |
const Key & | lookup_key (const Key &key) const |
template<typename ForwardKey > | |
const Key & | lookup_key_as (const ForwardKey &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 * | data () const |
const Key * | begin () const |
const Key * | end () const |
IndexRange | index_range () const |
void | print_stats (StringRef name="") const |
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) |
void | clear () |
int64_t | count_collisions (const Key &key) const |
Definition at line 88 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::const_iterator = const Key * |
Definition at line 96 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::const_pointer = const Key * |
Definition at line 92 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::const_reference = const Key & |
Definition at line 94 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::iterator = Key * |
Definition at line 95 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::pointer = Key * |
Definition at line 91 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reference = Key & |
Definition at line 93 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size_type = int64_t |
Definition at line 97 of file BLI_vector_set.hh.
using blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::value_type = Key |
Definition at line 90 of file BLI_vector_set.hh.
|
inlinenoexcept |
Initialize an empty vector set. This is a cheap operation and won't do an allocation. 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 156 of file BLI_vector_set.hh.
|
inline |
Definition at line 166 of file BLI_vector_set.hh.
|
inline |
Definition at line 170 of file BLI_vector_set.hh.
|
inline |
Construct a vector set that contains the given keys. Duplicates will be removed automatically.
Definition at line 178 of file BLI_vector_set.hh.
|
inline |
Definition at line 183 of file BLI_vector_set.hh.
References blender::destruct_n(), and blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
|
inline |
Definition at line 191 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size(), and blender::uninitialized_copy_n().
|
inlinenoexcept |
Definition at line 210 of file BLI_vector_set.hh.
|
inline |
Add a key to the vector set. If the key exists in the set already, nothing is done. The return value is true if the key was newly added.
This is similar to std::unordered_set::insert.
Definition at line 282 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_as().
Referenced by blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_multiple(), blender::bke::ComponentAttributeProviders::ComponentAttributeProviders(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::geometry::gather_curves_to_realize(), blender::geometry::gather_meshes_to_realize(), blender::geometry::gather_pointclouds_to_realize(), blender::nodes::node_geo_scale_elements_cc::get_edge_vertices(), blender::nodes::node_geo_scale_elements_cc::get_face_vertices(), blender::ed::curves::get_unique_editable_curves(), blender::geometry::preprocess_meshes(), blender::tests::TEST(), and blender::nodes::node_geo_extrude_mesh_cc::vert_indices_from_edges().
|
inline |
Definition at line 286 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_as().
|
inline |
Definition at line 290 of file BLI_vector_set.hh.
Referenced by blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add().
|
inline |
Convenience function to add many keys to the vector 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 302 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add().
Referenced by blender::tests::TEST().
|
inline |
Add a new key to the vector 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 267 of file BLI_vector_set.hh.
Referenced by blender::modifiers::geometry_nodes::GeometryNodesEvaluator::create_states_for_reachable_nodes(), InstancesComponent::ensure_geometry_instances(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::geometry::gather_point_attributes_to_interpolate(), blender::ed::curves::get_unique_editable_curves(), refresh_socket_list(), InstancesComponent::remove_unused_references(), and blender::tests::TEST().
|
inline |
Definition at line 271 of file BLI_vector_set.hh.
|
inline |
Get a Span referencing the keys vector. The referenced memory buffer is only valid as long as the vector set is not changed.
The keys must not be changed, because this would change their hash value.
Definition at line 257 of file BLI_vector_set.hh.
Referenced by blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::print_stats(), and blender::tests::TEST().
|
inline |
Definition at line 443 of file BLI_vector_set.hh.
|
inline |
Returns the number of available slots. This is mostly for debugging purposes.
Definition at line 489 of file BLI_vector_set.hh.
|
inline |
Remove all keys from the vector set.
Definition at line 532 of file BLI_vector_set.hh.
References blender::destruct_n(), and blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
Referenced by InstancesComponent::clear(), and blender::tests::TEST().
|
inline |
Returns true if the key is in the vector set.
This is similar to std::unordered_set::find() != std::unordered_set::end().
Definition at line 314 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains_as().
Referenced by refresh_socket_list(), and blender::tests::TEST().
|
inline |
Definition at line 318 of file BLI_vector_set.hh.
Referenced by blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::create_states_for_reachable_nodes(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::forward_group_inputs(), and blender::modifiers::geometry_nodes::GeometryNodesEvaluator::initialize_node_state().
|
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 548 of file BLI_vector_set.hh.
|
inline |
Get a pointer to the beginning of the array containing all keys.
Definition at line 438 of file BLI_vector_set.hh.
|
inline |
Definition at line 448 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
|
inline |
Return the location of the key in the vector. It is assumed, that the key is in the vector set. If this is not necessarily the case, use index_of_try
.
Definition at line 364 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_as().
Referenced by blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::geometry::gather_realize_tasks_recursive(), blender::geometry::preprocess_meshes(), and blender::tests::TEST().
|
inline |
Definition at line 368 of file BLI_vector_set.hh.
Referenced by blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of().
|
inline |
Return the index of the key in the vector. If the key is not in the set, add it and return its index.
Definition at line 390 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_or_add_as().
Referenced by blender::nodes::node_geo_input_mesh_island_cc::IslandFieldInput::get_varray_for_context(), blender::nodes::node_geo_scale_elements_cc::prepare_edge_islands(), blender::nodes::node_geo_scale_elements_cc::prepare_face_islands(), and blender::tests::TEST().
|
inline |
Definition at line 394 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_or_add_as().
|
inline |
Definition at line 398 of file BLI_vector_set.hh.
Referenced by InstancesComponent::add_reference(), and blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_or_add().
|
inline |
Return the location of the key in the vector. If the key is not in the set, -1 is returned. If you know for sure that the key is in the set, it is better to use index_of
instead.
Definition at line 377 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_try_as().
Referenced by blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), and blender::tests::TEST().
|
inline |
Definition at line 381 of file BLI_vector_set.hh.
Referenced by blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_try().
|
inline |
Get an index range containing all valid indices for this array.
Definition at line 456 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
Referenced by blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions().
|
inline |
Returns true if no keys are stored.
Definition at line 481 of file BLI_vector_set.hh.
Referenced by blender::tests::TEST(), and blender::deg::unregister_graph().
|
inline |
Returns the key that is stored in the vector set that compares equal to the given key. This invokes undefined behavior when the key is not in the set.
Definition at line 407 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_as().
Referenced by blender::tests::TEST().
|
inline |
Definition at line 411 of file BLI_vector_set.hh.
References BLI_assert, and blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_ptr_as().
Referenced by blender::modifiers::geometry_nodes::GeometryNodesEvaluator::get_node_state(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::node_task_run(), and blender::tests::TEST().
|
inline |
Returns a pointer to the key that is stored in the vector set that compares equal to the given key. If the key is not in the set, null is returned.
Definition at line 422 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_ptr_as().
Referenced by blender::tests::TEST().
|
inline |
Definition at line 426 of file BLI_vector_set.hh.
Referenced by blender::modifiers::geometry_nodes::GeometryNodesEvaluator::add_node_to_task_pool(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_as(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_key_ptr(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::should_forward_to_socket(), and blender::tests::TEST().
|
inline |
Definition at line 246 of file BLI_vector_set.hh.
|
inline |
Definition at line 226 of file BLI_vector_set.hh.
References blender::copy_assign_container().
|
inline |
Definition at line 231 of file BLI_vector_set.hh.
References blender::move_assign_container().
|
inline |
Get the key stored at the given position in the vector.
Definition at line 239 of file BLI_vector_set.hh.
References BLI_assert, and blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
|
inline |
Delete and return a key from the set. This will remove the last element in the vector. The order of the remaining elements in the set is not changed.
Definition at line 355 of file BLI_vector_set.hh.
Referenced by blender::tests::TEST().
|
inline |
Print common statistics like size and collision count. This is useful for debugging purposes.
Definition at line 464 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::as_span(), and blender::HashTableStats::print().
|
inline |
Deletes the key from the set. Returns true when the key existed in the set and is now removed. This might change the order of elements in the vector.
This is similar to std::unordered_set::erase.
Definition at line 329 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_as().
Referenced by blender::tests::TEST(), and blender::deg::unregister_graph().
|
inline |
Definition at line 333 of file BLI_vector_set.hh.
Referenced by blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove().
|
inline |
Deletes the key from the set. This invokes undefined behavior when the key is not in the set. It might change the order of elements in the vector.
Definition at line 342 of file BLI_vector_set.hh.
References blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_contained_as().
Referenced by blender::geometry::gather_point_attributes_to_interpolate(), and blender::tests::TEST().
|
inline |
Definition at line 346 of file BLI_vector_set.hh.
Referenced by blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_contained().
|
inline |
Returns the amount of removed slots in the set. This is mostly for debugging purposes.
Definition at line 497 of file BLI_vector_set.hh.
|
inline |
Potentially resize the vector set such that it can hold n elements without doing another grow.
Definition at line 522 of file BLI_vector_set.hh.
Referenced by InstancesComponent::ensure_geometry_instances(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::tests::TEST(), and blender::nodes::node_geo_extrude_mesh_cc::vert_indices_from_edges().
|
inline |
Returns the number of keys stored in the vector set.
Definition at line 473 of file BLI_vector_set.hh.
Referenced by InstancesComponent::add_instance(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::clear(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::create_states_for_reachable_nodes(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::destruct_node_states(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::end(), blender::geometry::execute_realize_mesh_tasks(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_range(), blender::VectorSet< blender::bke::AttributeIDRef >::operator Span< blender::bke::AttributeIDRef >(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::operator[](), blender::geometry::preprocess_curves(), blender::geometry::preprocess_meshes(), blender::geometry::preprocess_pointclouds(), blender::tests::TEST(), blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::VectorSet(), and blender::VectorSet< Key, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::~VectorSet().
|
inline |
Returns the approximate memory requirements of the set in bytes. This is more correct for larger sets.
Definition at line 514 of file BLI_vector_set.hh.
|
inline |
Returns the bytes required per element. This is mostly for debugging purposes.
Definition at line 505 of file BLI_vector_set.hh.