Btree_base Class Reference

#include <btree_base.h>

List of all members.

Public Member Functions

 Btree_base ()
 Initialise a Btree_Base object with all zero fields.
 Btree_base (const std::string &name_, char ch)
 Read a base file from disk into a structure in memory.
 Btree_base (const Btree_base &other)
 Copy constructor.
 ~Btree_base ()
 Destructor - frees resources.
bool read (const std::string &name, char ch, std::string &err_msg)
 Read values from a base file.
uint4 get_revision () const
uint4 get_block_size () const
uint4 get_root () const
uint4 get_level () const
uint4 get_bit_map_size () const
uint4 get_item_count () const
uint4 get_last_block () const
bool get_have_fakeroot () const
bool get_sequential () const
void set_revision (uint4 revision_)
void set_block_size (uint4 block_size_)
void set_root (uint4 root_)
void set_level (uint4 level_)
void set_item_count (uint4 item_count_)
void set_have_fakeroot (bool have_fakeroot_)
void set_sequential (bool sequential_)
void write_to_file (const std::string &filename)
 Write the btree base file to disk.
bool block_free_at_start (uint4 n) const
 true iff block n was free at the start of the transaction on the B-tree.
void free_block (uint4 n)
uint4 next_free_block ()
bool block_free_now (uint4 n)
void calculate_last_block ()
void clear_bit_map ()
void commit ()
bool is_empty () const
void swap (Btree_base &other)

Private Member Functions

void operator= (const Btree_base &other)
 private assignment operator - you probably want swap() instead
void extend_bit_map ()
bool do_unpack_uint (const char **start, const char *end, uint4 *dest, std::string &err_msg, const std::string &basename, const char *varname)
 Do most of the error handling from unpack_uint().

Private Attributes

uint4 revision
uint4 block_size
uint4 root
uint4 level
uint4 bit_map_size
uint4 item_count
uint4 last_block
bool have_fakeroot
bool sequential
uint4 bit_map_low
 byte offset into the bit map below which there are no free blocks
bytebit_map0
 the initial state of the bit map of blocks: 1 means in use, 0 means free
bytebit_map
 the current state of the bit map of blocks


Detailed Description

Definition at line 30 of file btree_base.h.


Constructor & Destructor Documentation

Btree_base::Btree_base (  ) 

Initialise a Btree_Base object with all zero fields.

Definition at line 68 of file btree_base.cc.

Btree_base::Btree_base ( const std::string &  name_,
char  ch 
)

Read a base file from disk into a structure in memory.

Parameters:
name The base filename name
ch The suffix

Btree_base::Btree_base ( const Btree_base other  ) 

Copy constructor.

Definition at line 104 of file btree_base.cc.

References bit_map, bit_map0, and bit_map_size.

Btree_base::~Btree_base (  ) 

Destructor - frees resources.

Definition at line 147 of file btree_base.cc.

References bit_map, and bit_map0.


Member Function Documentation

bool Btree_base::read ( const std::string &  name,
char  ch,
std::string &  err_msg 
)

Read values from a base file.

Parameters:
name The base of the filename
ch The suffix
err_msg An error string which will be appended to for some errors instead of throwing an exception.
Returns:
true if the read succeeded, or false otherwise.

Referenced by Btree::cancel().

uint4 Btree_base::get_revision (  )  const [inline]

Definition at line 61 of file btree_base.h.

References Xapian::revision().

Referenced by Btree::basic_open(), and Btree::cancel().

uint4 Btree_base::get_block_size (  )  const [inline]

Definition at line 62 of file btree_base.h.

Referenced by Btree::basic_open(), and Btree::cancel().

uint4 Btree_base::get_root (  )  const [inline]

Definition at line 63 of file btree_base.h.

Referenced by Btree::basic_open(), and Btree::cancel().

uint4 Btree_base::get_level (  )  const [inline]

Definition at line 64 of file btree_base.h.

Referenced by Btree::basic_open(), and Btree::cancel().

uint4 Btree_base::get_bit_map_size (  )  const [inline]

Definition at line 65 of file btree_base.h.

Referenced by Btree::read_block(), and Btree::write_block().

uint4 Btree_base::get_item_count (  )  const [inline]

Definition at line 66 of file btree_base.h.

Referenced by Btree::basic_open(), and Btree::cancel().

uint4 Btree_base::get_last_block (  )  const [inline]

Definition at line 67 of file btree_base.h.

Referenced by Btree::next_for_sequential().

bool Btree_base::get_have_fakeroot (  )  const [inline]

Definition at line 68 of file btree_base.h.

Referenced by Btree::basic_open(), and Btree::cancel().

bool Btree_base::get_sequential (  )  const [inline]

Definition at line 69 of file btree_base.h.

Referenced by Btree::basic_open(), and Btree::cancel().

void Btree_base::set_revision ( uint4  revision_  )  [inline]

Definition at line 71 of file btree_base.h.

References Xapian::revision().

Referenced by Btree::commit().

void Btree_base::set_block_size ( uint4  block_size_  )  [inline]

Definition at line 74 of file btree_base.h.

Referenced by Btree::create().

void Btree_base::set_root ( uint4  root_  )  [inline]

Definition at line 77 of file btree_base.h.

Referenced by Btree::commit().

void Btree_base::set_level ( uint4  level_  )  [inline]

Definition at line 80 of file btree_base.h.

Referenced by Btree::commit().

void Btree_base::set_item_count ( uint4  item_count_  )  [inline]

Definition at line 83 of file btree_base.h.

Referenced by Btree::commit().

void Btree_base::set_have_fakeroot ( bool  have_fakeroot_  )  [inline]

Definition at line 86 of file btree_base.h.

Referenced by Btree::commit(), and Btree::create().

void Btree_base::set_sequential ( bool  sequential_  )  [inline]

Definition at line 89 of file btree_base.h.

Referenced by Btree::commit(), and Btree::create().

void Btree_base::write_to_file ( const std::string &  filename  ) 

Write the btree base file to disk.

Referenced by Btree::commit(), and Btree::create().

bool Btree_base::block_free_at_start ( uint4  n  )  const

true iff block n was free at the start of the transaction on the B-tree.

Definition at line 328 of file btree_base.cc.

References bit_map0.

Referenced by Btree::alter(), and Btree::write_block().

void Btree_base::free_block ( uint4  n  ) 

Definition at line 341 of file btree_base.cc.

References bit_map, bit_map0, and bit_map_low.

Referenced by Btree::alter(), and Btree::delete_item().

uint4 Btree_base::next_free_block (  ) 

Definition at line 400 of file btree_base.cc.

References bit_map, bit_map0, bit_map_low, bit_map_size, extend_bit_map(), and last_block.

Referenced by Btree::add_item(), Btree::alter(), Btree::read_root(), and Btree::split_root().

bool Btree_base::block_free_now ( uint4  n  ) 

Definition at line 424 of file btree_base.cc.

References bit_map.

void Btree_base::calculate_last_block (  ) 

Definition at line 432 of file btree_base.cc.

References bit_map, bit_map_size, and last_block.

void Btree_base::clear_bit_map (  ) 

Definition at line 470 of file btree_base.cc.

References bit_map, and bit_map_size.

Referenced by Btree::commit().

void Btree_base::commit (  ) 

Definition at line 477 of file btree_base.cc.

References bit_map, bit_map0, bit_map_low, and bit_map_size.

Referenced by Btree::commit().

bool Btree_base::is_empty (  )  const

Definition at line 459 of file btree_base.cc.

References bit_map, and bit_map_size.

void Btree_base::swap ( Btree_base other  ) 

Definition at line 131 of file btree_base.cc.

References bit_map, bit_map0, bit_map_low, bit_map_size, block_size, have_fakeroot, item_count, last_block, level, revision, root, and sequential.

Referenced by Btree::basic_open().

void Btree_base::operator= ( const Btree_base other  )  [private]

private assignment operator - you probably want swap() instead

void Btree_base::extend_bit_map (  )  [private]

Definition at line 362 of file btree_base.cc.

References bit_map, bit_map0, BIT_MAP_INC, and bit_map_size.

Referenced by next_free_block().

bool Btree_base::do_unpack_uint ( const char **  start,
const char *  end,
uint4 *  dest,
std::string &  err_msg,
const std::string &  basename,
const char *  varname 
) [private]

Do most of the error handling from unpack_uint().


Member Data Documentation

uint4 Btree_base::revision [private]

Definition at line 133 of file btree_base.h.

Referenced by swap().

uint4 Btree_base::block_size [private]

Definition at line 134 of file btree_base.h.

Referenced by swap().

uint4 Btree_base::root [private]

Definition at line 135 of file btree_base.h.

Referenced by swap().

uint4 Btree_base::level [private]

Definition at line 136 of file btree_base.h.

Referenced by swap().

uint4 Btree_base::bit_map_size [private]

Definition at line 137 of file btree_base.h.

Referenced by Btree_base(), calculate_last_block(), clear_bit_map(), commit(), extend_bit_map(), is_empty(), next_free_block(), and swap().

uint4 Btree_base::item_count [private]

Definition at line 138 of file btree_base.h.

Referenced by swap().

uint4 Btree_base::last_block [private]

Definition at line 139 of file btree_base.h.

Referenced by calculate_last_block(), next_free_block(), and swap().

bool Btree_base::have_fakeroot [private]

Definition at line 140 of file btree_base.h.

Referenced by swap().

bool Btree_base::sequential [private]

Definition at line 141 of file btree_base.h.

Referenced by swap().

uint4 Btree_base::bit_map_low [private]

byte offset into the bit map below which there are no free blocks

Definition at line 146 of file btree_base.h.

Referenced by commit(), free_block(), next_free_block(), and swap().

byte* Btree_base::bit_map0 [private]

the initial state of the bit map of blocks: 1 means in use, 0 means free

Definition at line 150 of file btree_base.h.

Referenced by block_free_at_start(), Btree_base(), commit(), extend_bit_map(), free_block(), next_free_block(), swap(), and ~Btree_base().

byte* Btree_base::bit_map [private]

the current state of the bit map of blocks

Definition at line 153 of file btree_base.h.

Referenced by block_free_now(), Btree_base(), calculate_last_block(), clear_bit_map(), commit(), extend_bit_map(), free_block(), is_empty(), next_free_block(), swap(), and ~Btree_base().


The documentation for this class was generated from the following files:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.