Blender V4.3
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 35 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 78 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 130 of file BLI_vector_set_slots.hh.

References BLI_assert, hash, and blender::SimpleVectorSetSlot< Key, IndexT >::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 121 of file BLI_vector_set_slots.hh.

References blender::SimpleVectorSetSlot< Key, IndexT >::index().

◆ index()

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

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

References s_is_empty.

◆ is_occupied()

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

References BLI_assert, blender::SimpleVectorSetSlot< Key, IndexT >::index(), and blender::SimpleVectorSetSlot< Key, IndexT >::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 112 of file BLI_vector_set_slots.hh.

References BLI_assert, blender::SimpleVectorSetSlot< Key, IndexT >::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 103 of file BLI_vector_set_slots.hh.

References BLI_assert, blender::SimpleVectorSetSlot< Key, IndexT >::index(), and blender::SimpleVectorSetSlot< Key, IndexT >::is_occupied().


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