lab_btree
Belligerent BTrees
BTree< K, V >::BTreeNode Struct Reference

A class for the basic node structure of the BTree. More...

Collaboration diagram for BTree< K, V >::BTreeNode:
[legend]

Public Member Functions

 BTreeNode (bool is_leaf, unsigned int order)
 Constructs a BTreeNode. More...
 
 BTreeNode (const BTreeNode &other)
 Constructs a BTreeNode based on another. More...
 

Public Attributes

bool is_leaf
 
std::vector< DataPairelements
 
std::vector< BTreeNode * > children
 

Friends

std::ostreamoperator<< (std::ostream &out, const BTreeNode &n)
 Printing operator for a BTreeNode. More...
 

Detailed Description

template<class K, class V>
struct BTree< K, V >::BTreeNode

A class for the basic node structure of the BTree.

A node contains two vectors, one with DataPairs representing the data, and one of BTreeNode*s, representing the node's children.

Constructor & Destructor Documentation

◆ BTreeNode() [1/2]

template<class K , class V >
BTree< K, V >::BTreeNode::BTreeNode ( bool  is_leaf,
unsigned int  order 
)
inline

Constructs a BTreeNode.

The vectors will reserve to avoid reallocations.

◆ BTreeNode() [2/2]

template<class K , class V >
BTree< K, V >::BTreeNode::BTreeNode ( const BTreeNode other)
inline

Constructs a BTreeNode based on another.

Only copies over the elements and is_leaf information.

Friends And Related Function Documentation

◆ operator<<

template<class K , class V >
std::ostream& operator<< ( std::ostream out,
const BTreeNode n 
)
friend

Printing operator for a BTreeNode.

E.g. a node containing 4, 5, 6 would look like:

| 4 | 5 | 6 |
*   *   *   *

The stars below the bars represent non-null child pointers. Null child pointers are represented by an "N". If there are no children then "no children" is displayed instead.

Parameters
outThe ostream to be written to.
nThe node to be printed.
Returns
The modified ostream.

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