b-tree-plus-alpha
Loading...
Searching...
No Matches
bp_node_pointer.hpp
1#pragma once
2#include "./bp_internal_node.hpp"
3
4namespace stool
5{
6 namespace bptree
7 {
12 template <typename LEAF_CONTAINER, typename VALUE, uint64_t MAX_DEGREE, bool USE_PSUM>
14 {
16 Node *node_;
17 int16_t parent_edge_index_;
18 bool is_leaf_;
19
20 public:
22 {
23 }
24
25 static BPNodePointer build_internal_node_pointer(Node *_node, int16_t _parent_edge_index)
26 {
28 r.node_ = _node;
29 r.parent_edge_index_ = _parent_edge_index;
30 r.is_leaf_ = false;
31 return r;
32 }
33 static BPNodePointer build_leaf_pointer(uint64_t _leaf_container_index, int16_t _parent_edge_index)
34 {
36 r.node_ = (Node *)_leaf_container_index;
37 r.parent_edge_index_ = _parent_edge_index;
38 r.is_leaf_ = true;
39 return r;
40 }
41
42 uint64_t get_parent_edge_index() const
43 {
44 return this->parent_edge_index_;
45 }
46 Node *get_node() const
47 {
48 return this->node_;
49 }
50
51 bool is_leaf() const
52 {
53 return this->is_leaf_;
54 }
55
56 uint64_t get_leaf_container_index() const
57 {
58 return (uint64_t)this->node_;
59 }
60 uint64_t get_degree(const std::vector<LEAF_CONTAINER> &leaf_container_vec) const
61 {
62 if (this->is_leaf())
63 {
64 return leaf_container_vec[this->get_leaf_container_index()].size();
65 }
66 else
67 {
68 return this->get_node()->get_degree();
69 }
70 }
71 };
72 }
73}
The internal node of BPTree [Unchecked AI's Comment].
Definition bp_internal_node.hpp:15
A pointer to a node of BPTree [Unchecked AI's Comment].
Definition bp_node_pointer.hpp:14