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

Implementation of an ANSI TC (64k rows) and a unicode TC. More...

#include <table.h>

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

List of all members.

Public Member Functions

nodeget_node ()
 Get the node backing this table.
const nodeget_node () const
 Get the node backing this table.
ulong lookup_row (row_id id) const
 Find the offset into the table of the given row_id.
ulonglong get_cell_value (ulong row, prop_id id) const
 Get the contents of the specified cell in the specified row.
std::vector< byteread_cell (ulong row, prop_id id) const
 Get the contents of a indirect property in the specified row.
hnid_stream_device open_cell_stream (ulong row, prop_id id)
 Open a stream over a property in a given row.
std::vector< prop_idget_prop_list () const
 Get all of the properties on this table.
prop_type get_prop_type (prop_id id) const
 Get the type of a property.
row_id get_row_id (ulong row) const
 Get the row id of a specified row.
size_t size () const
 Get the number of rows in this table.
bool prop_exists (ulong row, prop_id id) const
 Check to see if a property exists for a given row.
size_t row_prop_size (ulong row, prop_id id) const
 Return the size of a property for a given row.

Friends

table_ptr open_table (const node &n)
 Open the specified node as a table.

Detailed Description

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

Implementation of an ANSI TC (64k rows) and a unicode TC.

ANSI and Unicode TCs differ in the "row index" BTH. On an ANSI PST the type type is 2 bytes and in Unicode PSTs the value type is 4 bytes. Since the value type is the row offset for a given row_id, that implies a 64k row limit for TCs in ANSI stores.

Note that the information about the key/value size is stored in the BTH header. We use that to determine what type of table this is, rather than trying to figure out if we're opened over an ANSI or Unicode PST (which has been abstracted away from us at this point).

Template Parameters:
TThe size of the value type in the row index BTH - ushort for an ANSI table, ulong for a Unicode table
See also:
[MS-PST] 2.3.4.3.1/dwRowIndex

Definition at line 277 of file table.h.


Member Function Documentation

template<typename T >
fairport::ulonglong fairport::basic_table< T >::get_cell_value ( ulong  row,
prop_id  id 
) const [inline, virtual]

Get the contents of the specified cell in the specified row.

Exceptions:
key_not_found<prop_id>If the specified property does not exist on the specified row
out_of_rangeIf the specified row offset is beyond the size of this table
Parameters:
[in]rowThe offset into the table
[in]idThe prop_id to find the cell value of
Returns:
The cell value

Implements fairport::table_impl.

Definition at line 562 of file table.h.

template<typename T >
node& fairport::basic_table< T >::get_node ( ) [inline, virtual]

Get the node backing this table.

Returns:
The node

Implements fairport::table_impl.

Definition at line 280 of file table.h.

template<typename T >
const node& fairport::basic_table< T >::get_node ( ) const [inline, virtual]

Get the node backing this table.

Returns:
The node

Implements fairport::table_impl.

Definition at line 282 of file table.h.

template<typename T >
std::vector< fairport::prop_id > fairport::basic_table< T >::get_prop_list ( ) const [inline, virtual]

Get all of the properties on this table.

This returns the properties behind all of the columns which make up this table. This doesn't imply that every property is present on every row, however.

Returns:
A vector all of the column prop_ids

Implements fairport::table_impl.

Definition at line 538 of file table.h.

template<typename T >
fairport::prop_type fairport::basic_table< T >::get_prop_type ( prop_id  id) const [inline, virtual]

Get the type of a property.

Returns:
The property type

Implements fairport::table_impl.

Definition at line 633 of file table.h.

template<typename T >
fairport::row_id fairport::basic_table< T >::get_row_id ( ulong  row) const [inline, virtual]

Get the row id of a specified row.

On disk, the first DWORD is always the row_id.

See also:
[MS-PST] 2.3.4.4.1/dwRowID
Returns:
The row id

Implements fairport::table_impl.

Definition at line 644 of file table.h.

template<typename T >
fairport::ulong fairport::basic_table< T >::lookup_row ( row_id  id) const [inline, virtual]

Find the offset into the table of the given row_id.

Exceptions:
key_not_found<row_id>If the given row_id is not present in this table
Parameters:
[in]idThe row id to lookup
Returns:
The offset into the table

Implements fairport::table_impl.

Definition at line 549 of file table.h.

template<typename T >
fairport::hnid_stream_device fairport::basic_table< T >::open_cell_stream ( ulong  row,
prop_id  id 
) [inline, virtual]

Open a stream over a property in a given row.

Exceptions:
key_not_found<prop_id>If the specified property does not exist on the specified row
out_of_rangeIf the specified row offset is beyond the size of this table
Note:
This operation is only valid for variable length properties
Parameters:
[in]rowThe offset into the table
[in]idThe prop_id to find the cell value of
Returns:
A device which can be used to construct a stream object

Implements fairport::table_impl.

Definition at line 622 of file table.h.

template<typename T >
bool fairport::basic_table< T >::prop_exists ( ulong  row,
prop_id  id 
) const [inline, virtual]

Check to see if a property exists for a given row.

Parameters:
[in]rowThe offset into the table
[in]idThe prop_id
Returns:
true if the property exists

Implements fairport::table_impl.

Definition at line 695 of file table.h.

template<typename T >
std::vector< fairport::byte > fairport::basic_table< T >::read_cell ( ulong  row,
prop_id  id 
) const [inline, virtual]

Get the contents of a indirect property in the specified row.

Exceptions:
key_not_found<prop_id>If the specified property does not exist on the specified row
out_of_rangeIf the specified row offset is beyond the size of this table
Parameters:
[in]rowThe offset into the table
[in]idThe prop_id to find the cell value of
Returns:
The raw bytes of the property

Implements fairport::table_impl.

Definition at line 603 of file table.h.

template<typename T >
size_t fairport::basic_table< T >::row_prop_size ( ulong  row,
prop_id  id 
) const [inline, virtual]

Return the size of a property for a given row.

Note:
This operation is only valid for variable length properties
Parameters:
[in]rowThe offset into the table
[in]idThe prop_id
Returns:
The vector.size() if read_prop were called

Implements fairport::table_impl.

Definition at line 592 of file table.h.

template<typename T >
size_t fairport::basic_table< T >::size ( ) const [inline, virtual]

Get the number of rows in this table.

Returns:
The number of rows

Implements fairport::table_impl.

Definition at line 525 of file table.h.


Friends And Related Function Documentation

template<typename T >
table_ptr open_table ( const node n) [friend]

Open the specified node as a table.

Parameters:
[in]nThe node to copy and interpret as a TC

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