Blender
V3.3
|
#include <BLI_vector_set_slots.hh>
Public Member Functions | |
bool | is_occupied () const |
bool | is_empty () const |
int64_t | index () const |
template<typename ForwardKey , typename IsEqual > | |
bool | contains (const ForwardKey &key, const IsEqual &is_equal, uint64_t UNUSED(hash), const Key *keys) const |
void | occupy (int64_t index, uint64_t UNUSED(hash)) |
void | update_index (int64_t index) |
void | remove () |
bool | has_index (int64_t index) const |
template<typename Hash > | |
uint64_t | get_hash (const Key &key, const Hash &hash) const |
The simplest possible vector set slot. It stores the index and state in a signed integer. If the value is negative, it represents empty or occupied state. Otherwise it represents the index.
Definition at line 33 of file BLI_vector_set_slots.hh.
|
inline |
Return true if the slot contains the given key, i.e. its index points to a key that compares equal to it. The hash can be used by other implementations to determine inequality faster.
Definition at line 74 of file BLI_vector_set_slots.hh.
|
inline |
Return the hash of the currently stored key. In this simple set slot implementation, we just compute the hash here. Other implementations might store the hash in the slot instead.
Definition at line 126 of file BLI_vector_set_slots.hh.
References BLI_assert, hash, and blender::SimpleVectorSetSlot< Key >::is_occupied().
|
inline |
Return true if this slot is currently occupied and its corresponding key has the given index.
Definition at line 117 of file BLI_vector_set_slots.hh.
References blender::SimpleVectorSetSlot< Key >::index().
|
inline |
Return the stored index. It is assumed that the slot is occupied.
Definition at line 63 of file BLI_vector_set_slots.hh.
References BLI_assert, and blender::SimpleVectorSetSlot< Key >::is_occupied().
Referenced by blender::SimpleVectorSetSlot< Key >::has_index(), blender::SimpleVectorSetSlot< Key >::occupy(), and blender::SimpleVectorSetSlot< Key >::update_index().
|
inline |
Return true if the slot is empty, i.e. it does not contain an index.
Definition at line 55 of file BLI_vector_set_slots.hh.
References s_is_empty.
|
inline |
Return true if this slot contains an index to a key.
Definition at line 47 of file BLI_vector_set_slots.hh.
Referenced by blender::SimpleVectorSetSlot< Key >::get_hash(), blender::SimpleVectorSetSlot< Key >::index(), blender::SimpleVectorSetSlot< Key >::occupy(), blender::SimpleVectorSetSlot< Key >::remove(), and blender::SimpleVectorSetSlot< Key >::update_index().
|
inline |
Change the state of this slot from empty/removed to occupied. The hash can be used by other slot implementations.
Definition at line 89 of file BLI_vector_set_slots.hh.
References BLI_assert, blender::SimpleVectorSetSlot< Key >::index(), and blender::SimpleVectorSetSlot< Key >::is_occupied().
|
inline |
Change the state of this slot from occupied to removed.
Definition at line 108 of file BLI_vector_set_slots.hh.
References BLI_assert, blender::SimpleVectorSetSlot< Key >::is_occupied(), and s_is_removed.
|
inline |
The key has changed its position in the vector, so the index has to be updated. This method can assume that the slot is currently occupied.
Definition at line 99 of file BLI_vector_set_slots.hh.
References BLI_assert, blender::SimpleVectorSetSlot< Key >::index(), and blender::SimpleVectorSetSlot< Key >::is_occupied().