| 
    B-Trees
    
   B-tree implementation in C++ to index documents based on numerical id's and title strings. 
   | 
 
B-tree node. More...
Public Member Functions | |
| void | initialize (bool isLeaf=true, int size=0) | 
| Initializes the node.  More... | |
| bool | isFull () const | 
| Checks if the node has reached its maximum capacity.  More... | |
| template<typename U > | |
| std::unique_ptr< T > | seek (const U &key, BTree &tree) const | 
| Seeks a value that's equivalent to the one provided.  More... | |
Public Attributes | |
| long | offset | 
| Disk address.  More... | |
| bool | isLeaf | 
| True if the node is a leaf, false if it's an internal node.  More... | |
| std::size_t | size | 
| Quantity of values currently stored in the node.  More... | |
| T | values [2 *M+1] | 
| Node values.  More... | |
| long | children [2 *M+2] | 
| Node pointers.  More... | |
B-tree node.
| void BTree< T, M, BlockSize >::BNode::initialize | ( | bool | isLeaf = true,  | 
        
| int | size = 0  | 
        ||
| ) | 
Initializes the node.
The value of BNode::offset is initialized as -1 so that we can know whether the node has already been written to the file or not.
This method must always be called upon declaring a BNode if it won't be read through BTree::readFromDisk.
BNode's initialization was implemented as a method rather than a constructor because BNode must be a POD in order to be serialized in the binary file, and POD's can't have constructors.
| isLeaf | True if the node will be a leaf, false if it will be an internal node | 
| size | Initial node size | 
| bool BTree< T, M, BlockSize >::BNode::isFull | ( | ) | const | 
Checks if the node has reached its maximum capacity.
| std::unique_ptr< T > BTree< T, M, BlockSize >::BNode::seek | ( | const U & | key, | 
| BTree & | tree | ||
| ) | const | 
Seeks a value that's equivalent to the one provided.
| U | See BTree::seek | 
| key | Value to seek | 
| tree | BTree to access the file and statistics | 
| long BTree< T, M, BlockSize >::BNode::children[2 *M+2] | 
Node pointers.
Most of the time, the node will only use the first 2M+1 positions of this array. The additional space for 1 value is used temporarily to deal with overflows during BTree::insert. 
| bool BTree< T, M, BlockSize >::BNode::isLeaf | 
True if the node is a leaf, false if it's an internal node.
| long BTree< T, M, BlockSize >::BNode::offset | 
Disk address.
Ideally, the node before written should have its offset set to -1. Only after its first writing should BNode::offset be set to its disk location.
| std::size_t BTree< T, M, BlockSize >::BNode::size | 
Quantity of values currently stored in the node.
| T BTree< T, M, BlockSize >::BNode::values[2 *M+1] | 
Node values.
Most of the time, the node will only be using the first 2M positions of this array. The additional space for 1 value is used temporarily to deal with overflows during BTree::insert. 
 1.8.11