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::fixed_size_map_t< T > Class Template Reference

Alternative to perfect_map_t when min/max keys are integral, small, and known. More...

#include <duckdb.hpp>

Collaboration diagram for duckdb::fixed_size_map_t< T >:

Public Types

using key_type = idx_t
 
using mapped_type = T
 
using occupied_mask = TemplatedValidityMask< uint8_t >
 
using iterator = fixed_size_map_iterator< mapped_type, false >
 
using const_iterator = fixed_size_map_iterator< mapped_type, true >
 

Public Member Functions

 fixed_size_map_t (idx_t capacity_p=0)
 
idx_t size () const
 
void resize (idx_t capacity_p)
 
void clear ()
 
mapped_type & operator[] (const key_type &key)
 
const mapped_type & operator[] (const key_type &key) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator find (const key_type &index)
 
const_iterator find (const key_type &index) const
 

Private Attributes

idx_t capacity
 
idx_t count
 
occupied_mask occupied
 
unsafe_unique_array< mapped_type > values
 

Friends

class fixed_size_map_iterator< T, false >
 
class fixed_size_map_iterator< T, true >
 

Detailed Description

template<class T>
class duckdb::fixed_size_map_t< T >

Alternative to perfect_map_t when min/max keys are integral, small, and known.

Constructor & Destructor Documentation

◆ fixed_size_map_t()

template<class T >
duckdb::fixed_size_map_t< T >::fixed_size_map_t ( idx_t  capacity_p = 0)
inlineexplicit
46522 : capacity(capacity_p) {
46523 resize(capacity);
46524 }

Member Function Documentation

◆ size()

template<class T >
idx_t duckdb::fixed_size_map_t< T >::size ( ) const
inline
46526 { // NOLINT: match stl case
46527 return count;
46528 }

◆ resize()

template<class T >
void duckdb::fixed_size_map_t< T >::resize ( idx_t  capacity_p)
inline
46530 { // NOLINT: match stl case
46531 capacity = capacity_p;
46532 occupied = occupied_mask(capacity);
46533 values = make_unsafe_uniq_array_uninitialized<mapped_type>(capacity + 1);
46534 clear();
46535 }

◆ clear()

template<class T >
void duckdb::fixed_size_map_t< T >::clear ( )
inline
46537 { // NOLINT: match stl case
46538 count = 0;
46539 occupied.SetAllInvalid(capacity);
46540 }
void SetAllInvalid(idx_t count)
Marks exactly "count" bits in the validity mask as invalid (null)
Definition duckdb.hpp:9218

◆ operator[]() [1/2]

template<class T >
mapped_type & duckdb::fixed_size_map_t< T >::operator[] ( const key_type &  key)
inline
46542 {
46543 D_ASSERT(key < capacity);
46544 count += 1 - occupied.RowIsValidUnsafe(key);
46545 occupied.SetValidUnsafe(key);
46546 return values[key];
46547 }
void SetValidUnsafe(idx_t row_idx)
Same as SetValid, but skips a null check on validity_mask.
Definition duckdb.hpp:9132
bool RowIsValidUnsafe(idx_t row_idx) const
Definition duckdb.hpp:9109

◆ operator[]() [2/2]

template<class T >
const mapped_type & duckdb::fixed_size_map_t< T >::operator[] ( const key_type &  key) const
inline
46549 {
46550 D_ASSERT(key < capacity);
46551 return values[key];
46552 }

◆ begin() [1/2]

template<class T >
iterator duckdb::fixed_size_map_t< T >::begin ( )
inline
46554 { // NOLINT: match stl case
46555 iterator result(*this, 0);
46556 if (!occupied_mask::RowIsValid(occupied.GetValidityEntryUnsafe(0), 0)) {
46557 ++result;
46558 }
46559 return result;
46560 }

◆ begin() [2/2]

template<class T >
const_iterator duckdb::fixed_size_map_t< T >::begin ( ) const
inline
46562 { // NOLINT: match stl case
46563 const_iterator result(*this, 0);
46564 if (!occupied_mask::RowIsValid(occupied.GetValidityEntryUnsafe(0), 0)) {
46565 ++result;
46566 }
46567 return result;
46568 }

◆ end() [1/2]

template<class T >
iterator duckdb::fixed_size_map_t< T >::end ( )
inline
46570 { // NOLINT: match stl case
46571 return iterator(*this, capacity);
46572 }

◆ end() [2/2]

template<class T >
const_iterator duckdb::fixed_size_map_t< T >::end ( ) const
inline
46574 { // NOLINT: match stl case
46575 return const_iterator(*this, capacity);
46576 }

◆ find() [1/2]

template<class T >
iterator duckdb::fixed_size_map_t< T >::find ( const key_type &  index)
inline
46578 { // NOLINT: match stl case
46579 return occupied.RowIsValidUnsafe(index) ? iterator(*this, index) : end();
46580 }

◆ find() [2/2]

template<class T >
const_iterator duckdb::fixed_size_map_t< T >::find ( const key_type &  index) const
inline
46582 { // NOLINT: match stl case
46583 return occupied.RowIsValidUnsafe(index) ? const_iterator(*this, index) : end();
46584 }

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