Fairport
v1.0.38
|
The base class of the block class hierarchy. More...
#include <node.h>
Public Member Functions | |
block (const shared_db_ptr &db, const block_info &info) | |
Basic block constructor. | |
virtual | ~block () |
virtual bool | is_internal () const =0 |
Returns the blocks internal/external state. | |
size_t | get_disk_size () const |
Get the last known size of this block on disk. | |
block_id | get_id () const |
Get the block_id of this block. | |
ulonglong | get_address () const |
Get the address of this block on disk. | |
Protected Member Functions | |
shared_db_ptr | get_db_ptr () const |
virtual void | trim () |
Protected Attributes | |
bool | m_modified |
True if this block has been modified and needs to be saved. | |
size_t | m_size |
The size of this specific block on disk at last save. | |
block_id | m_id |
The id of this block. | |
ulonglong | m_address |
The address of this specific block on disk, 0 if unknown. | |
weak_db_ptr | m_db |
The base class of the block class hierarchy.
A block is an atomic unit of storage in a PST file. This class, and other classes in this hierarchy, are in memory representations of those blocks on disk. They are immutable, and are shared freely between different node instances as needed (via shared pointers). A block also knows how to read any blocks it may refer to (in the case of extended_block or a subnode_block).
All blocks in the block hierarchy are also in the category of what is known as dependant objects. This means is they only keep a weak reference to the database context to which they're a member. Contrast this to an independant object such as the node, which keeps a strong ref or a full shared_ptr to the related context. This implies that someone must externally make sure the database context outlives it's blocks - this is usually done by the database context itself or the node which holds these blocks.
fairport::block::block | ( | const shared_db_ptr & | db, |
const block_info & | info | ||
) | [inline] |
ulonglong fairport::block::get_address | ( | ) | const [inline] |
shared_db_ptr fairport::block::get_db_ptr | ( | ) | const [inline, protected] |
size_t fairport::block::get_disk_size | ( | ) | const [inline] |
block_id fairport::block::get_id | ( | ) | const [inline] |
virtual bool fairport::block::is_internal | ( | ) | const [pure virtual] |
Returns the blocks internal/external state.
Implemented in fairport::subnode_block, fairport::external_block, and fairport::extended_block.
virtual void fairport::block::trim | ( | ) | [inline, protected, virtual] |
ulonglong fairport::block::m_address [protected] |
weak_db_ptr fairport::block::m_db [protected] |
block_id fairport::block::m_id [protected] |
bool fairport::block::m_modified [protected] |
size_t fairport::block::m_size [protected] |