Blender V5.0
blender::SimpleVectorSetSlot< Key, IndexT > Class Template Reference

#include <BLI_vector_set_slots.hh>

Public Member Functions

bool is_occupied () const
bool is_empty () const
IndexT index () const
template<typename ForwardKey, typename IsEqual>
bool contains (const ForwardKey &key, const IsEqual &is_equal, uint64_t, const Key *keys) const
void occupy (IndexT index, uint64_t)
void update_index (IndexT index)
void remove ()
bool has_index (IndexT index) const
template<typename Hash>
uint64_t get_hash (const Key &key, const Hash &hash) const

Detailed Description

template<typename Key, typename IndexT = int64_t>
class blender::SimpleVectorSetSlot< Key, IndexT >

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 36 of file BLI_vector_set_slots.hh.

Member Function Documentation

◆ contains()

template<typename Key, typename IndexT = int64_t>
template<typename ForwardKey, typename IsEqual>
bool blender::SimpleVectorSetSlot< Key, IndexT >::contains ( const ForwardKey & key,
const IsEqual & is_equal,
uint64_t ,
const Key * keys ) const
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 79 of file BLI_vector_set_slots.hh.

◆ get_hash()

template<typename Key, typename IndexT = int64_t>
template<typename Hash>
uint64_t blender::SimpleVectorSetSlot< Key, IndexT >::get_hash ( const Key & key,
const Hash & hash ) const
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 131 of file BLI_vector_set_slots.hh.

References BLI_assert, hash, and is_occupied().

◆ has_index()

template<typename Key, typename IndexT = int64_t>
bool blender::SimpleVectorSetSlot< Key, IndexT >::has_index ( IndexT index) const
inline

Return true if this slot is currently occupied and its corresponding key has the given index.

Definition at line 122 of file BLI_vector_set_slots.hh.

References index().

◆ index()

template<typename Key, typename IndexT = int64_t>
IndexT blender::SimpleVectorSetSlot< Key, IndexT >::index ( ) const
inline

Return the stored index. It is assumed that the slot is occupied.

Definition at line 68 of file BLI_vector_set_slots.hh.

References BLI_assert, and is_occupied().

Referenced by has_index(), occupy(), and update_index().

◆ is_empty()

template<typename Key, typename IndexT = int64_t>
bool blender::SimpleVectorSetSlot< Key, IndexT >::is_empty ( ) const
inline

Return true if the slot is empty, i.e. it does not contain an index.

Definition at line 60 of file BLI_vector_set_slots.hh.

References s_is_empty.

◆ is_occupied()

template<typename Key, typename IndexT = int64_t>
bool blender::SimpleVectorSetSlot< Key, IndexT >::is_occupied ( ) const
inline

Return true if this slot contains an index to a key.

Definition at line 52 of file BLI_vector_set_slots.hh.

Referenced by get_hash(), index(), occupy(), remove(), and update_index().

◆ occupy()

template<typename Key, typename IndexT = int64_t>
void blender::SimpleVectorSetSlot< Key, IndexT >::occupy ( IndexT index,
uint64_t  )
inline

Change the state of this slot from empty/removed to occupied. The hash can be used by other slot implementations.

Definition at line 94 of file BLI_vector_set_slots.hh.

References BLI_assert, index(), and is_occupied().

◆ remove()

template<typename Key, typename IndexT = int64_t>
void blender::SimpleVectorSetSlot< Key, IndexT >::remove ( )
inline

Change the state of this slot from occupied to removed.

Definition at line 113 of file BLI_vector_set_slots.hh.

References BLI_assert, is_occupied(), and s_is_removed.

◆ update_index()

template<typename Key, typename IndexT = int64_t>
void blender::SimpleVectorSetSlot< Key, IndexT >::update_index ( IndexT index)
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 104 of file BLI_vector_set_slots.hh.

References BLI_assert, index(), and is_occupied().


The documentation for this class was generated from the following file: