Fairport
v1.0.38
|
The HN implementation. More...
#include <heap.h>
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< byte > | read (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 node & | get_node () const |
Get the node underlying this heap. | |
node & | get_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 |
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.
fairport::byte fairport::heap_impl::get_client_signature | ( | ) | const [inline] |
const node& fairport::heap_impl::get_node | ( | ) | const [inline] |
node& fairport::heap_impl::get_node | ( | ) | [inline] |
uint fairport::heap_impl::get_page_count | ( | ) | const [inline] |
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.
std::tr1::shared_ptr< fairport::bth_node< K, V > > fairport::heap_impl::open_bth | ( | heap_id | root | ) | [inline] |
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.
[in] | id | The heap allocation to open a stream on |
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.
length_error | (FAIRPORT_VALIDATION_LEVEL_WEAK) If the page, index, or size of the allocation are out of bounds |
[in] | buffer | The location to store the data. The size of the buffer indicates the amount of data to read |
[in] | id | The heap allocation to read from |
[in] | offset | The offset into id to read starting at |
std::vector< fairport::byte > fairport::heap_impl::read | ( | heap_id | id | ) | const [inline] |
Read an entire allocation.
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 |
[in] | id | The allocation to read |
size_t fairport::heap_impl::size | ( | heap_id | id | ) | const [inline] |
Get the size of the given allocation.
[in] | id | The heap allocation to get the size of |
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 |