FreeLing  4.0
Public Member Functions | Private Attributes
freeling::database Class Reference

Class to wrap a berkeley DB database and unify access. More...

#include <database.h>

Inheritance diagram for freeling::database:
Inheritance graph
[legend]
Collaboration diagram for freeling::database:
Collaboration graph
[legend]

List of all members.

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.
PrefTreedbptree
 Dictionary for hash_map type.

Detailed Description

Class to wrap a berkeley DB database and unify access.

All databases in Freeling use a string key to index string data.


Constructor & Destructor Documentation

constructor

Create an empty database of given type.

References DB_PREFTREE.

freeling::database::database ( const std::wstring &  )

constructor

destructor

References DB_PREFTREE.


Member Function Documentation

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().


Member Data Documentation

std::map<std::wstring,std::wstring> freeling::database::dbmap [private]

Dictionary for map type.

Dictionary for hash_map type.

Dictionary for pref tree type

DB type (map, hash_map, preftree)


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