Front end for a Berkely DB hash table. More...
#include <HashDB.hpp>
Classes | |
struct | Header |
Public Member Functions | |
HashDB (const std::string &filename, const std::string &type) | |
Opens database, creates it if it does not exist. | |
~HashDB () | |
Closes database. | |
bool | Exists (hash_t hash) const |
Returns true if hash exists in database. | |
bool | Get (hash_t hash, T &data) const |
Returns true if get is successful. | |
bool | Put (hash_t hash, const T &data) |
Returns true if put is successful. | |
bool | Put (void *k, int ksize, void *d, int dsize) |
Generic Put; for adding non (hash, value) pairs. | |
bool | Get (void *k, int ksize, void *d, int dsize) const |
Generic Get. | |
void | Flush () |
Flush the db to disk. | |
std::string | BDBStatistics () |
Returns statistics of the berkeley db. | |
Private Member Functions | |
BOOST_CLASS_REQUIRE (T, benzene, HashDBStateConcept) | |
bool | GetHeader (Header &header) const |
void | PutHeader (Header &header) |
Private Attributes | |
DB * | m_db |
std::string | m_filename |
Name of database file. | |
Static Private Attributes | |
static const int | PERMISSION_FLAGS = 0664 |
static const int | CLOSE_FLAGS = 0 |
Front end for a Berkely DB hash table.
Definition at line 58 of file HashDB.hpp.
HashDB< T >::HashDB | ( | const std::string & | filename, | |
const std::string & | type | |||
) | [inline] |
Opens database, creates it if it does not exist.
Definition at line 135 of file HashDB.hpp.
References HashDB< T >::GetHeader(), HashDB< T >::m_db, HashDB< T >::m_filename, HashDB< T >::Header::m_type, HashDB< T >::PERMISSION_FLAGS, and HashDB< T >::PutHeader().
Closes database.
Definition at line 166 of file HashDB.hpp.
References HashDB< T >::CLOSE_FLAGS, HashDB< T >::m_db, and HashDB< T >::m_filename.
std::string HashDB< T >::BDBStatistics | ( | ) | [inline] |
Returns statistics of the berkeley db.
Definition at line 321 of file HashDB.hpp.
References HashDB< T >::m_db, and HashDB< T >::m_filename.
HashDB< T >::BOOST_CLASS_REQUIRE | ( | T | , | |
benzene | , | |||
HashDBStateConcept | ||||
) | [private] |
Returns true if hash exists in database.
Definition at line 192 of file HashDB.hpp.
References HashDB< T >::m_db, and HashDB< T >::m_filename.
void HashDB< T >::Flush | ( | ) | [inline] |
bool HashDB< T >::Get | ( | void * | k, | |
int | ksize, | |||
void * | d, | |||
int | dsize | |||
) | const [inline] |
Generic Get.
Definition at line 244 of file HashDB.hpp.
References HashDB< T >::m_db, and HashDB< T >::m_filename.
Returns true if get is successful.
Definition at line 217 of file HashDB.hpp.
References HashDB< T >::m_db, and HashDB< T >::m_filename.
Referenced by HashDB< T >::GetHeader().
Definition at line 178 of file HashDB.hpp.
References HashDB< T >::Get().
Referenced by HashDB< T >::HashDB().
bool HashDB< T >::Put | ( | void * | k, | |
int | ksize, | |||
void * | d, | |||
int | dsize | |||
) | [inline] |
Generic Put; for adding non (hash, value) pairs.
Definition at line 293 of file HashDB.hpp.
References HashDB< T >::m_db, and HashDB< T >::m_filename.
Returns true if put is successful.
Definition at line 271 of file HashDB.hpp.
References HashDB< T >::m_db, and HashDB< T >::m_filename.
Referenced by HashDB< T >::PutHeader().
Definition at line 185 of file HashDB.hpp.
References HashDB< T >::Put().
Referenced by HashDB< T >::HashDB().
const int HashDB< T >::CLOSE_FLAGS = 0 [static, private] |
Definition at line 94 of file HashDB.hpp.
Referenced by HashDB< T >::~HashDB().
Definition at line 124 of file HashDB.hpp.
Referenced by HashDB< T >::BDBStatistics(), HashDB< T >::Exists(), HashDB< T >::Flush(), HashDB< T >::Get(), HashDB< T >::HashDB(), HashDB< T >::Put(), and HashDB< T >::~HashDB().
std::string HashDB< T >::m_filename [private] |
Name of database file.
Definition at line 127 of file HashDB.hpp.
Referenced by HashDB< T >::BDBStatistics(), HashDB< T >::Exists(), HashDB< T >::Get(), HashDB< T >::HashDB(), HashDB< T >::Put(), and HashDB< T >::~HashDB().
const int HashDB< T >::PERMISSION_FLAGS = 0664 [static, private] |
Definition at line 92 of file HashDB.hpp.
Referenced by HashDB< T >::HashDB().