Fairport  v1.0.38
fairport::block Class Reference

The base class of the block class hierarchy. More...

#include <node.h>

+ Inheritance diagram for fairport::block:
+ Collaboration diagram for fairport::block:

List of all members.

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

Detailed Description

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.

See also:
Block Structures
[MS-PST] 2.2.2.8

Definition at line 440 of file node.h.


Constructor & Destructor Documentation

fairport::block::block ( const shared_db_ptr db,
const block_info info 
) [inline]

Basic block constructor.

Parameters:
[in]dbThe database context this block was opened in
[in]infoInformation about this block

Definition at line 446 of file node.h.

virtual fairport::block::~block ( ) [inline, virtual]

Definition at line 449 of file node.h.


Member Function Documentation

ulonglong fairport::block::get_address ( ) const [inline]

Get the address of this block on disk.

Returns:
The address of this block, 0 for a new block.

Definition at line 465 of file node.h.

shared_db_ptr fairport::block::get_db_ptr ( ) const [inline, protected]

Definition at line 468 of file node.h.

size_t fairport::block::get_disk_size ( ) const [inline]

Get the last known size of this block on disk.

Returns:
The last known size of this block on disk

Definition at line 457 of file node.h.

block_id fairport::block::get_id ( ) const [inline]

Get the block_id of this block.

Returns:
The block_id of this block

Definition at line 461 of file node.h.

virtual bool fairport::block::is_internal ( ) const [pure virtual]

Returns the blocks internal/external state.

Returns:
true if this is an internal block, false otherwise

Implemented in fairport::subnode_block, fairport::external_block, and fairport::extended_block.

virtual void fairport::block::trim ( ) [inline, protected, virtual]

Definition at line 469 of file node.h.


Member Data Documentation

The address of this specific block on disk, 0 if unknown.

Definition at line 474 of file node.h.

Definition at line 476 of file node.h.

The id of this block.

Definition at line 473 of file node.h.

bool fairport::block::m_modified [protected]

True if this block has been modified and needs to be saved.

Definition at line 471 of file node.h.

size_t fairport::block::m_size [protected]

The size of this specific block on disk at last save.

Definition at line 472 of file node.h.


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