PST File Format SDK v0.4
Loading...
Searching...
No Matches
pstsdk::heap_impl Class Reference

The HN implementation. More...

#include <heap.h>

+ Inheritance diagram for pstsdk::heap_impl:
+ Collaboration diagram for pstsdk::heap_impl:

Public Member Functions

size_t size (heap_id id) const
 Get the size of the given allocation.
 
uint get_page_count () const
 Get the count of pages (..external blocks) in this heap.
 
heap_id get_root_id () const
 Returns the client root allocation out of this heap.
 
byte get_client_signature () const
 Returns the client signature of the heap.
 
size_t read (std::vector< byte > &buffer, heap_id id, ulong offset) const
 Read data out of a specified allocation at the specified offset.
 
std::vector< byteread (heap_id id) const
 Read an entire allocation.
 
hid_stream_device open_stream (heap_id id)
 Creates a stream device over a specified heap allocation.
 
const nodeget_node () const
 Get the node underlying this heap.
 
nodeget_node ()
 Get the node underlying this heap.
 
template<typename K , typename V >
std::shared_ptr< bth_node< K, V > > open_bth (heap_id root)
 Opens a BTH from this heap with the given root id.
 
template<typename K , typename V >
std::shared_ptr< pstsdk::bth_node< K, V > > open_bth (heap_id root)
 

Friends

class heap
 

Detailed Description

The HN implementation.

Similar to how a node is implemented, the HN implemention is actually divided up into two classes, heap_impl and heap, for the exact same reasons. The implementation details are in heap_impl, which is always a dynamically allocated object, where as clients actually create heap objects. As more and more "child" objects are created and opened from inside the heap, they will reference the heap_impl as appropriate.

Definition at line 90 of file heap.h.

Member Function Documentation

◆ get_client_signature()

pstsdk::byte pstsdk::heap_impl::get_client_signature ( ) const
inline

Returns the client signature of the heap.

Each heap is stamped with a signature byte by it's creator. This value is used mostly for validation purposes by the client when opening the heap.

See also
heap_client_signature returns The client sig byte

Definition at line 596 of file heap.h.

◆ get_node() [1/2]

node & pstsdk::heap_impl::get_node ( )
inline

Get the node underlying this heap.

Returns
The node

Definition at line 153 of file heap.h.

◆ get_node() [2/2]

const node & pstsdk::heap_impl::get_node ( ) const
inline

Get the node underlying this heap.

Returns
The node

Definition at line 150 of file heap.h.

◆ get_page_count()

uint pstsdk::heap_impl::get_page_count ( ) const
inline

Get the count of pages (..external blocks) in this heap.

Returns
The count of pages

Definition at line 101 of file heap.h.

◆ get_root_id()

pstsdk::heap_id pstsdk::heap_impl::get_root_id ( ) const
inline

Returns the client root allocation out of this heap.

This value has specific meaning to the owner of the heap. It may point to a special structure which contains information about the data structures implemented in this heap or the larger node and subnodes (such as the table). Or, it could just point to the root BTH allocation (such as the property_bag). In any event, the heap itself gives no special meaning to this value.

Returns
The client's root allocation

Definition at line 590 of file heap.h.

◆ open_bth() [1/2]

template<typename K , typename V >
std::shared_ptr< bth_node< K, V > > pstsdk::heap_impl::open_bth ( heap_id  root)

Opens a BTH from this heap with the given root id.

Template Parameters
KThe key type of this BTH
VThe value type of this BTH
Parameters
[in]rootThe root allocation of this BTH
Returns
The BTH object

◆ open_bth() [2/2]

template<typename K , typename V >
std::shared_ptr< pstsdk::bth_node< K, V > > pstsdk::heap_impl::open_bth ( heap_id  root)
inline

Definition at line 707 of file heap.h.

◆ open_stream()

pstsdk::hid_stream_device pstsdk::heap_impl::open_stream ( heap_id  id)
inline

Creates a stream device over a specified heap allocation.

The returned stream device can be used to construct a proper stream:

hid_stream hstream(h.open_stream(0x30));
Contains references to other bth_node allocations.
Definition heap.h:364
Heap-on-Node implementation.
Definition heap.h:195
boost::iostreams::stream< hid_stream_device > hid_stream
The actual heap allocation stream, defined using the boost iostream library and the hid_stream_device...
Definition heap.h:79

Which can then be used as any iostream would be.

Parameters
[in]idThe heap allocation to open a stream on
Returns
A heap allocation stream device

Definition at line 652 of file heap.h.

◆ read() [1/2]

std::vector< pstsdk::byte > pstsdk::heap_impl::read ( heap_id  id) const
inline

Read an entire allocation.

Exceptions
length_error(PSTSDK_VALIDATION_LEVEL_WEAK) If the page or index of the allocation as indicated by the id are out of bounds for this node
Parameters
[in]idThe allocation to read
Returns
The entire allocation

Definition at line 699 of file heap.h.

◆ read() [2/2]

size_t pstsdk::heap_impl::read ( std::vector< byte > &  buffer,
heap_id  id,
ulong  offset 
) const
inline

Read data out of a specified allocation at the specified offset.

Exceptions
length_error(PSTSDK_VALIDATION_LEVEL_WEAK) If the page, index, or size of the allocation are out of bounds
Parameters
[in]bufferThe location to store the data. The size of the buffer indicates the amount of data to read
[in]idThe heap allocation to read from
[in]offsetThe offset into id to read starting at
Returns
The number of bytes read

Definition at line 626 of file heap.h.

◆ size()

size_t pstsdk::heap_impl::size ( heap_id  id) const
inline

Get the size of the given allocation.

Parameters
[in]idThe heap allocation to get the size of
Exceptions
length_error(PSTSDK_VALIDATION_LEVEL_WEAK) If the page or index of the allocation as indicated by the id are out of bounds for this node
Returns
The size of the allocation

Definition at line 602 of file heap.h.

Friends And Related Symbol Documentation

◆ heap

friend class heap
friend

Definition at line 163 of file heap.h.


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