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

The object which forms the root of the BTH hierarchy. More...

#include <heap.h>

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

Public Member Functions

 bth_node (const heap_ptr &h, heap_id id, ushort level)
 Construct a bth_node object.
 
virtual ~bth_node ()
 
heap_id get_id () const
 Return the heap_id of this bth_node.
 
ushort get_level () const
 Return the leve of this bth_node.
 
size_t get_key_size () const
 Return the key size of this bth.
 
size_t get_value_size () const
 Return the value size of this bth.
 
const heap_ptr get_heap_ptr () const
 Returns the heap this bth_node is in.
 
heap_ptr get_heap_ptr ()
 Returns the heap this bth_node is in.
 
const nodeget_node () const
 Get the node underlying this BTH.
 
nodeget_node ()
 Get the node underlying this BTH.
 
- Public Member Functions inherited from pstsdk::btree_node< K, V >
virtual ~btree_node ()
 
virtual const V & lookup (const K &key) const =0
 Looks up the associated value for a given key.
 
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.
 

Static Public Member Functions

static std::shared_ptr< bth_node< K, V > > open_root (const heap_ptr &h, heap_id bth_root)
 Opens a BTH node from the specified heap at the given root.
 
static std::shared_ptr< bth_nonleaf_node< K, V > > open_nonleaf (const heap_ptr &h, heap_id id, ushort level)
 Open a non-leaf BTH node.
 
static std::shared_ptr< bth_leaf_node< K, V > > open_leaf (const heap_ptr &h, heap_id id)
 Open a leaf BTH node.
 

Protected Attributes

heap_ptr m_heap
 

Additional Inherited Members

- Public Types inherited from pstsdk::btree_node< K, V >
typedef const_btree_node_iter< K, V > const_iterator
 
- Protected Member Functions inherited from pstsdk::btree_node< K, V >
virtual void first (btree_iter_impl< K, V > &iter) const =0
 Positions the iterator at the first element on this tree.
 
virtual void last (btree_iter_impl< K, V > &iter) const =0
 Positions the iterator at the "end" element.
 
virtual void next (btree_iter_impl< K, V > &iter) const =0
 Moves the iterator to the next element.
 
virtual void prev (btree_iter_impl< K, V > &iter) const =0
 Moves the iterator to the previous element.
 

Detailed Description

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

The object which forms the root of the BTH hierarchy.

A BTH is a simple tree structure built using allocations out of a heap. bth_node forms the root of the object hierarchy representing this tree. The child classes bth_nonleaf_node and bth_leaf_node contain the implementation and represent nonleaf and leaf bth_nodes, respectively.

Because a single bth_node is backed by a HN allocation (max 3.8k), most BTH "trees" consist of a BTH header which points directly to a single BTH leaf node.

This hierarchy also models the btree_node structure, inheriting the actual iteration and lookup logic.

Template Parameters
KThe key type for this BTH
VThe value type for this BTH
See also
[MS-PST] 2.3.2

Definition at line 291 of file heap.h.

Constructor & Destructor Documentation

◆ bth_node()

template<typename K , typename V >
pstsdk::bth_node< K, V >::bth_node ( const heap_ptr h,
heap_id  id,
ushort  level 
)
inline

Construct a bth_node object.

Parameters
[in]hThe heap to open out of
[in]idThe id to interpret as a non-leaf BTH node
[in]levelThe level of this non-leaf node (must be non-zero)

Definition at line 316 of file heap.h.

◆ ~bth_node()

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

Definition at line 318 of file heap.h.

Member Function Documentation

◆ get_heap_ptr() [1/2]

template<typename K , typename V >
heap_ptr pstsdk::bth_node< K, V >::get_heap_ptr ( )
inline

Returns the heap this bth_node is in.

The heap this bth_node is in

Definition at line 338 of file heap.h.

◆ get_heap_ptr() [2/2]

template<typename K , typename V >
const heap_ptr pstsdk::bth_node< K, V >::get_heap_ptr ( ) const
inline

Returns the heap this bth_node is in.

The heap this bth_node is in

Definition at line 335 of file heap.h.

◆ get_id()

template<typename K , typename V >
heap_id pstsdk::bth_node< K, V >::get_id ( ) const
inline

Return the heap_id of this bth_node.

Returns
the heap_id of this bth_node

Definition at line 322 of file heap.h.

◆ get_key_size()

template<typename K , typename V >
size_t pstsdk::bth_node< K, V >::get_key_size ( ) const
inline

Return the key size of this bth.

Returns
the key size of this bth

Definition at line 328 of file heap.h.

◆ get_level()

template<typename K , typename V >
ushort pstsdk::bth_node< K, V >::get_level ( ) const
inline

Return the leve of this bth_node.

Returns
the leve of this bth_node

Definition at line 325 of file heap.h.

◆ get_node() [1/2]

template<typename K , typename V >
node & pstsdk::bth_node< K, V >::get_node ( )
inline

Get the node underlying this BTH.

Returns
the node

Definition at line 345 of file heap.h.

◆ get_node() [2/2]

template<typename K , typename V >
const node & pstsdk::bth_node< K, V >::get_node ( ) const
inline

Get the node underlying this BTH.

Returns
the node

Definition at line 342 of file heap.h.

◆ get_value_size()

template<typename K , typename V >
size_t pstsdk::bth_node< K, V >::get_value_size ( ) const
inline

Return the value size of this bth.

Returns
the value size of this bth

Definition at line 331 of file heap.h.

◆ open_leaf()

template<typename K , typename V >
std::shared_ptr< pstsdk::bth_leaf_node< K, V > > pstsdk::bth_node< K, V >::open_leaf ( const heap_ptr h,
heap_id  id 
)
inlinestatic

Open a leaf BTH node.

Parameters
[in]hThe heap to open out of
[in]idThe id to interpret as a leaf BTH node

Definition at line 479 of file heap.h.

◆ open_nonleaf()

template<typename K , typename V >
std::shared_ptr< pstsdk::bth_nonleaf_node< K, V > > pstsdk::bth_node< K, V >::open_nonleaf ( const heap_ptr h,
heap_id  id,
ushort  level 
)
inlinestatic

Open a non-leaf BTH node.

Parameters
[in]hThe heap to open out of
[in]idThe id to interpret as a non-leaf BTH node
[in]levelThe level of this non-leaf node (must be non-zero)

Definition at line 455 of file heap.h.

◆ open_root()

template<typename K , typename V >
std::shared_ptr< pstsdk::bth_node< K, V > > pstsdk::bth_node< K, V >::open_root ( const heap_ptr h,
heap_id  bth_root 
)
inlinestatic

Opens a BTH node from the specified heap at the given root.

Exceptions
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If this allocation doesn't have the BTH stamp
logic_errorIf the specified key/value type sizes do not match what is in the BTH header
Parameters
[in]hThe heap to open out of
[in]bth_rootThe allocation containing the bth header

Definition at line 429 of file heap.h.

Member Data Documentation

◆ m_heap

template<typename K , typename V >
heap_ptr pstsdk::bth_node< K, V >::m_heap
protected

Definition at line 348 of file heap.h.


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