FreeLing
4.0
|
Class to wrap a berkeley DB database and unify access. More...
#include <database.h>
Public Member Functions | |
database (int) | |
constructor | |
database (const std::wstring &) | |
constructor | |
~database () | |
destructor | |
void | add_database (const std::wstring &, const std::wstring &) |
add a new pair (key, data) to the database | |
void | remove_database (const std::wstring &) |
remove an entry from the database | |
void | replace_database (const std::wstring &, const std::wstring &) |
replace the data for an entry in the database | |
std::wstring | access_database (const std::wstring &) const |
search for a string key in the DB, return associated string data. | |
void | dump_database (std::wostream &, bool keysonly=false) const |
dump listing of database content to given stream | |
Private Attributes | |
int | DBtype |
DB type (map, hash_map, preftree) | |
std::map< std::wstring, std::wstring > | dbmap |
Dictionary for map type. | |
PrefTree * | dbptree |
Dictionary for hash_map type. |
Class to wrap a berkeley DB database and unify access.
All databases in Freeling use a string key to index string data.
freeling::database::database | ( | int | type | ) |
freeling::database::database | ( | const std::wstring & | ) |
constructor
destructor
References DB_PREFTREE.
wstring freeling::database::access_database | ( | const std::wstring & | ) | const |
search for a string key in the DB, return associated string data.
References DB_MAP, DB_PREFTREE, and freeling::List::ListRecData::getValue().
Referenced by freeling::punts::analyze(), and freeling::punts::punts().
void freeling::database::add_database | ( | const std::wstring & | , |
const std::wstring & | |||
) |
add a new pair (key, data) to the database
add a new pair (key, data) to the database, or if 'key' already exists, concatenate 'data' to the existing entry
References DB_MAP, and DB_PREFTREE.
void freeling::database::dump_database | ( | std::wostream & | , |
bool | keysonly = false |
||
) | const |
dump listing of database content to given stream
dump listing of database to given stream
References DB_MAP, and DB_PREFTREE.
void freeling::database::remove_database | ( | const std::wstring & | ) |
remove an entry from the database
remove database entry for given key
References DB_MAP, and DB_PREFTREE.
void freeling::database::replace_database | ( | const std::wstring & | key, |
const std::wstring & | data | ||
) |
replace the data for an entry in the database
Replace with 'data' information associated to entry 'key' If the entry is not there, insert it.
References DB_MAP, DB_PREFTREE, and freeling::List::ListRecData::setValue().
std::map<std::wstring,std::wstring> freeling::database::dbmap [private] |
Dictionary for map type.
PrefTree* freeling::database::dbptree [private] |
Dictionary for hash_map type.
Dictionary for pref tree type
int freeling::database::DBtype [private] |
DB type (map, hash_map, preftree)