PST File Format SDK v0.4
Loading...
Searching...
No Matches
pstsdk::btree_node_leaf< K, V > Class Template Referenceabstract

Represents a leaf node in a BTree structure. More...

#include <btree.h>

+ Inheritance diagram for pstsdk::btree_node_leaf< K, V >:
+ Collaboration diagram for pstsdk::btree_node_leaf< K, V >:

Public Member Functions

virtual ~btree_node_leaf ()
 
const V & lookup (const K &key) const
 Looks up the associated value for a given key.
 
virtual const V & get_value (uint pos) const =0
 Returns the value at the associated position on this leaf node.
 
- Public Member Functions inherited from pstsdk::btree_node< K, V >
virtual ~btree_node ()
 
virtual const K & get_key (uint pos) const =0
 Returns the key at the specified position.
 
virtual uint num_values () const =0
 Returns the number of entries in this btree_node.
 
const_iterator begin () const
 Returns a STL style iterator positioned at the first entry.
 
const_iterator end () const
 Returns a STL style iterator positioned at the "end" entry.
 
int binary_search (const K &key) const
 Performs a binary search over the keys of this btree_node.
 

Protected Member Functions

void first (btree_iter_impl< K, V > &iter) const
 Positions the iterator at the first element on this tree.
 
void last (btree_iter_impl< K, V > &iter) const
 Positions the iterator at the "end" element.
 
void next (btree_iter_impl< K, V > &iter) const
 Moves the iterator to the next element.
 
void prev (btree_iter_impl< K, V > &iter) const
 Moves the iterator to the previous element.
 

Friends

class const_btree_node_iter< K, V >
 

Additional Inherited Members

- Public Types inherited from pstsdk::btree_node< K, V >
typedef const_btree_node_iter< K, V > const_iterator
 

Detailed Description

template<typename K, typename V>
class pstsdk::btree_node_leaf< K, V >

Represents a leaf node in a BTree structure.

Classes which model a leaf of a BTree structure inherit from this. They have a total of three simple virtual functions to implement:

  • num_values, from btree_node
  • get_key(uint pos), from btree_node
  • get_value(uint pos)
    Parameters
    KThe key type. Must be LessThan comparable.
    VThe value type

Definition at line 131 of file btree.h.

Constructor & Destructor Documentation

◆ ~btree_node_leaf()

template<typename K , typename V >
virtual pstsdk::btree_node_leaf< K, V >::~btree_node_leaf ( )
inlinevirtual

Definition at line 134 of file btree.h.

Member Function Documentation

◆ first()

template<typename K , typename V >
void pstsdk::btree_node_leaf< K, V >::first ( btree_iter_impl< K, V > &  iter) const
inlineprotectedvirtual

Positions the iterator at the first element on this tree.

Parameters
[in,out]iterIterator state class

Implements pstsdk::btree_node< K, V >.

Definition at line 151 of file btree.h.

◆ get_value()

template<typename K , typename V >
virtual const V & pstsdk::btree_node_leaf< K, V >::get_value ( uint  pos) const
pure virtual

Returns the value at the associated position on this leaf node.

Parameters
[in]posThe position to retrieve the value for
Returns
The value at the requested position

Implemented in pstsdk::bth_leaf_node< K, V >, pstsdk::subnode_leaf_block, and pstsdk::bt_leaf_page< K, V >.

◆ last()

template<typename K , typename V >
void pstsdk::btree_node_leaf< K, V >::last ( btree_iter_impl< K, V > &  iter) const
inlineprotectedvirtual

Positions the iterator at the "end" element.

Parameters
[in,out]iterIterator state class

Implements pstsdk::btree_node< K, V >.

Definition at line 153 of file btree.h.

◆ lookup()

template<typename K , typename V >
const V & pstsdk::btree_node_leaf< K, V >::lookup ( const K &  key) const
virtual

Looks up the associated value for a given key.

Exceptions
key_not_found<K>if the requested key is not in this btree
Parameters
[in]keyThe key to lookup
Returns
The associated value

Implements pstsdk::btree_node< K, V >.

Definition at line 292 of file btree.h.

◆ next()

template<typename K , typename V >
void pstsdk::btree_node_leaf< K, V >::next ( btree_iter_impl< K, V > &  iter) const
protectedvirtual

Moves the iterator to the next element.

Parameters
[in,out]iterIterator state class

Implements pstsdk::btree_node< K, V >.

Definition at line 306 of file btree.h.

◆ prev()

template<typename K , typename V >
void pstsdk::btree_node_leaf< K, V >::prev ( btree_iter_impl< K, V > &  iter) const
protectedvirtual

Moves the iterator to the previous element.

Parameters
[in,out]iterIterator state class

Implements pstsdk::btree_node< K, V >.

Definition at line 330 of file btree.h.

Friends And Related Symbol Documentation

◆ const_btree_node_iter< K, V >

template<typename K , typename V >
friend class const_btree_node_iter< K, V >
friend

Definition at line 145 of file btree.h.


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