CDB++ API


Detailed Description

The CDB++ API.


Data Structures

class  cdbpp::murmurhash2
 MurmurHash2. More...
class  cdbpp::builder_exception
 Exception class for the CDB++ builder. More...
class  cdbpp::builder_base< hash_function >
 CDB++ builder. More...
class  cdbpp::cdbpp_exception
 Exception class for the CDB++ reader. More...
class  cdbpp::cdbpp_base< hash_function >
 CDB++ reader. More...

Typedefs

typedef builder_base< murmurhash2 > cdbpp::builder
 CDB++ builder with MurmurHash2.
typedef cdbpp_base< murmurhash2 > cdbpp::cdbpp
 CDB++ reader with MurmurHash2.

Functions

 cdbpp::builder_base::builder_base (std::ofstream &os)
 Constructs an object.
virtual cdbpp::builder_base::~builder_base ()
 Destructs an object.
template<class key_t, class value_t>
void cdbpp::builder_base::put (const key_t *key, size_t ksize, const value_t *value, size_t vsize)
 Inserts a pair of key and value to the database.
 cdbpp::cdbpp_base::cdbpp_base ()
 Constructs an object.
 cdbpp::cdbpp_base::cdbpp_base (const void *buffer, size_t size, bool own)
 Constructs an object by opening a database on memory.
 cdbpp::cdbpp_base::cdbpp_base (std::ifstream &ifs)
 Constructs an object by opening a database from an input stream.
virtual cdbpp::cdbpp_base::~cdbpp_base ()
 Destructs the object.
bool cdbpp::cdbpp_base::is_open () const
 Tests if the database is opened.
size_t cdbpp::cdbpp_base::size () const
 Obtains the number of elements in the database.
bool cdbpp::cdbpp_base::empty () const
 Tests if the database is empty.
size_t cdbpp::cdbpp_base::open (std::ifstream &ifs)
 Opens the database from an input stream.
size_t cdbpp::cdbpp_base::open (const void *buffer, size_t size, bool own=false)
 Opens the database from a memory image.
void cdbpp::cdbpp_base::close ()
 Closes the database.
const void * cdbpp::cdbpp_base::get (const void *key, size_t ksize, size_t *vsize) const
 Finds the key in the database.


Function Documentation

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

Constructs an object.

Parameters:
os The 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 ( std::ifstream &  ifs  )  [inline, inherited]

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

Parameters:
ifs The input stream from which this library reads a database.

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

Constructs an object by opening a database on memory.

Parameters:
buffer The pointer to the memory image of the database.
size The size of the memory image.
own If this is set to true, this library will call delete[] when the database is closed.

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

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, inherited]

Finds the key in the database.

Parameters:
key The pointer to the key.
ksize The size of the key.
vsize The 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, inherited]

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 ( const void *  buffer,
size_t  size,
bool  own = false 
) [inline, inherited]

Opens the database from a memory image.

Parameters:
buffer The pointer to the memory image of the database.
size The size of the memory image.
own If this is set to true, this library will call delete[] when the database is closed.

template<typename hash_function>
size_t cdbpp::cdbpp_base< hash_function >::open ( std::ifstream &  ifs  )  [inline, inherited]

Opens the database from an input stream.

Parameters:
ifs The input stream from which this library reads a database.

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, inherited]

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:
key The pointer to the key.
ksize The size of the key.
value The pointer to the value.
vsize The size of the value.

template<typename hash_function>
size_t cdbpp::cdbpp_base< hash_function >::size (  )  const [inline, inherited]

Obtains the number of elements in the database.

Returns:
size_t The number of elements.


Copyright (c) 2002-2009 by Naoaki Okazaki
Tue Jul 14 01:35:35 2009