PhraseHunter::CorpusManager Class Reference

Class for managing corpus repositories. More...

#include <corpus.h>

Collaboration diagram for PhraseHunter::CorpusManager:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Mode { Read = 1, Write = 2 }
 The mode in which a CorpusManager object should operate. More...

Public Member Functions

 CorpusManager (const std::string &corpus_repository, CorpusManager::Mode mode=Read) throw (Exceptions::NoSuchCorpusError)
 Constructor.
 ~CorpusManager ()
SearchEnginesearchEngine ()
 Factory function that returns a pointer to a newly constructed SearchEngine object.
StatisticsEnginestatisticsEngine ()
 Factory function that returns a pointer to a newly constructed StatisticsEngine object.
ContextReadercontextReader ()
 Factory function that returns a pointer to a newly constructed ContextReader object.
std::string documentName (DocID docID)
 Get the file name for a particular DocID.
void addFile (const std::string &filename, const std::string &info) throw (Exceptions::FileError, Exceptions::NoIndexerError, std::out_of_range)
 Add a file to the repository.
void removeFile (DocID docID) throw (Exceptions::NoIndexerError)
 Remove a particular file from the repository.

Private Member Functions

boost::filesystem::path textDir ()
boost::filesystem::path indexFile ()

Private Attributes

CorpusManager::Mode m_mode
IndexManagerm_indexer
const boost::filesystem::path m_directory
SearchEnginem_searchEngine
StatisticsEnginem_statistics
ContextReaderm_contextReader
SQLitePP::SqliteDB m_db

Classes

struct  Repository

Detailed Description

Class for managing corpus repositories.

Definition at line 37 of file corpus.h.


Member Enumeration Documentation

enum PhraseHunter::CorpusManager::Mode

The mode in which a CorpusManager object should operate.

Enumerator:
Read 
Write 

Definition at line 42 of file corpus.h.


Constructor & Destructor Documentation

PhraseHunter::CorpusManager::CorpusManager ( const std::string &  corpus_repository,
CorpusManager::Mode  mode = Read 
) throw (Exceptions::NoSuchCorpusError)

Constructor.

Parameters:
corpus_repository Path to the base directory of the corpus.
mode The mode in which a CorpusManager object should operate.

Definition at line 47 of file corpus.cpp.

References qt4::exists().

PhraseHunter::CorpusManager::~CorpusManager (  ) 

Definition at line 62 of file corpus.cpp.

References m_indexer, m_searchEngine, and m_statistics.


Member Function Documentation

SearchEngine * PhraseHunter::CorpusManager::searchEngine (  ) 

Factory function that returns a pointer to a newly constructed SearchEngine object.

Definition at line 70 of file corpus.cpp.

References m_db, and m_searchEngine.

Referenced by SearchTab::enableSearch(), main(), and statisticsEngine().

StatisticsEngine * PhraseHunter::CorpusManager::statisticsEngine (  ) 

Factory function that returns a pointer to a newly constructed StatisticsEngine object.

Definition at line 78 of file corpus.cpp.

References contextReader(), m_db, m_statistics, and searchEngine().

Referenced by SearchTab::enableSearch(), and PhSearchImpl::fileOpen().

ContextReader * PhraseHunter::CorpusManager::contextReader (  ) 

Factory function that returns a pointer to a newly constructed ContextReader object.

Definition at line 86 of file corpus.cpp.

References m_contextReader, and textDir().

Referenced by SearchTab::enableSearch(), PhSearchImpl::openDocument(), and statisticsEngine().

std::string PhraseHunter::CorpusManager::documentName ( DocID  docID  ) 

Get the file name for a particular DocID.

Definition at line 94 of file corpus.cpp.

References SQLitePP::ResultIterator::get(), SQLitePP::ResultIterator::hasMoreRows(), m_db, and SQLitePP::SqliteDB::statement().

void PhraseHunter::CorpusManager::addFile ( const std::string &  filename,
const std::string &  info 
) throw (Exceptions::FileError, Exceptions::NoIndexerError, std::out_of_range)

Add a file to the repository.

Parameters:
filename The file to be added
info String holding information about this file. Will be written to info file.

Definition at line 108 of file corpus.cpp.

Referenced by main().

void PhraseHunter::CorpusManager::removeFile ( DocID  docID  )  throw (Exceptions::NoIndexerError)

Remove a particular file from the repository.

Definition at line 132 of file corpus.cpp.

boost::filesystem::path PhraseHunter::CorpusManager::textDir (  )  [inline, private]

Definition at line 78 of file corpus.h.

References m_directory, and PhraseHunter::CorpusManager::Repository::TextDirectory.

Referenced by contextReader().

boost::filesystem::path PhraseHunter::CorpusManager::indexFile (  )  [inline, private]

Definition at line 83 of file corpus.h.

References PhraseHunter::CorpusManager::Repository::IndexFile, and m_directory.


Member Data Documentation

CorpusManager::Mode PhraseHunter::CorpusManager::m_mode [private]

Definition at line 87 of file corpus.h.

IndexManager* PhraseHunter::CorpusManager::m_indexer [private]

Definition at line 88 of file corpus.h.

Referenced by ~CorpusManager().

const boost::filesystem::path PhraseHunter::CorpusManager::m_directory [private]

Definition at line 89 of file corpus.h.

Referenced by indexFile(), and textDir().

SearchEngine* PhraseHunter::CorpusManager::m_searchEngine [private]

Definition at line 90 of file corpus.h.

Referenced by searchEngine(), and ~CorpusManager().

StatisticsEngine* PhraseHunter::CorpusManager::m_statistics [private]

Definition at line 91 of file corpus.h.

Referenced by statisticsEngine(), and ~CorpusManager().

ContextReader* PhraseHunter::CorpusManager::m_contextReader [private]

Definition at line 92 of file corpus.h.

Referenced by contextReader().

SQLitePP::SqliteDB PhraseHunter::CorpusManager::m_db [private]

Definition at line 94 of file corpus.h.

Referenced by documentName(), searchEngine(), and statisticsEngine().


The documentation for this class was generated from the following files:
Generated on Thu Dec 21 16:14:44 2006 for The Phrasehunter by  doxygen 1.5.1