BrassSpellingTable Class Reference

#include <brass_spelling.h>

Inheritance diagram for BrassSpellingTable:

Inheritance graph
[legend]
Collaboration diagram for BrassSpellingTable:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BrassSpellingTable (const std::string &dbdir, bool readonly)
 Create a new BrassSpellingTable object.
void merge_changes ()
void add_word (const std::string &word, Xapian::termcount freqinc)
void remove_word (const std::string &word, Xapian::termcount freqdec)
TermListopen_termlist (const std::string &word)
Xapian::doccount get_word_frequency (const std::string &word) const
bool is_modified () const
 Override methods of BrassTable.
void flush_db ()
 Override methods of BrassTable.
void cancel ()
 Override methods of BrassTable.

Private Member Functions

void toggle_word (const std::string &word)
void toggle_fragment (Brass::fragment frag, const std::string &word)

Private Attributes

std::map< std::string,
Xapian::termcount
wordfreq_changes
std::map< Brass::fragment,
std::set< std::string > > 
termlist_deltas
 Changes to make to the termlists.


Detailed Description

Definition at line 59 of file brass_spelling.h.


Constructor & Destructor Documentation

BrassSpellingTable::BrassSpellingTable ( const std::string &  dbdir,
bool  readonly 
) [inline]

Create a new BrassSpellingTable object.

This method does not create or open the table on disk - you must call the create() or open() methods respectively!

Parameters:
dbdir The directory the brass database is stored in.
readonly true if we're opening read-only, else false.

Definition at line 84 of file brass_spelling.h.


Member Function Documentation

void BrassSpellingTable::add_word ( const std::string &  word,
Xapian::termcount  freqinc 
)

void BrassSpellingTable::cancel (  )  [inline]

Override methods of BrassTable.

NB: these aren't virtual, but we always call them on the subclass in cases where it matters.

Reimplemented from BrassTable.

Definition at line 114 of file brass_spelling.h.

References termlist_deltas, and wordfreq_changes.

Referenced by BrassDatabase::cancel().

void BrassSpellingTable::flush_db (  )  [inline]

Override methods of BrassTable.

NB: these aren't virtual, but we always call them on the subclass in cases where it matters.

Reimplemented from BrassTable.

Definition at line 109 of file brass_spelling.h.

References merge_changes().

Referenced by BrassDatabase::set_revision_number().

Xapian::doccount BrassSpellingTable::get_word_frequency ( const std::string &  word  )  const

bool BrassSpellingTable::is_modified (  )  const [inline]

Override methods of BrassTable.

NB: these aren't virtual, but we always call them on the subclass in cases where it matters.

Reimplemented from BrassTable.

Definition at line 105 of file brass_spelling.h.

References wordfreq_changes.

Referenced by BrassDatabase::apply().

void BrassSpellingTable::merge_changes (  ) 

TermList * BrassSpellingTable::open_termlist ( const std::string &  word  ) 

void BrassSpellingTable::remove_word ( const std::string &  word,
Xapian::termcount  freqdec 
)

void BrassSpellingTable::toggle_fragment ( Brass::fragment  frag,
const std::string &  word 
) [private]

Definition at line 111 of file brass_spelling.cc.

References termlist_deltas.

Referenced by toggle_word().

void BrassSpellingTable::toggle_word ( const std::string &  word  )  [private]

Definition at line 206 of file brass_spelling.cc.

References Brass::fragment::data, and toggle_fragment().

Referenced by add_word(), and remove_word().


Member Data Documentation

std::map<Brass::fragment, std::set<std::string> > BrassSpellingTable::termlist_deltas [private]

Changes to make to the termlists.

This list is essentially xor-ed with the list on disk, so an entry here either means a new entry needs to be added on disk, or an existing entry on disk needs to be removed. We do it this way so we don't need to store an additional add/remove flag for every word.

Definition at line 73 of file brass_spelling.h.

Referenced by cancel(), merge_changes(), and toggle_fragment().

std::map<std::string, Xapian::termcount> BrassSpellingTable::wordfreq_changes [private]


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

Documentation for Xapian (version 1.2.13).
Generated on 9 Jan 2013 by Doxygen 1.5.9.