Blender  V3.3
Public Member Functions | List of all members
blender::SimpleVectorSetSlot< Key > Class Template Reference

#include <BLI_vector_set_slots.hh>

Public Member Functions

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

Detailed Description

template<typename Key>
class blender::SimpleVectorSetSlot< Key >

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

Member Function Documentation

◆ contains()

template<typename Key >
template<typename ForwardKey , typename IsEqual >
bool blender::SimpleVectorSetSlot< Key >::contains ( const ForwardKey &  key,
const IsEqual &  is_equal,
uint64_t   UNUSEDhash,
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 74 of file BLI_vector_set_slots.hh.

◆ get_hash()

template<typename Key >
template<typename Hash >
uint64_t blender::SimpleVectorSetSlot< Key >::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 126 of file BLI_vector_set_slots.hh.

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

◆ has_index()

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

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

Definition at line 117 of file BLI_vector_set_slots.hh.

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

◆ index()

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

◆ is_empty()

template<typename Key >
bool blender::SimpleVectorSetSlot< Key >::is_empty ( ) const
inline

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

Definition at line 55 of file BLI_vector_set_slots.hh.

References s_is_empty.

◆ is_occupied()

template<typename Key >
bool blender::SimpleVectorSetSlot< Key >::is_occupied ( ) const
inline

◆ occupy()

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

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

Definition at line 89 of file BLI_vector_set_slots.hh.

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

◆ remove()

template<typename Key >
void blender::SimpleVectorSetSlot< Key >::remove ( )
inline

Change the state of this slot from occupied to removed.

Definition at line 108 of file BLI_vector_set_slots.hh.

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

◆ update_index()

template<typename Key >
void blender::SimpleVectorSetSlot< Key >::update_index ( int64_t  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 99 of file BLI_vector_set_slots.hh.

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


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