Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::ht_entry_t Struct Reference

The ht_entry_t struct represents an individual entry within a hash table. More...

Public Member Functions

 ht_entry_t (hash_t value_p) noexcept
 ht_entry_t (const hash_t &salt, const data_ptr_t &pointer)
bool IsOccupied () const
data_ptr_t GetPointer () const
 Returns a pointer based on the stored value (asserts if the cell is occupied).
data_ptr_t GetPointerOrNull () const
 Returns a pointer based on the stored value.
void SetPointer (const data_ptr_t &pointer)
hash_t GetSalt () const
hash_t GetSaltWithNulls () const
void SetSalt (const hash_t &salt)

Static Public Member Functions

static hash_t ExtractSalt (const hash_t &hash)

Static Public Attributes

static constexpr const hash_t SALT_MASK = 0xFFFF000000000000
 Upper 16 bits are salt, lower 48 bits are the pointer.
static constexpr const hash_t POINTER_MASK = 0x0000FFFFFFFFFFFF

Private Attributes

hash_t value

Detailed Description

The ht_entry_t struct represents an individual entry within a hash table.

This struct is used by the JoinHashTable and AggregateHashTable to store entries within the hash table. It stores a pointer to the data and a salt value in a single hash_t and can return or modify the pointer and salt individually.

Constructor & Destructor Documentation

◆ ht_entry_t() [1/3]

duckdb::ht_entry_t::ht_entry_t ( )
inlinenoexcept
145724 : value(0) {
145725 }

◆ ht_entry_t() [2/3]

duckdb::ht_entry_t::ht_entry_t ( hash_t value_p)
inlineexplicitnoexcept
145727 : value(value_p) {
145728 }

◆ ht_entry_t() [3/3]

duckdb::ht_entry_t::ht_entry_t ( const hash_t & salt,
const data_ptr_t & pointer )
inline
145731 : value(cast_pointer_to_uint64(pointer) | (salt & SALT_MASK)) {
145732 }
static constexpr const hash_t SALT_MASK
Upper 16 bits are salt, lower 48 bits are the pointer.
Definition duckdb.cpp:145720

Member Function Documentation

◆ IsOccupied()

bool duckdb::ht_entry_t::IsOccupied ( ) const
inline
145734 {
145735 return value != 0;
145736 }

◆ GetPointer()

data_ptr_t duckdb::ht_entry_t::GetPointer ( ) const
inline

Returns a pointer based on the stored value (asserts if the cell is occupied).

145739 {
145740 D_ASSERT(IsOccupied());
145741 return GetPointerOrNull();
145742 }
data_ptr_t GetPointerOrNull() const
Returns a pointer based on the stored value.
Definition duckdb.cpp:145745
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPointerOrNull()

data_ptr_t duckdb::ht_entry_t::GetPointerOrNull ( ) const
inline

Returns a pointer based on the stored value.

145745 {
145746 return cast_uint64_to_pointer(value & POINTER_MASK);
145747 }
Here is the caller graph for this function:

◆ SetPointer()

void duckdb::ht_entry_t::SetPointer ( const data_ptr_t & pointer)
inline
145749 {
145750 // Pointer shouldn't use upper bits
145751 D_ASSERT((cast_pointer_to_uint64(pointer) & SALT_MASK) == 0);
145752 // Value should have all 1's in the pointer area
145753 D_ASSERT((value & POINTER_MASK) == POINTER_MASK);
145754 // Set upper bits to 1 in pointer so the salt stays intact
145755 value &= cast_pointer_to_uint64(pointer) | SALT_MASK;
145756 }

◆ ExtractSalt()

hash_t duckdb::ht_entry_t::ExtractSalt ( const hash_t & hash)
inlinestatic
145759 {
145760 return hash | POINTER_MASK;
145761 }

◆ GetSalt()

hash_t duckdb::ht_entry_t::GetSalt ( ) const
inline
145763 {
145764 return ExtractSalt(value);
145765 }

◆ GetSaltWithNulls()

hash_t duckdb::ht_entry_t::GetSaltWithNulls ( ) const
inline
145767 {
145768 return value & SALT_MASK;
145769 }

◆ SetSalt()

void duckdb::ht_entry_t::SetSalt ( const hash_t & salt)
inline
145771 {
145772 // Shouldn't be occupied when we set this
145773 D_ASSERT(!IsOccupied());
145774 // Salt should have all 1's in the pointer field
145775 D_ASSERT((salt & POINTER_MASK) == POINTER_MASK);
145776 // No need to mask, just put the whole thing there
145777 value = salt;
145778 }

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