|
Blender
V2.93
|
#include <BLI_map_slots.hh>
Public Member Functions | |
| SimpleMapSlot () | |
| ~SimpleMapSlot () | |
| SimpleMapSlot (const SimpleMapSlot &other) | |
| SimpleMapSlot (SimpleMapSlot &&other) noexcept(std::is_nothrow_move_constructible_v< Key > &&std::is_nothrow_move_constructible_v< Value >) | |
| Key * | key () |
| const Key * | key () const |
| Value * | value () |
| const Value * | value () const |
| bool | is_occupied () const |
| bool | is_empty () const |
| template<typename Hash > | |
| uint64_t | get_hash (const Hash &hash) |
| template<typename ForwardKey , typename IsEqual > | |
| bool | contains (const ForwardKey &key, const IsEqual &is_equal, uint64_t UNUSED(hash)) const |
| template<typename ForwardKey , typename ForwardValue > | |
| void | occupy (ForwardKey &&key, ForwardValue &&value, uint64_t hash) |
| template<typename ForwardKey > | |
| void | occupy_no_value (ForwardKey &&key, uint64_t UNUSED(hash)) |
| void | remove () |
The simplest possible map slot. It stores the slot state and the optional key and value instances in separate variables. Depending on the alignment requirement of the key and value, many bytes might be wasted.
Definition at line 59 of file BLI_map_slots.hh.
|
inline |
After the default constructor has run, the slot has to be in the empty state.
Definition at line 75 of file BLI_map_slots.hh.
|
inline |
The destructor also has to destruct the key and value, if the slot is currently occupied.
Definition at line 83 of file BLI_map_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 and value have to be made as well.
Definition at line 95 of file BLI_map_slots.hh.
References blender::initialize_pointer_pair(), blender::TypedBuffer< T, Size >::ptr(), and blender::TypedBuffer< T, Size >::ref().
|
inlinenoexcept |
The move constructor has to copy the state. If the other slot was occupied, the key and value from the other have to moved as well. The other slot stays in the state it was in before. Its optionally stored key and value remain in a moved-from state.
Definition at line 111 of file BLI_map_slots.hh.
References blender::initialize_pointer_pair(), and blender::TypedBuffer< T, Size >::ptr().
|
inline |
Returns true, when this slot is occupied and contains a key that compares equal to the given key. The hash can be used by other slot implementations to determine inequality faster.
Definition at line 186 of file BLI_map_slots.hh.
References blender::SimpleMapSlot< Key, Value >::key().
|
inline |
Returns the hash of the currently stored key. In this simple map slot implementation, we just computed the hash here. Other implementations might store the hash in the slot instead.
Definition at line 175 of file BLI_map_slots.hh.
References BLI_assert, hash, and blender::SimpleMapSlot< Key, Value >::is_occupied().
|
inline |
Returns true if the slot is empty, i.e. it does not contain a key and is not in removed state.
Definition at line 166 of file BLI_map_slots.hh.
|
inline |
Returns true if the slot currently contains a key and a value.
Definition at line 158 of file BLI_map_slots.hh.
Referenced by blender::SimpleMapSlot< Key, Value >::get_hash(), blender::SimpleMapSlot< Key, Value >::occupy(), blender::SimpleMapSlot< Key, Value >::occupy_no_value(), and blender::SimpleMapSlot< Key, Value >::remove().
|
inline |
Returns a non-const pointer to the position where the key is stored.
Definition at line 126 of file BLI_map_slots.hh.
Referenced by blender::SimpleMapSlot< Key, Value >::contains(), blender::SimpleMapSlot< Key, Value >::occupy(), and blender::SimpleMapSlot< Key, Value >::occupy_no_value().
|
inline |
Returns a const pointer to the position where the key is stored.
Definition at line 134 of file BLI_map_slots.hh.
|
inline |
Change the state of this slot from empty/removed to occupied. The key/value has to be constructed by calling the constructor with the given key/value as parameter.
Definition at line 199 of file BLI_map_slots.hh.
References BLI_assert, hash, blender::SimpleMapSlot< Key, Value >::is_occupied(), blender::SimpleMapSlot< Key, Value >::key(), blender::SimpleMapSlot< Key, Value >::occupy_no_value(), blender::SimpleMapSlot< Key, Value >::value(), and Value.
|
inline |
Change the state of this slot from empty/removed to occupied. The value is assumed to be constructed already.
Definition at line 211 of file BLI_map_slots.hh.
References BLI_assert, blender::SimpleMapSlot< Key, Value >::is_occupied(), blender::SimpleMapSlot< Key, Value >::key(), and blender::TypedBuffer< T, Size >::ref().
Referenced by blender::SimpleMapSlot< Key, Value >::occupy().
|
inline |
Change the state of this slot from occupied to removed. The key and value have to be destructed as well.
Definition at line 229 of file BLI_map_slots.hh.
References BLI_assert, blender::SimpleMapSlot< Key, Value >::is_occupied(), and blender::TypedBuffer< T, Size >::ref().
|
inline |
Returns a non-const pointer to the position where the value is stored.
Definition at line 142 of file BLI_map_slots.hh.
References Value.
Referenced by blender::SimpleMapSlot< Key, Value >::occupy().
|
inline |
Returns a const pointer to the position where the value is stored.
Definition at line 150 of file BLI_map_slots.hh.
References Value.