Fairport  v1.0.38
fairport::heap_impl Class Reference

The HN implementation. More...

#include <heap.h>

+ Inheritance diagram for fairport::heap_impl:
+ Collaboration diagram for fairport::heap_impl:

List of all members.

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::tr1::shared_ptr< bth_node
< K, V > > 
open_bth (heap_id root)
 Opens a BTH from this heap with the given root id.

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 93 of file heap.h.


Member Function Documentation

fairport::byte fairport::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 567 of file heap.h.

const node& fairport::heap_impl::get_node ( ) const [inline]

Get the node underlying this heap.

Returns:
The node

Definition at line 153 of file heap.h.

node& fairport::heap_impl::get_node ( ) [inline]

Get the node underlying this heap.

Returns:
The node

Definition at line 156 of file heap.h.

uint fairport::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 104 of file heap.h.

fairport::heap_id fairport::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 561 of file heap.h.

template<typename K , typename V >
std::tr1::shared_ptr< fairport::bth_node< K, V > > fairport::heap_impl::open_bth ( heap_id  root) [inline]

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

Definition at line 678 of file heap.h.

fairport::hid_stream_device fairport::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:

 heap h;
 hid_stream hstream(h.open_stream(0x30));

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 623 of file heap.h.

size_t fairport::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(FAIRPORT_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 597 of file heap.h.

std::vector< fairport::byte > fairport::heap_impl::read ( heap_id  id) const [inline]

Read an entire allocation.

Exceptions:
length_error(FAIRPORT_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 670 of file heap.h.

size_t fairport::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(FAIRPORT_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 573 of file heap.h.


Friends And Related Function Documentation

friend class heap [friend]

Definition at line 166 of file heap.h.


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