Fairport  v1.0.38
fairport::database_impl< T > Class Template Reference

PST implementation. More...

#include <database.h>

+ Inheritance diagram for fairport::database_impl< T >:
+ Collaboration diagram for fairport::database_impl< T >:

List of all members.

Public Member Functions

bool is_pst () const
 Is this database a PST?
Lookup functions
node lookup_node (node_id nid)
 Open a node.
node_info lookup_node_info (node_id nid)
 Lookup information about a node.
block_info lookup_block_info (block_id bid)
 Lookup information about a block.
Page factory functions
std::tr1::shared_ptr< bbt_pageread_bbt_root ()
 Get the root of the BBT of this context.
std::tr1::shared_ptr< nbt_pageread_nbt_root ()
 Get the root of the NBT of this context.
std::tr1::shared_ptr< bbt_pageread_bbt_page (const page_info &pi)
 Open a BBT page.
std::tr1::shared_ptr< nbt_pageread_nbt_page (const page_info &pi)
 Open a NBT page.
std::tr1::shared_ptr
< nbt_leaf_page
read_nbt_leaf_page (const page_info &pi)
 Open a NBT leaf page.
std::tr1::shared_ptr
< bbt_leaf_page
read_bbt_leaf_page (const page_info &pi)
 Open a BBT leaf page.
std::tr1::shared_ptr
< nbt_nonleaf_page
read_nbt_nonleaf_page (const page_info &pi)
 Open a NBT nonleaf page.
std::tr1::shared_ptr
< bbt_nonleaf_page
read_bbt_nonleaf_page (const page_info &pi)
 Open a BBT nonleaf page.
Block factory functions
std::tr1::shared_ptr< blockread_block (const shared_db_ptr &parent, block_id bid)
 Open a block in the specified context.
std::tr1::shared_ptr< data_blockread_data_block (const shared_db_ptr &parent, block_id bid)
 Open a data_block in the specified context.
std::tr1::shared_ptr
< extended_block
read_extended_block (const shared_db_ptr &parent, block_id bid)
 Open an extended_block in the specified context.
std::tr1::shared_ptr
< external_block
read_external_block (const shared_db_ptr &parent, block_id bid)
 Open a external_block in the specified context.
std::tr1::shared_ptr
< subnode_block
read_subnode_block (const shared_db_ptr &parent, block_id bid)
 Open a subnode_block in the specified context.
std::tr1::shared_ptr
< subnode_leaf_block
read_subnode_leaf_block (const shared_db_ptr &parent, block_id bid)
 Open a subnode_leaf_block in the specified context.
std::tr1::shared_ptr
< subnode_nonleaf_block
read_subnode_nonleaf_block (const shared_db_ptr &parent, block_id bid)
 Open a subnode_nonleaf_block in the specified context.
std::tr1::shared_ptr< blockread_block (const shared_db_ptr &parent, const block_info &bi)
 Open a block in the specified context.
std::tr1::shared_ptr< data_blockread_data_block (const shared_db_ptr &parent, const block_info &bi)
 Open a data_block in the specified context.
std::tr1::shared_ptr
< extended_block
read_extended_block (const shared_db_ptr &parent, const block_info &bi)
 Open a extended_block in the specified context.
std::tr1::shared_ptr
< external_block
read_external_block (const shared_db_ptr &parent, const block_info &bi)
 Open a external_block in the specified context.
std::tr1::shared_ptr
< subnode_block
read_subnode_block (const shared_db_ptr &parent, const block_info &bi)
 Open a subnode_block in the specified context.
std::tr1::shared_ptr
< subnode_leaf_block
read_subnode_leaf_block (const shared_db_ptr &parent, const block_info &bi)
 Open a subnode_leaf_block in the specified context.
std::tr1::shared_ptr
< subnode_nonleaf_block
read_subnode_nonleaf_block (const shared_db_ptr &parent, const block_info &bi)
 Open a subnode_nonleaf_block in the specified context.

Protected Member Functions

 database_impl ()
 database_impl (const std::wstring &filename)
 Construct a database_impl from this filename.
void validate_header ()
 Validate the header of this file.
std::vector< byteread_block_data (const block_info &bi)
 Read block data, perform validation checks.
std::vector< byteread_page_data (const page_info &pi)
 Read page data, perform validation checks.
std::tr1::shared_ptr
< nbt_leaf_page
read_nbt_leaf_page (const page_info &pi, disk::nbt_leaf_page< T > &the_page)
std::tr1::shared_ptr
< bbt_leaf_page
read_bbt_leaf_page (const page_info &pi, disk::bbt_leaf_page< T > &the_page)
template<typename K , typename V >
std::tr1::shared_ptr
< bt_nonleaf_page< K, V > > 
read_bt_nonleaf_page (const page_info &pi, disk::bt_page< T, disk::bt_entry< T > > &the_page)
std::tr1::shared_ptr
< subnode_leaf_block
read_subnode_leaf_block (const shared_db_ptr &parent, const block_info &bi, disk::sub_leaf_block< T > &sub_block)
std::tr1::shared_ptr
< subnode_nonleaf_block
read_subnode_nonleaf_block (const shared_db_ptr &parent, const block_info &bi, disk::sub_nonleaf_block< T > &sub_block)

Protected Attributes

file m_file
disk::header< T > m_header
std::tr1::shared_ptr< bbt_pagem_bbt_root
std::tr1::shared_ptr< nbt_pagem_nbt_root

Friends

shared_db_ptr open_database (const std::wstring &filename)
 Open a db_context for the given file.
std::tr1::shared_ptr< small_pstopen_small_pst (const std::wstring &filename)
 Try to open the given file as an ANSI store.
std::tr1::shared_ptr< large_pstopen_large_pst (const std::wstring &filename)
 Try to open the given file as a Unicode store.

Detailed Description

template<typename T>
class fairport::database_impl< T >

PST implementation.

The actual implementation of a database context - this class is responsible for translating between the disk format (as indicated by the template parameter) and the disk-agnostic in memory classes returned from the various factory methods.

open_database will instantiate the correct database_impl type for a given filename.

Template Parameters:
Tulonglong for a Unicode store, ulong for an ANSI store

Definition at line 72 of file database.h.


Constructor & Destructor Documentation

template<typename T >
fairport::database_impl< T >::database_impl ( ) [protected]
template<typename T >
fairport::database_impl< T >::database_impl ( const std::wstring &  filename) [inline, protected]

Construct a database_impl from this filename.

Exceptions:
invalid_formatif the file format is not understood
runtime_errorif an error occurs opening the file
Parameters:
[in]filenameThe filename to open

Definition at line 337 of file database.h.


Member Function Documentation

template<typename T >
bool fairport::database_impl< T >::is_pst ( ) const [inline, virtual]

Is this database a PST?

Returns:
Returns true if this is PST, false if an OST or something else.

Implements fairport::db_context.

Definition at line 76 of file database.h.

template<typename T >
fairport::block_info fairport::database_impl< T >::lookup_block_info ( block_id  bid) [inline, virtual]

Lookup information about a block.

Exceptions:
key_not_found<block_id>if the specified block was not found
Parameters:
[in]bidThe id of the block to lookup
Returns:
Information about the specified block

Implements fairport::db_context.

Definition at line 539 of file database.h.

template<typename T >
node fairport::database_impl< T >::lookup_node ( node_id  nid) [inline, virtual]

Open a node.

Exceptions:
key_not_found<node_id>if the specified node was not found
Parameters:
[in]nidThe id of the node to lookup
Returns:
A node instance

Implements fairport::db_context.

Definition at line 81 of file database.h.

template<typename T >
fairport::node_info fairport::database_impl< T >::lookup_node_info ( node_id  nid) [inline, virtual]

Lookup information about a node.

Exceptions:
key_not_found<node_id>if the specified node was not found
Parameters:
[in]nidThe id of the node to lookup
Returns:
Information about the specified node

Implements fairport::db_context.

Definition at line 533 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::bbt_leaf_page > fairport::database_impl< T >::read_bbt_leaf_page ( const page_info pi) [inline, virtual]

Open a BBT leaf page.

Parameters:
[in]piInformation about the page to open
Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 388 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::bbt_leaf_page > fairport::database_impl< T >::read_bbt_leaf_page ( const page_info pi,
disk::bbt_leaf_page< T > &  the_page 
) [inline, protected]

Definition at line 405 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::bbt_nonleaf_page > fairport::database_impl< T >::read_bbt_nonleaf_page ( const page_info pi) [inline, virtual]

Open a BBT nonleaf page.

Parameters:
[in]piInformation about the page to open
Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 464 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::bbt_page > fairport::database_impl< T >::read_bbt_page ( const page_info pi) [inline, virtual]

Open a BBT page.

Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 481 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::bbt_page > fairport::database_impl< T >::read_bbt_root ( ) [inline, virtual]

Get the root of the BBT of this context.

Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 313 of file database.h.

template<typename T >
std::tr1::shared_ptr<block> fairport::database_impl< T >::read_block ( const shared_db_ptr parent,
block_id  bid 
) [inline, virtual]

Open a block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 101 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::block > fairport::database_impl< T >::read_block ( const shared_db_ptr parent,
const block_info bi 
) [inline, virtual]

Open a block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 554 of file database.h.

template<typename T >
std::vector< fairport::byte > fairport::database_impl< T >::read_block_data ( const block_info bi) [inline, protected]

Read block data, perform validation checks.

Parameters:
[in]biThe block information to read from disk
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The validated block data (still "encrypted")

Definition at line 238 of file database.h.

template<typename T >
template<typename K , typename V >
std::tr1::shared_ptr< fairport::bt_nonleaf_page< K, V > > fairport::database_impl< T >::read_bt_nonleaf_page ( const page_info pi,
disk::bt_page< T, disk::bt_entry< T > > &  the_page 
) [inline, protected]

Definition at line 446 of file database.h.

template<typename T >
std::tr1::shared_ptr<data_block> fairport::database_impl< T >::read_data_block ( const shared_db_ptr parent,
block_id  bid 
) [inline, virtual]

Open a data_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 103 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::data_block > fairport::database_impl< T >::read_data_block ( const shared_db_ptr parent,
const block_info bi 
) [inline, virtual]

Open a data_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 571 of file database.h.

template<typename T >
std::tr1::shared_ptr<extended_block> fairport::database_impl< T >::read_extended_block ( const shared_db_ptr parent,
block_id  bid 
) [inline, virtual]

Open an extended_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 105 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::extended_block > fairport::database_impl< T >::read_extended_block ( const shared_db_ptr parent,
const block_info bi 
) [inline, virtual]

Open a extended_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 588 of file database.h.

template<typename T >
std::tr1::shared_ptr<external_block> fairport::database_impl< T >::read_external_block ( const shared_db_ptr parent,
block_id  bid 
) [inline, virtual]

Open a external_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 107 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::external_block > fairport::database_impl< T >::read_external_block ( const shared_db_ptr parent,
const block_info bi 
) [inline, virtual]

Open a external_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 621 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::nbt_leaf_page > fairport::database_impl< T >::read_nbt_leaf_page ( const page_info pi) [inline, virtual]

Open a NBT leaf page.

Parameters:
[in]piInformation about the page to open
Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 348 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::nbt_leaf_page > fairport::database_impl< T >::read_nbt_leaf_page ( const page_info pi,
disk::nbt_leaf_page< T > &  the_page 
) [inline, protected]

Definition at line 365 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::nbt_nonleaf_page > fairport::database_impl< T >::read_nbt_nonleaf_page ( const page_info pi) [inline, virtual]

Open a NBT nonleaf page.

Parameters:
[in]piInformation about the page to open
Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 428 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::nbt_page > fairport::database_impl< T >::read_nbt_page ( const page_info pi) [inline, virtual]

Open a NBT page.

Parameters:
[in]piInformation about the page to open
Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 507 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::nbt_page > fairport::database_impl< T >::read_nbt_root ( ) [inline, virtual]

Get the root of the NBT of this context.

Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The requested page

Implements fairport::db_context.

Definition at line 325 of file database.h.

template<typename T >
std::vector< fairport::byte > fairport::database_impl< T >::read_page_data ( const page_info pi) [protected]

Read page data, perform validation checks.

Parameters:
[in]piThe page information to read from disk
Exceptions:
unexpected_page(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(FAIRPORT_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns:
The validated page data

Definition at line 276 of file database.h.

template<typename T >
std::tr1::shared_ptr<subnode_block> fairport::database_impl< T >::read_subnode_block ( const shared_db_ptr parent,
block_id  bid 
) [inline, virtual]

Open a subnode_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 109 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::subnode_block > fairport::database_impl< T >::read_subnode_block ( const shared_db_ptr parent,
const block_info bi 
) [inline, virtual]

Open a subnode_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 650 of file database.h.

template<typename T >
std::tr1::shared_ptr<subnode_leaf_block> fairport::database_impl< T >::read_subnode_leaf_block ( const shared_db_ptr parent,
block_id  bid 
) [inline, virtual]

Open a subnode_leaf_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 111 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::subnode_leaf_block > fairport::database_impl< T >::read_subnode_leaf_block ( const shared_db_ptr parent,
const block_info bi 
) [inline, virtual]

Open a subnode_leaf_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 674 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::subnode_leaf_block > fairport::database_impl< T >::read_subnode_leaf_block ( const shared_db_ptr parent,
const block_info bi,
disk::sub_leaf_block< T > &  sub_block 
) [inline, protected]

Definition at line 712 of file database.h.

template<typename T >
std::tr1::shared_ptr<subnode_nonleaf_block> fairport::database_impl< T >::read_subnode_nonleaf_block ( const shared_db_ptr parent,
block_id  bid 
) [inline, virtual]

Open a subnode_nonleaf_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 113 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::subnode_nonleaf_block > fairport::database_impl< T >::read_subnode_nonleaf_block ( const shared_db_ptr parent,
const block_info bi 
) [inline, virtual]

Open a subnode_nonleaf_block in the specified context.

Parameters:
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions:
unexpected_block(FAIRPORT_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(FAIRPORT_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(FAIRPORT_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns:
The requested block

Implements fairport::db_context.

Definition at line 693 of file database.h.

template<typename T >
std::tr1::shared_ptr< fairport::subnode_nonleaf_block > fairport::database_impl< T >::read_subnode_nonleaf_block ( const shared_db_ptr parent,
const block_info bi,
disk::sub_nonleaf_block< T > &  sub_block 
) [inline, protected]

Definition at line 741 of file database.h.

template<typename T >
void fairport::database_impl< T >::validate_header ( ) [protected]

Validate the header of this file.

Exceptions:
invalid_formatif this header is for a database format incompatible with this object
crc_fail(FAIRPORT_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match

Friends And Related Function Documentation

template<typename T >
shared_db_ptr open_database ( const std::wstring &  filename) [friend]

Open a db_context for the given file.

Exceptions:
invalid_formatif the file format is not understood
runtime_errorif an error occurs opening the file
crc_fail(FAIRPORT_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters:
[in]filenameThe filename to open
Returns:
A shared_ptr to the opened context
template<typename T >
std::tr1::shared_ptr<large_pst> open_large_pst ( const std::wstring &  filename) [friend]

Try to open the given file as a Unicode store.

Exceptions:
invalid_formatif the file format is not Unicode
runtime_errorif an error occurs opening the file
crc_fail(FAIRPORT_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters:
[in]filenameThe filename to open
Returns:
A shared_ptr to the opened context
template<typename T >
std::tr1::shared_ptr<small_pst> open_small_pst ( const std::wstring &  filename) [friend]

Try to open the given file as an ANSI store.

Exceptions:
invalid_formatif the file format is not ANSI
runtime_errorif an error occurs opening the file
crc_fail(FAIRPORT_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters:
[in]filenameThe filename to open
Returns:
A shared_ptr to the opened context

Member Data Documentation

template<typename T >
std::tr1::shared_ptr<bbt_page> fairport::database_impl< T >::m_bbt_root [protected]

Definition at line 168 of file database.h.

template<typename T >
file fairport::database_impl< T >::m_file [protected]

Definition at line 166 of file database.h.

template<typename T >
disk::header<T> fairport::database_impl< T >::m_header [protected]

Definition at line 167 of file database.h.

template<typename T >
std::tr1::shared_ptr<nbt_page> fairport::database_impl< T >::m_nbt_root [protected]

Definition at line 169 of file database.h.


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