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::ConstPrefixHandle Class Reference
Collaboration diagram for duckdb::ConstPrefixHandle:

Public Member Functions

 ConstPrefixHandle (const ART &art, const Node node)
 ConstPrefixHandle (const ConstPrefixHandle &)=delete
ConstPrefixHandle & operator= (const ConstPrefixHandle &)=delete
 ConstPrefixHandle (ConstPrefixHandle &&)=delete
ConstPrefixHandle & operator= (ConstPrefixHandle &&)=delete
uint8_t GetCount (const ART &art) const
uint8_t GetByte (const idx_t pos) const

Static Public Member Functions

static void Verify (ART &art, const Node &node)
 Traverses and verifies the node and its subtree.
static string ToString (ART &art, const Node &node, const ToStringOptions &options)
 Returns the string representation of the node using ToStringOptions.

Static Public Attributes

static constexpr NType PREFIX = NType::PREFIX

Static Private Member Functions

template<class F>
static void Iterator (ART &art, reference< const Node > &ref, const bool exit_gate, F &&lambda)

Private Attributes

SegmentHandle segment_handle
data_ptr_t data
Node * child

Detailed Description

ConstPrefixHandle is a read-only wrapper to access a prefix node. The prefix contains up to the ART's prefix size bytes, an additional byte for the count, and a Node pointer to a child node. A segment handle is used for memory management, but it is not marked as modified.

Constructor & Destructor Documentation

◆ ConstPrefixHandle()

duckdb::ConstPrefixHandle::ConstPrefixHandle ( const ART & art,
const Node node )
153883 : segment_handle(Node::GetAllocator(art, PREFIX).GetHandle(node)) {
153884 data = segment_handle.GetPtr();
153885 child = reinterpret_cast<Node *>(data + art.PrefixCount() + 1);
153886 // Read-only: don't mark segment as modified
153887}
static FixedSizeAllocator & GetAllocator(const ART &art, const NType type)
Get a reference to the allocator.
Definition duckdb.cpp:154663

Member Function Documentation

◆ GetCount()

uint8_t duckdb::ConstPrefixHandle::GetCount ( const ART & art) const
153889 {
153890 return data[art.PrefixCount()];
153891}

◆ GetByte()

uint8_t duckdb::ConstPrefixHandle::GetByte ( const idx_t pos) const
153893 {
153894 return data[pos];
153895}

◆ Verify()

void duckdb::ConstPrefixHandle::Verify ( ART & art,
const Node & node )
static

Traverses and verifies the node and its subtree.

153926 {
153927 reference<const Node> ref(node);
153928
153929 Iterator(art, ref, true, [&](const ConstPrefixHandle &handle) {
153930 D_ASSERT(handle.data[art.PrefixCount()] != 0);
153931 D_ASSERT(handle.data[art.PrefixCount()] <= art.PrefixCount());
153932 });
153933
153934 ref.get().Verify(art);
153935}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

string duckdb::ConstPrefixHandle::ToString ( ART & art,
const Node & node,
const ToStringOptions & options )
static

Returns the string representation of the node using ToStringOptions.

153897 {
153898 auto indent = [](string &str, const idx_t n) {
153899 str.append(n, ' ');
153900 };
153901 auto format_byte = [&](const uint8_t byte) {
153902 if (!options.inside_gate && options.display_ascii && byte >= 32 && byte <= 126) {
153903 return string(1, static_cast<char>(byte));
153904 }
153905 return to_string(byte);
153906 };
153907
153908 string str = "";
153909 indent(str, options.indent_level);
153910 reference<const Node> ref(node);
153911 ToStringOptions child_options = options;
153912 Iterator(art, ref, true, [&](const ConstPrefixHandle &handle) {
153913 str += "Prefix: |";
153914 for (idx_t i = 0; i < handle.data[art.PrefixCount()]; i++) {
153915 str += format_byte(handle.data[i]) + "|";
153916 if (options.key_path) {
153917 child_options.key_depth++;
153918 }
153919 }
153920 });
153921
153922 auto child = ref.get().ToString(art, child_options);
153923 return str + "\n" + child;
153924}
std::string to_string(const T &value)
Definition duckdb.cpp:19425
::uint8_t uint8_t
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Iterator()

template<class F>
void duckdb::ConstPrefixHandle::Iterator ( ART & art,
reference< const Node > & ref,
const bool exit_gate,
F && lambda )
inlinestaticprivate
153856 {
153857 while (ref.get().HasMetadata() && ref.get().GetType() == PREFIX) {
153858 ConstPrefixHandle handle(art, ref);
153859 lambda(handle);
153860
153861 ref = *handle.child;
153862 if (exit_gate && ref.get().GetGateStatus() == GateStatus::GATE_SET) {
153863 break;
153864 }
153865 }
153866 }

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