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

Node256Leaf is a bitmask containing 256 bits. More...

Public Member Functions

 Node256Leaf (const Node256Leaf &)=delete
Node256Leaf & operator= (const Node256Leaf &)=delete
bool HasByte (const uint8_t byte)
 Returns true, if the byte exists, else false.
array_ptr< uint8_t > GetBytes (ArenaAllocator &arena)
bool GetNextByte (uint8_t &byte)

Static Public Member Functions

static NodeHandle< Node256Leaf > New (ART &art, Node &node)
 Get a new Node256Leaf handle and initialize the leaf.
static void InsertByte (ART &art, Node &node, const uint8_t byte)
 Insert a byte.
static void DeleteByte (ART &art, Node &node, const uint8_t byte)
 Delete a byte.

Static Public Attributes

static constexpr NType NODE_256_LEAF = NType::NODE_256_LEAF
static constexpr uint16_t CAPACITY = Node256::CAPACITY

Static Private Member Functions

static void GrowNode15Leaf (ART &art, Node &node256_leaf, Node &node15_leaf)

Private Attributes

uint16_t count
validity_t mask [CAPACITY/sizeof(validity_t)]

Friends

class Node15Leaf

Detailed Description

Node256Leaf is a bitmask containing 256 bits.

Member Function Documentation

◆ New()

NodeHandle< Node256Leaf > duckdb::Node256Leaf::New ( ART & art,
Node & node )
static

Get a new Node256Leaf handle and initialize the leaf.

155234 {
155235 node = Node::GetAllocator(art, NODE_256_LEAF).New();
155236 node.SetMetadata(static_cast<uint8_t>(NODE_256_LEAF));
155237
155238 NodeHandle<Node256Leaf> handle(art, node);
155239 auto &n = handle.Get();
155240
155241 n.count = 0;
155242 ValidityMask mask(&n.mask[0], Node256::CAPACITY);
155243 mask.SetAllInvalid(CAPACITY);
155244
155245 return handle;
155246}
IndexPointer New()
Get a new IndexPointer to a segment, might cause a new buffer allocation.
Definition duckdb.cpp:156189
void SetMetadata(const uint8_t metadata)
Set metadata (Bits 56-63).
Definition duckdb.hpp:22544
static FixedSizeAllocator & GetAllocator(const ART &art, const NType type)
Get a reference to the allocator.
Definition duckdb.cpp:154663
::uint8_t uint8_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InsertByte()

void duckdb::Node256Leaf::InsertByte ( ART & art,
Node & node,
const uint8_t byte )
static

Insert a byte.

155248 {
155249 NodeHandle<Node256Leaf> handle(art, node);
155250 auto &n = handle.Get();
155251
155252 n.count++;
155253 ValidityMask mask(&n.mask[0], Node256::CAPACITY);
155254 mask.SetValid(byte);
155255}
Here is the caller graph for this function:

◆ DeleteByte()

void duckdb::Node256Leaf::DeleteByte ( ART & art,
Node & node,
const uint8_t byte )
static

Delete a byte.

155257 {
155258 {
155259 NodeHandle<Node256Leaf> handle(art, node);
155260 auto &n = handle.Get();
155261
155262 n.count--;
155263 ValidityMask mask(&n.mask[0], Node256::CAPACITY);
155264 mask.SetInvalid(byte);
155265
155266 if (n.count > Node48::SHRINK_THRESHOLD) {
155267 return;
155268 }
155269 }
155270 // Shrink node to Node15.
155271 auto node256 = node;
155272 Node15Leaf::ShrinkNode256Leaf(art, node, node256);
155273}
static void ShrinkNode256Leaf(ART &art, Node &node15_leaf, Node &node256_leaf)
We shrink at <= Node48::SHRINK_THRESHOLD.
Definition duckdb.cpp:153599
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasByte()

bool duckdb::Node256Leaf::HasByte ( const uint8_t byte)

Returns true, if the byte exists, else false.

155275 {
155276 ValidityMask v_mask(&mask[0], Node256::CAPACITY);
155277 return v_mask.RowIsValid(byte);
155278}

◆ GetBytes()

array_ptr< uint8_t > duckdb::Node256Leaf::GetBytes ( ArenaAllocator & arena)

Returns a pointer to the bytes in the leaf. The pointer data is valid as long as the arena is valid.

155280 {
155281 auto mem = arena.AllocateAligned(sizeof(uint8_t) * count);
155282 array_ptr<uint8_t> bytes(mem, count);
155283
155284 ValidityMask v_mask(&mask[0], Node256::CAPACITY);
155285 uint16_t ptr_idx = 0;
155286 for (uint16_t i = 0; i < CAPACITY; i++) {
155287 if (v_mask.RowIsValid(i)) {
155288 bytes[ptr_idx++] = UnsafeNumericCast<uint8_t>(i);
155289 }
155290 }
155291
155292 return bytes;
155293}
::uint16_t uint16_t

◆ GetNextByte()

bool duckdb::Node256Leaf::GetNextByte ( uint8_t & byte)

Get the first byte greater or equal to the byte. Returns true, if such a byte exists, else false.

155295 {
155296 ValidityMask v_mask(&mask[0], Node256::CAPACITY);
155297 for (uint16_t i = byte; i < CAPACITY; i++) {
155298 if (v_mask.RowIsValid(i)) {
155299 byte = UnsafeNumericCast<uint8_t>(i);
155300 return true;
155301 }
155302 }
155303
155304 return false;
155305}

◆ GrowNode15Leaf()

void duckdb::Node256Leaf::GrowNode15Leaf ( ART & art,
Node & node256_leaf,
Node & node15_leaf )
staticprivate
155307 {
155308 {
155309 NodeHandle<Node15Leaf> n15_handle(art, node15_leaf);
155310 auto &n15 = n15_handle.Get();
155311
155312 auto n256_handle = New(art, node256_leaf);
155313 auto &n256 = n256_handle.Get();
155314 node256_leaf.SetGateStatus(node15_leaf.GetGateStatus());
155315
155316 n256.count = n15.count;
155317 ValidityMask mask(&n256.mask[0], Node256::CAPACITY);
155318 for (uint8_t i = 0; i < n15.count; i++) {
155319 mask.SetValid(n15.key[i]);
155320 }
155321 }
155322 Node::FreeNode(art, node15_leaf);
155323}
static NodeHandle< Node256Leaf > New(ART &art, Node &node)
Get a new Node256Leaf handle and initialize the leaf.
Definition duckdb.cpp:155234
static void FreeNode(ART &art, Node &node)
Free the node.
Definition duckdb.cpp:154622

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