B-Trees
B-tree implementation in C++ to index documents based on numerical id's and title strings.
Typedefs | Functions
IdealBTree.hpp File Reference
#include "BTree.hpp"
Include dependency graph for IdealBTree.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

template<typename T , unsigned int BlockSize = BLOCK_SIZE>
using IdealBTree = BTree< T, maxBTreeOrder< T, BlockSize >(), BlockSize >
 BTree with ideal pre-calculated M order based on sizeof(T) More...
 

Functions

template<typename T , unsigned int BlockSize>
constexpr auto maxBTreeOrder ()
 Auxiliary function to calculate the max order of a BTree to store T-type values. More...
 

Typedef Documentation

template<typename T , unsigned int BlockSize = BLOCK_SIZE>
using IdealBTree = BTree<T, maxBTreeOrder<T, BlockSize>(), BlockSize>

BTree with ideal pre-calculated M order based on sizeof(T)

The nodes of such a BTree will be making the most out of their block space

Template Parameters
TType to be stored
BlockSizeBlock size in bytes

Function Documentation

template<typename T , unsigned int BlockSize>
constexpr auto maxBTreeOrder ( )

Auxiliary function to calculate the max order of a BTree to store T-type values.

The calculation is done based on BlockSize, the result being the max order you can have for your tree without having your node exceed BlockSize in bytes.

We arrived at it through the following initial formula:

BlockSize = sizeof(long) + sizeof(bool) + sizeof(std::size_t) + (2 * M + 1) * sizeof(T) + (2 * M + 2) * sizeof(long)

This formula takes into account the size of members of a BTree::BNode.

Template Parameters
TType that will be stored in BTree
BlockSizeSize in bytes
Returns
Calculation result