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::StringHeap Class Reference

#include <duckdb.hpp>

Collaboration diagram for duckdb::StringHeap:

Public Member Functions

DUCKDB_API StringHeap (Allocator &allocator=Allocator::DefaultAllocator())
DUCKDB_API void Destroy ()
DUCKDB_API void Move (StringHeap &other)
DUCKDB_API string_t AddString (const char *data, idx_t len)
 Add a string to the string heap, returns a pointer to the string.
DUCKDB_API string_t AddString (const char *data)
 Add a string to the string heap, returns a pointer to the string.
DUCKDB_API string_t AddString (const string &data)
 Add a string to the string heap, returns a pointer to the string.
DUCKDB_API string_t AddString (const string_t &data)
 Add a string to the string heap, returns a pointer to the string.
DUCKDB_API string_t AddBlob (const string_t &data)
 Add a blob to the string heap; blobs can be non-valid UTF8.
DUCKDB_API string_t AddBlob (const char *data, idx_t len)
 Add a blob to the string heap; blobs can be non-valid UTF8.
DUCKDB_API string_t EmptyString (idx_t len)
 Allocates space for an empty string of size "len" on the heap.
DUCKDB_API idx_t SizeInBytes () const
 Size of strings.
DUCKDB_API idx_t AllocationSize () const
 Total allocation size (cached).
DUCKDB_API ArenaAllocator & GetAllocator ()

Private Attributes

ArenaAllocator allocator

Detailed Description

A string heap is the owner of a set of strings, strings can be inserted into it On every insert, a pointer to the inserted string is returned The returned pointer will remain valid until the StringHeap is destroyed

Constructor & Destructor Documentation

◆ StringHeap()

duckdb::StringHeap::StringHeap ( Allocator & allocator = Allocator::DefaultAllocator())
explicit
128967 : allocator(allocator) {
128968}

Member Function Documentation

◆ Destroy()

void duckdb::StringHeap::Destroy ( )
128970 {
128971 allocator.Destroy();
128972}

◆ Move()

void duckdb::StringHeap::Move ( StringHeap & other)
128974 {
128975 other.allocator.Move(allocator);
128976}

◆ AddString() [1/4]

string_t duckdb::StringHeap::AddString ( const char * data,
idx_t len )

Add a string to the string heap, returns a pointer to the string.

128978 {
128979 D_ASSERT(Utf8Proc::Analyze(data, len) != UnicodeType::INVALID);
128980 return AddBlob(data, len);
128981}
DUCKDB_API string_t AddBlob(const string_t &data)
Add a blob to the string heap; blobs can be non-valid UTF8.
Definition duckdb.cpp:129003
static UnicodeType Analyze(const char *s, size_t len, UnicodeInvalidReason *invalid_reason=nullptr, size_t *invalid_pos=nullptr)
Distinguishes ASCII, Valid UTF8 and Invalid UTF8 strings.
Definition duckdb.cpp:507297
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddString() [2/4]

string_t duckdb::StringHeap::AddString ( const char * data)

Add a string to the string heap, returns a pointer to the string.

128983 {
128984 return AddString(data, strlen(data));
128985}
DUCKDB_API string_t AddString(const char *data, idx_t len)
Add a string to the string heap, returns a pointer to the string.
Definition duckdb.cpp:128978
Here is the call graph for this function:

◆ AddString() [3/4]

string_t duckdb::StringHeap::AddString ( const string & data)

Add a string to the string heap, returns a pointer to the string.

128987 {
128988 return AddString(data.c_str(), data.size());
128989}
Here is the call graph for this function:

◆ AddString() [4/4]

string_t duckdb::StringHeap::AddString ( const string_t & data)

Add a string to the string heap, returns a pointer to the string.

128991 {
128992 return AddString(data.GetData(), data.GetSize());
128993}
Here is the call graph for this function:

◆ AddBlob() [1/2]

string_t duckdb::StringHeap::AddBlob ( const string_t & data)

Add a blob to the string heap; blobs can be non-valid UTF8.

129003 {
129004 return AddBlob(data.GetData(), data.GetSize());
129005}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddBlob() [2/2]

string_t duckdb::StringHeap::AddBlob ( const char * data,
idx_t len )

Add a blob to the string heap; blobs can be non-valid UTF8.

128995 {
128996 auto insert_string = EmptyString(len);
128997 auto insert_pos = insert_string.GetDataWriteable();
128998 memcpy(insert_pos, data, len);
128999 insert_string.Finalize();
129000 return insert_string;
129001}
DUCKDB_API string_t EmptyString(idx_t len)
Allocates space for an empty string of size "len" on the heap.
Definition duckdb.cpp:129007
Here is the call graph for this function:

◆ EmptyString()

string_t duckdb::StringHeap::EmptyString ( idx_t len)

Allocates space for an empty string of size "len" on the heap.

129007 {
129008 D_ASSERT(len > string_t::INLINE_LENGTH);
129009 if (len > string_t::MAX_STRING_SIZE) {
129010 throw OutOfRangeException("Cannot create a string of size: '%d', the maximum supported string size is: '%d'",
129011 len, string_t::MAX_STRING_SIZE);
129012 }
129013 auto insert_pos = const_char_ptr_cast(allocator.Allocate(len));
129014 return string_t(insert_pos, UnsafeNumericCast<uint32_t>(len));
129015}
Here is the caller graph for this function:

◆ SizeInBytes()

idx_t duckdb::StringHeap::SizeInBytes ( ) const

Size of strings.

129017 {
129018 return allocator.SizeInBytes();
129019}

◆ AllocationSize()

idx_t duckdb::StringHeap::AllocationSize ( ) const

Total allocation size (cached).

129021 {
129022 return allocator.AllocationSize();
129023}

◆ GetAllocator()

DUCKDB_API ArenaAllocator & duckdb::StringHeap::GetAllocator ( )
inline
9636 {
9637 return allocator;
9638 }

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