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::HeapEntry< string_t > Struct Reference
Collaboration diagram for duckdb::HeapEntry< string_t >:

Public Member Functions

 HeapEntry (const HeapEntry &other)=delete
HeapEntry & operator= (const HeapEntry &other)=delete
 HeapEntry (HeapEntry &&other) noexcept
HeapEntry & operator= (HeapEntry &&other) noexcept
void Assign (ArenaAllocator &allocator, const string_t &new_val)

Public Attributes

string_t value
uint32_t capacity
data_ptr_t allocated_data

Constructor & Destructor Documentation

◆ HeapEntry() [1/2]

duckdb::HeapEntry< string_t >::HeapEntry ( )
inline
209800 : value(), capacity(0), allocated_data(nullptr) {
209801 }

◆ HeapEntry() [2/2]

duckdb::HeapEntry< string_t >::HeapEntry ( HeapEntry< string_t > && other)
inlinenoexcept
209808 {
209809 if (other.value.IsInlined()) {
209810 value = other.value;
209811 capacity = 0;
209812 allocated_data = nullptr;
209813 } else {
209814 capacity = other.capacity;
209815 allocated_data = other.allocated_data;
209816 value = string_t(const_char_ptr_cast(allocated_data), UnsafeNumericCast<uint32_t>(other.value.GetSize()));
209817 other.allocated_data = nullptr;
209818 }
209819 }
Definition duckdb.cpp:209785

Member Function Documentation

◆ operator=()

HeapEntry & duckdb::HeapEntry< string_t >::operator= ( HeapEntry< string_t > && other)
inlinenoexcept
209821 {
209822 if (other.value.IsInlined()) {
209823 value = other.value;
209824 } else {
209825 capacity = other.capacity;
209826 allocated_data = other.allocated_data;
209827 value = string_t(const_char_ptr_cast(allocated_data), UnsafeNumericCast<uint32_t>(other.value.GetSize()));
209828 other.allocated_data = nullptr;
209829 }
209830 return *this;
209831 }

◆ Assign()

void duckdb::HeapEntry< string_t >::Assign ( ArenaAllocator & allocator,
const string_t & new_val )
inline
209833 {
209834 if (new_val.IsInlined()) {
209835 value = new_val;
209836 return;
209837 }
209838
209839 // Short path for first assignment
209840 if (allocated_data == nullptr) {
209841 auto new_size = UnsafeNumericCast<uint32_t>(new_val.GetSize());
209843 if (new_capacity > string_t::MAX_STRING_SIZE) {
209844 throw InvalidInputException("Resulting string/blob too large!");
209845 }
209847 allocated_data = allocator.Allocate(capacity);
209848 memcpy(allocated_data, new_val.GetData(), new_size);
209849 value = string_t(const_char_ptr_cast(allocated_data), new_size);
209850 return;
209851 }
209852
209853 // double allocation until value fits
209854 if (capacity < new_val.GetSize()) {
209855 auto old_size = capacity;
209856 capacity *= 2;
209857 while (capacity < new_val.GetSize()) {
209858 capacity *= 2;
209859 }
209860 allocated_data = allocator.Reallocate(allocated_data, old_size, capacity);
209861 }
209862 auto new_size = UnsafeNumericCast<uint32_t>(new_val.GetSize());
209863 memcpy(allocated_data, new_val.GetData(), new_size);
209864 value = string_t(const_char_ptr_cast(allocated_data), new_size);
209865 }

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