|
Blender V5.0
|
#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) const |
| template<typename ForwardKey> | |
| void | occupy (ForwardKey &&key, uint64_t) |
| 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 33 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 48 of file BLI_set_slots.hh.
Referenced by SimpleSetSlot(), and SimpleSetSlot().
|
inline |
The destructor also has to destruct the key, if the slot is currently occupied.
Definition at line 56 of file BLI_set_slots.hh.
|
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 67 of file BLI_set_slots.hh.
References SimpleSetSlot().
|
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 80 of file BLI_set_slots.hh.
References SimpleSetSlot().
|
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 135 of file BLI_set_slots.hh.
References 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 124 of file BLI_set_slots.hh.
References BLI_assert, hash, and 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 115 of file BLI_set_slots.hh.
|
inline |
Return true if the slot currently contains a key.
Definition at line 107 of file BLI_set_slots.hh.
Referenced by get_hash(), occupy(), and remove().
|
inline |
Get a non-const pointer to the position where the key is stored.
Definition at line 91 of file BLI_set_slots.hh.
Referenced by contains(), and occupy().
|
inline |
Get a const pointer to the position where the key is stored.
Definition at line 99 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 147 of file BLI_set_slots.hh.
References BLI_assert, is_occupied(), and key().
|
inline |
Change the state of this slot from occupied to removed. The key has to be destructed as well.
Definition at line 157 of file BLI_set_slots.hh.
References BLI_assert, is_occupied(), and blender::TypedBuffer< T, Size >::ref().