Fairport
v1.0.38
|
A block which represents end user data. More...
#include <node.h>
Public Member Functions | |
data_block (const shared_db_ptr &db, const block_info &info, size_t total_size) | |
Constructor for a data_block. | |
virtual | ~data_block () |
size_t | read (std::vector< byte > &buffer, ulong offset) const |
Read data from this block. | |
template<typename T > | |
T | read (ulong offset) const |
Read data from this block. | |
virtual size_t | read_raw (byte *pdest_buffer, size_t size, ulong offset) const =0 |
Read data from this block. | |
virtual uint | get_page_count () const =0 |
Get the number of physical pages in this data_block. | |
virtual std::tr1::shared_ptr < external_block > | get_page (uint page_num) const =0 |
Get a specific page of this data_block. | |
size_t | get_total_size () const |
Get the total logical size of this block. | |
Protected Attributes | |
size_t | m_total_size |
the total or logical size (sum of all external child blocks) |
A block which represents end user data.
This class is the base class of both extended_block and external_block. This base class exists to abstract away their differences, so a node can treat a given block (be it extended or external) simply as a stream of bytes.
fairport::data_block::data_block | ( | const shared_db_ptr & | db, |
const block_info & | info, | ||
size_t | total_size | ||
) | [inline] |
Constructor for a data_block.
[in] | db | The database context |
[in] | info | Information about this block |
[in] | total_size | The total logical size of this block |
virtual fairport::data_block::~data_block | ( | ) | [inline, virtual] |
virtual std::tr1::shared_ptr<external_block> fairport::data_block::get_page | ( | uint | page_num | ) | const [pure virtual] |
Get a specific page of this data_block.
out_of_range | If page_num >= get_page_count() |
[in] | page_num | The ordinal of the external_block to get, zero based |
Implemented in fairport::external_block, and fairport::extended_block.
virtual uint fairport::data_block::get_page_count | ( | ) | const [pure virtual] |
Get the number of physical pages in this data_block.
Implemented in fairport::external_block, and fairport::extended_block.
size_t fairport::data_block::get_total_size | ( | ) | const [inline] |
Read data from this block.
Fills the specified buffer with data starting at the specified offset. The size of the buffer indicates how much data to read.
[in,out] | buffer | The buffer to fill |
[in] | offset | The location to read from |
T fairport::data_block::read | ( | ulong | offset | ) | const [inline] |
virtual size_t fairport::data_block::read_raw | ( | byte * | pdest_buffer, |
size_t | size, | ||
ulong | offset | ||
) | const [pure virtual] |
Read data from this block.
[out] | pdest_buffer | The location to read the data into |
[in] | size | The amount of data to read |
[in] | offset | The location to read from |
Implemented in fairport::external_block, and fairport::extended_block.
size_t fairport::data_block::m_total_size [protected] |