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::BaseNode< CAPACITY, TYPE > Class Template Reference
Collaboration diagram for duckdb::BaseNode< CAPACITY, TYPE >:

Public Member Functions

 BaseNode (const BaseNode &)=delete
 
BaseNodeoperator= (const BaseNode &)=delete
 
NodeChildren ExtractChildren (ArenaAllocator &arena)
 

Static Public Member Functions

static NodeHandle< BaseNodeNew (ART &art, Node &node)
 Get a new BaseNode handle and initialize the base node.
 
static void ReplaceChild (BaseNode &n, const uint8_t byte, const Node child)
 Replace the child at byte.
 
static unsafe_optional_ptr< NodeGetChild (BaseNode &n, const uint8_t byte, const bool unsafe=false)
 Get the child at byte.
 
static unsafe_optional_ptr< NodeGetNextChild (BaseNode &n, uint8_t &byte)
 Get the first child greater than or equal to the byte.
 
template<class F >
static void Iterator (BaseNode< CAPACITY, TYPE > &n, F &&lambda)
 

Static Private Member Functions

static void InsertChildInternal (BaseNode &n, const uint8_t byte, const Node child)
 
static NodeHandle< BaseNodeDeleteChildInternal (ART &art, Node &node, const uint8_t byte)
 

Private Attributes

uint8_t count
 
uint8_t key [CAPACITY]
 
Node children [CAPACITY]
 

Friends

class Node4
 
class Node16
 
class Node48
 

Member Function Documentation

◆ New()

template<uint8_t CAPACITY, NType TYPE>
static NodeHandle< BaseNode > duckdb::BaseNode< CAPACITY, TYPE >::New ( ART art,
Node node 
)
inlinestatic

Get a new BaseNode handle and initialize the base node.

57961 {
57962 node = Node::GetAllocator(art, TYPE).New();
57963 node.SetMetadata(static_cast<uint8_t>(TYPE));
57964
57965 NodeHandle<BaseNode> handle(art, node);
57966 auto &n = handle.Get();
57967
57968 // Reset the node (count).
57969 n.count = 0;
57970 // Zero-initialize the node.
57971 for (uint8_t i = 0; i < CAPACITY; i++) {
57972 n.key[i] = 0;
57973 n.children[i].Clear();
57974 }
57975
57976 return handle;
57977 }
static FixedSizeAllocator & GetAllocator(const ART &art, const NType type)
Get a reference to the allocator.
TYPE
::uint8_t uint8_t
Here is the call graph for this function:

◆ ReplaceChild()

template<uint8_t CAPACITY, NType TYPE>
static void duckdb::BaseNode< CAPACITY, TYPE >::ReplaceChild ( BaseNode< CAPACITY, TYPE > &  n,
const uint8_t  byte,
const Node  child 
)
inlinestatic

Replace the child at byte.

57980 {
57981 D_ASSERT(n.count != 0);
57982 for (uint8_t i = 0; i < n.count; i++) {
57983 if (n.key[i] == byte) {
57984 auto status = n.children[i].GetGateStatus();
57985 n.children[i] = child;
57986
57987 if (status == GateStatus::GATE_SET && child.HasMetadata()) {
57988 n.children[i].SetGateStatus(status);
57989 }
57990 return;
57991 }
57992 }
57993 }
Here is the call graph for this function:

◆ GetChild()

template<uint8_t CAPACITY, NType TYPE>
static unsafe_optional_ptr< Node > duckdb::BaseNode< CAPACITY, TYPE >::GetChild ( BaseNode< CAPACITY, TYPE > &  n,
const uint8_t  byte,
const bool  unsafe = false 
)
inlinestatic

Get the child at byte.

57996 {
57997 for (uint8_t i = 0; i < n.count; i++) {
57998 if (n.key[i] == byte) {
57999 if (!unsafe && !n.children[i].HasMetadata()) {
58000 throw InternalException("empty child i = %d for byte %d in BaseNode::GetChild", i, byte);
58001 }
58002 return &n.children[i];
58003 }
58004 }
58005 return nullptr;
58006 }
Here is the call graph for this function:

◆ GetNextChild()

template<uint8_t CAPACITY, NType TYPE>
static unsafe_optional_ptr< Node > duckdb::BaseNode< CAPACITY, TYPE >::GetNextChild ( BaseNode< CAPACITY, TYPE > &  n,
uint8_t byte 
)
inlinestatic

Get the first child greater than or equal to the byte.

58009 {
58010 for (uint8_t i = 0; i < n.count; i++) {
58011 if (n.key[i] >= byte) {
58012 byte = n.key[i];
58013 return &n.children[i];
58014 }
58015 }
58016 return nullptr;
58017 }

◆ ExtractChildren()

template<uint8_t CAPACITY, NType TYPE>
NodeChildren duckdb::BaseNode< CAPACITY, TYPE >::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.

58022 {
58023 auto mem_bytes = arena.AllocateAligned(sizeof(uint8_t) * count);
58024 array_ptr<uint8_t> bytes(mem_bytes, count);
58025 auto mem_children = arena.AllocateAligned(sizeof(Node) * count);
58026 array_ptr<Node> children_ptr(reinterpret_cast<Node *>(mem_children), count);
58027
58028 for (uint8_t i = 0; i < count; i++) {
58029 bytes[i] = key[i];
58030 children_ptr[i] = children[i];
58031 }
58032
58033 return NodeChildren(bytes, children_ptr);
58034 }

◆ Iterator()

template<uint8_t CAPACITY, NType TYPE>
template<class F >
static void duckdb::BaseNode< CAPACITY, TYPE >::Iterator ( BaseNode< CAPACITY, TYPE > &  n,
F &&  lambda 
)
inlinestatic
58038 {
58039 for (uint8_t i = 0; i < n.count; i++) {
58040 lambda(n.children[i]);
58041 }
58042 }

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