Zip and Skip Tries
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node Struct Reference

Represents a single node within the SkipTrie structure. More...

#include <SkipTrie.hpp>

Collaboration diagram for SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node:
Collaboration graph
[legend]

Public Member Functions

size_t lcp (Direction direction) const noexcept
 Calculates the longest common prefix (LCP) with the neighbor node in the specified direction.
 
Nodenext_node (Direction direction) const noexcept
 Retrieves the neighboring node in the specified direction on the same level.
 

Public Attributes

const KEY_Tkey = nullptr
 Pointer to the key associated with this node. The SkipTrie does not own the key data.
 
std::shared_ptr< Nodenext {nullptr}
 Shared pointer to the next node on the same level.
 
Nodeprev = nullptr
 Raw pointer to the previous node on the same level.
 
std::shared_ptr< Nodedown {nullptr}
 Shared pointer to the corresponding node on the level below. Null for base level nodes.
 
size_t lcp_next {0}
 The Longest Common Prefix (LCP) length between this node's key and the next node's key on the same level.
 

Detailed Description

template<typename CHAR_T, unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
struct SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node

Represents a single node within the SkipTrie structure.

Each node stores a pointer to a key, pointers to its neighbors (next, previous, down), and the Longest Common Prefix (LCP) length with its immediate successor on the same level.

Definition at line 223 of file SkipTrie.hpp.

Member Function Documentation

◆ lcp()

template<typename CHAR_T , unsigned CHAR_SIZE_BITS>
size_t SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node::lcp ( Direction  direction) const
noexcept

Calculates the longest common prefix (LCP) with the neighbor node in the specified direction.

Parameters
directionThe direction (FORWARD or BACKWARD) relative to this node.
Returns
size_t The LCP length with the neighbor in the given direction. Returns 0 if there is no neighbor in that direction (e.g., lcp(BACKWARD) for the first node).

Definition at line 545 of file SkipTrie.hpp.

546{
548 {
549 // LCP with the next node is stored directly.
550 return lcp_next;
551 }
552
553 // LCP with the previous node is stored in the previous node's lcp_next.
554 return prev ? prev->lcp_next : 0;
555}
@ FORWARD
Represents traversal towards the end of the list (successor nodes).
T * alloc_to_device(size_t size)
Allocates memory on the CUDA device.
size_t lcp_next
The Longest Common Prefix (LCP) length between this node's key and the next node's key on the same le...
Definition SkipTrie.hpp:234
Node * prev
Raw pointer to the previous node on the same level.
Definition SkipTrie.hpp:230

◆ next_node()

template<typename CHAR_T , unsigned CHAR_SIZE_BITS>
SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node * SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node::next_node ( Direction  direction) const
noexcept

Retrieves the neighboring node in the specified direction on the same level.

Parameters
directionThe direction (FORWARD or BACKWARD) to retrieve the neighbor from.
Returns
Node* A pointer to the neighboring node, or nullptr if no neighbor exists in that direction (e.g., next_node(FORWARD) for the tail sentinel).

Definition at line 558 of file SkipTrie.hpp.

559{
561 {
562 return next.get();
563 }
564
565 return prev;
566}
std::shared_ptr< Node > next
Shared pointer to the next node on the same level.
Definition SkipTrie.hpp:228

Member Data Documentation

◆ down

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
std::shared_ptr<Node> SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node::down {nullptr}

Shared pointer to the corresponding node on the level below. Null for base level nodes.

Definition at line 232 of file SkipTrie.hpp.

232{nullptr};

◆ key

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
const KEY_T* SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node::key = nullptr

Pointer to the key associated with this node. The SkipTrie does not own the key data.

Definition at line 226 of file SkipTrie.hpp.

◆ lcp_next

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
size_t SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node::lcp_next {0}

The Longest Common Prefix (LCP) length between this node's key and the next node's key on the same level.

Definition at line 234 of file SkipTrie.hpp.

234{0};

◆ next

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
std::shared_ptr<Node> SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node::next {nullptr}

Shared pointer to the next node on the same level.

Definition at line 228 of file SkipTrie.hpp.

228{nullptr};

◆ prev

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
Node* SkipTrie< CHAR_T, CHAR_SIZE_BITS >::Node::prev = nullptr

Raw pointer to the previous node on the same level.

Definition at line 230 of file SkipTrie.hpp.


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