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

Node256 holds up to 256 children. They are indexed by their key byte. More...

Collaboration diagram for duckdb::Node256:

Public Member Functions

 Node256 (const Node256 &)=delete
 
Node256operator= (const Node256 &)=delete
 
void ReplaceChild (const uint8_t byte, const Node child)
 Replace the child at byte.
 
NodeChildren ExtractChildren (ArenaAllocator &arena)
 

Static Public Member Functions

static NodeHandle< Node256New (ART &art, Node &node)
 Get a new Node256 handle and initialize the Node256.
 
static void InsertChild (ART &art, Node &node, const uint8_t byte, const Node child)
 Insert a child at byte.
 
static void DeleteChild (ART &art, Node &node, const uint8_t byte)
 Delete the child at byte.
 
template<class F , class NODE >
static void Iterator (NODE &n, F &&lambda)
 
template<class NODE >
static unsafe_optional_ptr< NodeGetChild (NODE &n, const uint8_t byte, const bool unsafe=false)
 
template<class NODE >
static unsafe_optional_ptr< NodeGetNextChild (NODE &n, uint8_t &byte)
 

Static Public Attributes

static constexpr NType NODE_256 = NType::NODE_256
 
static constexpr uint16_t CAPACITY = 256
 
static constexpr uint8_t SHRINK_THRESHOLD = 36
 

Static Private Member Functions

static void GrowNode48 (ART &art, Node &node256, Node &node48)
 

Private Attributes

uint16_t count
 
Node children [CAPACITY]
 

Friends

class Node48
 

Detailed Description

Node256 holds up to 256 children. They are indexed by their key byte.

Member Function Documentation

◆ New()

static NodeHandle< Node256 > duckdb::Node256::New ( ART art,
Node node 
)
inlinestatic

Get a new Node256 handle and initialize the Node256.

58137 {
58138 node = Node::GetAllocator(art, NODE_256).New();
58139 node.SetMetadata(static_cast<uint8_t>(NODE_256));
58140
58141 NodeHandle<Node256> handle(art, node);
58142 auto &n = handle.Get();
58143
58144 // Reset the node (count and children).
58145 n.count = 0;
58146 for (uint16_t i = 0; i < CAPACITY; i++) {
58147 n.children[i].Clear();
58148 }
58149
58150 return handle;
58151 }
static FixedSizeAllocator & GetAllocator(const ART &art, const NType type)
Get a reference to the allocator.
::uint8_t uint8_t
::uint16_t uint16_t
Here is the call graph for this function:

◆ ReplaceChild()

void duckdb::Node256::ReplaceChild ( const uint8_t  byte,
const Node  child 
)
inline

Replace the child at byte.

58158 {
58159 D_ASSERT(count > SHRINK_THRESHOLD);
58160 auto status = children[byte].GetGateStatus();
58161 children[byte] = child;
58162 if (status == GateStatus::GATE_SET && child.HasMetadata()) {
58163 children[byte].SetGateStatus(status);
58164 }
58165 }
GateStatus GetGateStatus() const
Returns the gate status of a node.
Definition duckdb.cpp:12046
void SetGateStatus(const GateStatus status)
Sets the gate status of a node.
Definition duckdb.cpp:12050
Here is the call graph for this function:

◆ Iterator()

template<class F , class NODE >
static void duckdb::Node256::Iterator ( NODE n,
F &&  lambda 
)
inlinestatic
58169 {
58170 D_ASSERT(n.count);
58171 for (idx_t i = 0; i < CAPACITY; i++) {
58172 if (n.children[i].HasMetadata()) {
58173 lambda(n.children[i]);
58174 }
58175 }
58176 }

◆ GetChild()

template<class NODE >
static unsafe_optional_ptr< Node > duckdb::Node256::GetChild ( NODE n,
const uint8_t  byte,
const bool  unsafe = false 
)
inlinestatic
58179 {
58180 if (unsafe) {
58181 return &n.children[byte];
58182 }
58183 if (n.children[byte].HasMetadata()) {
58184 return &n.children[byte];
58185 }
58186 return nullptr;
58187 }

◆ GetNextChild()

template<class NODE >
static unsafe_optional_ptr< Node > duckdb::Node256::GetNextChild ( NODE n,
uint8_t byte 
)
inlinestatic
58190 {
58191 for (idx_t i = byte; i < CAPACITY; i++) {
58192 if (n.children[i].HasMetadata()) {
58193 byte = UnsafeNumericCast<uint8_t>(i);
58194 return &n.children[i];
58195 }
58196 }
58197 return nullptr;
58198 }

◆ ExtractChildren()

NodeChildren duckdb::Node256::ExtractChildren ( ArenaAllocator arena)
inline

Extracts the bytes and their respective children. The return value is valid as long as the arena is valid. The node must be freed after calling into this function.

58203 {
58204 auto mem_bytes = arena.AllocateAligned(sizeof(uint8_t) * count);
58205 array_ptr<uint8_t> bytes(mem_bytes, count);
58206 auto mem_children = arena.AllocateAligned(sizeof(Node) * count);
58207 array_ptr<Node> children_ptr(reinterpret_cast<Node *>(mem_children), count);
58208
58209 uint16_t ptr_idx = 0;
58210 for (idx_t i = 0; i < CAPACITY; i++) {
58211 if (children[i].HasMetadata()) {
58212 bytes[ptr_idx] = UnsafeNumericCast<uint8_t>(i);
58213 children_ptr[ptr_idx] = children[i];
58214 ptr_idx++;
58215 }
58216 }
58217
58218 return NodeChildren(bytes, children_ptr);
58219 }

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