NERsuite  1.1.1
Classes | Typedefs | Enumerations | Enumerator | Functions | Variables
CDB++ API

Classes

class  cdbpp::murmurhash2
struct  cdbpp::tableref_t
class  cdbpp::builder_exception
class  cdbpp::builder_base< hash_function >
struct  cdbpp::builder_base< hash_function >::bucket
class  cdbpp::cdbpp_exception
class  cdbpp::cdbpp_base< hash_function >
struct  cdbpp::cdbpp_base< hash_function >::bucket_t
struct  cdbpp::cdbpp_base< hash_function >::hashtable_t

Typedefs

typedef std::vector< bucket > cdbpp::builder_base< hash_function >::hashtable
typedef builder_base< murmurhash2 > cdbpp::builder
 CDB++ builder with MurmurHash2.
typedef cdbpp_base< murmurhash2 > cdbpp::cdbpp
 CDB++ reader with MurmurHash2.

Enumerations

enum  { VERSION = 1, NUM_TABLES = 256, BYTEORDER_CHECK = 0x62445371 }

Functions

static uint32_t cdbpp::murmurhash2::get32bits (const char *d)
uint32_t cdbpp::murmurhash2::operator() (const void *key, size_t size) const
static uint32_t cdbpp::get_data_begin ()
 cdbpp::builder_exception::builder_exception (const std::string &msg)
 cdbpp::builder_base< hash_function >::bucket::bucket (uint32_t h, uint32_t o)
 cdbpp::builder_base< hash_function >::builder_base (std::ofstream &os)
virtual cdbpp::builder_base< hash_function >::~builder_base ()
template<class key_t , class value_t >
void cdbpp::builder_base< hash_function >::put (const key_t *key, size_t ksize, const value_t *value, size_t vsize)
void cdbpp::builder_base< hash_function >::close ()
void cdbpp::builder_base< hash_function >::write_uint32 (uint32_t value)
 cdbpp::cdbpp_exception::cdbpp_exception (const std::string &msg)
 cdbpp::cdbpp_base< hash_function >::cdbpp_base ()
 cdbpp::cdbpp_base< hash_function >::cdbpp_base (const void *buffer, size_t size, bool own)
 cdbpp::cdbpp_base< hash_function >::cdbpp_base (std::ifstream &ifs)
virtual cdbpp::cdbpp_base< hash_function >::~cdbpp_base ()
bool cdbpp::cdbpp_base< hash_function >::is_open () const
size_t cdbpp::cdbpp_base< hash_function >::size () const
bool cdbpp::cdbpp_base< hash_function >::empty () const
size_t cdbpp::cdbpp_base< hash_function >::open (std::ifstream &ifs)
size_t cdbpp::cdbpp_base< hash_function >::open (const void *buffer, size_t size, bool own=false)
void cdbpp::cdbpp_base< hash_function >::close ()
const void * cdbpp::cdbpp_base< hash_function >::get (const void *key, size_t ksize, size_t *vsize) const
uint32_t cdbpp::cdbpp_base< hash_function >::read_uint32 (const uint8_t *p) const

Variables

uint32_t cdbpp::tableref_t::offset
uint32_t cdbpp::tableref_t::num
uint32_t cdbpp::builder_base< hash_function >::bucket::hash
uint32_t cdbpp::builder_base< hash_function >::bucket::offset
std::ofstream & cdbpp::builder_base< hash_function >::m_os
uint32_t cdbpp::builder_base< hash_function >::m_begin
uint32_t cdbpp::builder_base< hash_function >::m_cur
hashtable cdbpp::builder_base< hash_function >::m_ht [NUM_TABLES]
uint32_t cdbpp::cdbpp_base< hash_function >::bucket_t::hash
uint32_t cdbpp::cdbpp_base< hash_function >::bucket_t::offset
uint32_t cdbpp::cdbpp_base< hash_function >::hashtable_t::num
const bucket_t * cdbpp::cdbpp_base< hash_function >::hashtable_t::buckets
const uint8_t * cdbpp::cdbpp_base< hash_function >::m_buffer
size_t cdbpp::cdbpp_base< hash_function >::m_size
bool cdbpp::cdbpp_base< hash_function >::m_own
hashtable_t cdbpp::cdbpp_base< hash_function >::m_ht [NUM_TABLES]
size_t cdbpp::cdbpp_base< hash_function >::m_n

Detailed Description

The CDB++ API.


Function Documentation

template<typename hash_function >
cdbpp::builder_base< hash_function >::builder_base ( std::ofstream &  os) [inline]

Constructs an object.

Parameters:
osThe output stream to which this class write the database. This stream must be opened in the binary mode (std::ios_base::binary).
template<typename hash_function >
cdbpp::cdbpp_base< hash_function >::cdbpp_base ( ) [inline]

Constructs an object.

template<typename hash_function >
cdbpp::cdbpp_base< hash_function >::cdbpp_base ( const void *  buffer,
size_t  size,
bool  own 
) [inline]

Constructs an object by opening a database on memory.

Parameters:
bufferThe pointer to the memory image of the database.
sizeThe size of the memory image.
ownIf this is set to true, this library will call delete[] when the database is closed.
template<typename hash_function >
cdbpp::cdbpp_base< hash_function >::cdbpp_base ( std::ifstream &  ifs) [inline]

Constructs an object by opening a database from an input stream.

Parameters:
ifsThe input stream from which this library reads a database.
template<typename hash_function >
void cdbpp::cdbpp_base< hash_function >::close ( ) [inline]

Closes the database.

template<typename hash_function >
bool cdbpp::cdbpp_base< hash_function >::empty ( ) const [inline]

Tests if the database is empty.

Returns:
bool true if the number of records is zero, false otherwise.
template<typename hash_function >
const void* cdbpp::cdbpp_base< hash_function >::get ( const void *  key,
size_t  ksize,
size_t *  vsize 
) const [inline]

Finds the key in the database.

Parameters:
keyThe pointer to the key.
ksizeThe size of the key.
vsizeThe pointer of a variable to which the size of the value returned. This parameter can be NULL.
Returns:
const void* The pointer to the value.
template<typename hash_function >
bool cdbpp::cdbpp_base< hash_function >::is_open ( ) const [inline]

Tests if the database is opened.

Returns:
bool true if the database is opened, false otherwise.
template<typename hash_function >
size_t cdbpp::cdbpp_base< hash_function >::open ( std::ifstream &  ifs) [inline]

Opens the database from an input stream.

Parameters:
ifsThe input stream from which this library reads a database.
template<typename hash_function >
size_t cdbpp::cdbpp_base< hash_function >::open ( const void *  buffer,
size_t  size,
bool  own = false 
) [inline]

Opens the database from a memory image.

Parameters:
bufferThe pointer to the memory image of the database.
sizeThe size of the memory image.
ownIf this is set to true, this library will call delete[] when the database is closed.
template<typename hash_function >
template<class key_t , class value_t >
void cdbpp::builder_base< hash_function >::put ( const key_t *  key,
size_t  ksize,
const value_t *  value,
size_t  vsize 
) [inline]

Inserts a pair of key and value to the database. Any key in the database should be unique, but this library does not check duplicated keys.

Parameters:
keyThe pointer to the key.
ksizeThe size of the key.
valueThe pointer to the value.
vsizeThe size of the value.
template<typename hash_function >
size_t cdbpp::cdbpp_base< hash_function >::size ( ) const [inline]

Obtains the number of elements in the database.

Returns:
size_t The number of elements.
template<typename hash_function >
virtual cdbpp::builder_base< hash_function >::~builder_base ( ) [inline, virtual]

Destructs an object.

template<typename hash_function >
virtual cdbpp::cdbpp_base< hash_function >::~cdbpp_base ( ) [inline, virtual]

Destructs the object.

 All Classes Functions Variables