Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HashDB< T > Class Template Reference

Front end for a Berkely DB hash table. More...

#include <HashDB.hpp>

List of all members.

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

Detailed Description

template<class T>
class HashDB< T >

Front end for a Berkely DB hash table.

Definition at line 58 of file HashDB.hpp.


Constructor & Destructor Documentation

template<class T >
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().

template<class T >
HashDB< T >::~HashDB (  )  [inline]

Closes database.

Definition at line 166 of file HashDB.hpp.

References HashDB< T >::CLOSE_FLAGS, HashDB< T >::m_db, and HashDB< T >::m_filename.


Member Function Documentation

template<class T >
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.

template<class T>
HashDB< T >::BOOST_CLASS_REQUIRE ( ,
benzene  ,
HashDBStateConcept   
) [private]
template<class T >
bool HashDB< T >::Exists ( hash_t  hash  )  const [inline]

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.

template<class T >
void HashDB< T >::Flush (  )  [inline]

Flush the db to disk.

Definition at line 315 of file HashDB.hpp.

References HashDB< T >::m_db.

template<class T>
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.

template<class T>
bool HashDB< T >::Get ( hash_t  hash,
T &  data 
) const [inline]

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

template<class T >
bool HashDB< T >::GetHeader ( Header header  )  const [inline, private]

Definition at line 178 of file HashDB.hpp.

References HashDB< T >::Get().

Referenced by HashDB< T >::HashDB().

template<class T>
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.

template<class T>
bool HashDB< T >::Put ( hash_t  hash,
const T &  data 
) [inline]

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

template<class T >
void HashDB< T >::PutHeader ( Header header  )  [inline, private]

Definition at line 185 of file HashDB.hpp.

References HashDB< T >::Put().

Referenced by HashDB< T >::HashDB().


Member Data Documentation

template<class T>
const int HashDB< T >::CLOSE_FLAGS = 0 [static, private]

Definition at line 94 of file HashDB.hpp.

Referenced by HashDB< T >::~HashDB().

template<class T>
DB* HashDB< T >::m_db [private]
template<class T>
std::string HashDB< T >::m_filename [private]
template<class T>
const int HashDB< T >::PERMISSION_FLAGS = 0664 [static, private]

Definition at line 92 of file HashDB.hpp.

Referenced by HashDB< T >::HashDB().


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


6 Jan 2011 Doxygen 1.6.3