Blender
V3.3
|
#include <BLI_set_slots.hh>
Public Member Functions | |
SimpleSetSlot () | |
~SimpleSetSlot () | |
SimpleSetSlot (const SimpleSetSlot &other) | |
SimpleSetSlot (SimpleSetSlot &&other) noexcept(std::is_nothrow_move_constructible_v< Key >) | |
Key * | key () |
const Key * | key () const |
bool | is_occupied () const |
bool | is_empty () const |
template<typename Hash > | |
uint64_t | get_hash (const Hash &hash) const |
template<typename ForwardKey , typename IsEqual > | |
bool | contains (const ForwardKey &key, const IsEqual &is_equal, uint64_t UNUSED(hash)) const |
template<typename ForwardKey > | |
void | occupy (ForwardKey &&key, uint64_t UNUSED(hash)) |
void | remove () |
The simplest possible set slot. It stores the slot state and the optional key instance in separate variables. Depending on the alignment requirement of the key, many bytes might be wasted.
Definition at line 30 of file BLI_set_slots.hh.
|
inline |
After the default constructor has run, the slot has to be in the empty state.
Definition at line 45 of file BLI_set_slots.hh.
|
inline |
The destructor also has to destruct the key, if the slot is currently occupied.
Definition at line 53 of file BLI_set_slots.hh.
References blender::TypedBuffer< T, Size >::ref().
|
inline |
The copy constructor has to copy the state. If the other slot was occupied, a copy of the key has to be made as well.
Definition at line 64 of file BLI_set_slots.hh.
|
inlinenoexcept |
The move constructor has to copy the state. If the other slot was occupied, the key from the other slot has to be moved as well. The other slot stays in the state it was in before. Its optionally stored key remains in a moved-from state.
Definition at line 77 of file BLI_set_slots.hh.
|
inline |
Return true, when this slot is occupied and contains a key that compares equal to the given key. The hash is used by other slot implementations to determine inequality faster.
Definition at line 132 of file BLI_set_slots.hh.
References blender::SimpleSetSlot< Key >::key().
|
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 121 of file BLI_set_slots.hh.
References BLI_assert, hash, and blender::SimpleSetSlot< Key >::is_occupied().
|
inline |
Return true if the slot is empty, i.e. it does not contain a key and is not in removed state.
Definition at line 112 of file BLI_set_slots.hh.
|
inline |
Return true if the slot currently contains a key.
Definition at line 104 of file BLI_set_slots.hh.
Referenced by blender::SimpleSetSlot< Key >::get_hash(), blender::SimpleSetSlot< Key >::occupy(), and blender::SimpleSetSlot< Key >::remove().
|
inline |
Get a non-const pointer to the position where the key is stored.
Definition at line 88 of file BLI_set_slots.hh.
Referenced by blender::SimpleSetSlot< Key >::contains(), and blender::SimpleSetSlot< Key >::occupy().
|
inline |
Get a const pointer to the position where the key is stored.
Definition at line 96 of file BLI_set_slots.hh.
|
inline |
Change the state of this slot from empty/removed to occupied. The key has to be constructed by calling the constructor with the given key as parameter.
Definition at line 144 of file BLI_set_slots.hh.
References BLI_assert, blender::SimpleSetSlot< Key >::is_occupied(), and blender::SimpleSetSlot< Key >::key().
|
inline |
Change the state of this slot from occupied to removed. The key has to be destructed as well.
Definition at line 154 of file BLI_set_slots.hh.
References BLI_assert, blender::SimpleSetSlot< Key >::is_occupied(), and blender::TypedBuffer< T, Size >::ref().