Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

lemur::file::Keyfile Class Reference

Provides C++ interface to the keyfile b-tree package. Arbitrary data can be stored using either int or char * keys. More...

#include <Keyfile.hpp>

List of all members.

Public Types

enum  { MAX_KEY_LENGTH = 512 }

Public Member Functions

 Keyfile ()
 initialize to empty

void put (const char *key, const void *value, int valueSize)
void put (int key, const void *value, int valueSize)
bool get (const char *key, void *value, int &actualSize, int maxSize) const
bool get (const char *key, char **value, int &actualSize) const
bool get (int key, void *value, int &actualSize, int maxSize) const
bool get (int key, char **value, int &actualSize) const
bool next (char *key, int &keyLength, char *value, int &valueLength)
bool next (int &key, char *value, int &valueLength)
bool previous (char *key, int &keyLength, char *value, int &valueLength)
bool previous (int &key, char *value, int &valueLength)
int getSize (const char *key) const
int getSize (int key) const
void remove (const char *key)
 Remove the entry in the b-tree for the given key.

void remove (int key)
 Remove the entry in the b-tree for the given key.

void open (const std::string &filename, int cacheSize=1024 *1024, bool readOnly=false)
 Open a keyfile with the given filename, with cacheSize (default 1MB).

void open (const char *filename, int cacheSize=1024 *1024, bool readOnly=false)
 Open a keyfile with the given filename, with cacheSize (default 1MB).

void openRead (const std::string &filename, int cacheSize=1024 *1024)
void create (const std::string &filename, int cacheSize=1024 *1024)
 Create a keyfile with the given filename, with cacheSize (default 1MB).

void create (const char *filename, int cacheSize=1024 *1024)
 Create a keyfile with the given filename, with cacheSize (default 1MB).

void close ()
 Close a keyfile.

void setFirst ()
 Initialize keyfile to first key for iteration.

bool getNext (int &key, void *value, int &actualSize, int maxSize) const
 get the next key and value pair from the keyfile.

bool getNext (char *key, int maxKeySize, void *value, int &actualSize, int maxSize) const
 get the next key and value pair from the keyfile.

bool getNext (char *key, int &actKeySize, int maxKeySize, void *value, int &actualSize, int maxSize) const

Private Member Functions

void _buildHandle (int cacheSize)
void _createKey (char *keyBuf, int number) const
int _decodeKey (char *keyBuf) const

Private Attributes

char * _handle
int _handleSize


Detailed Description

Provides C++ interface to the keyfile b-tree package. Arbitrary data can be stored using either int or char * keys.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
MAX_KEY_LENGTH  Maximum length of any key in a keyfile.


Constructor & Destructor Documentation

lemur::file::Keyfile::Keyfile  )  [inline]
 

initialize to empty


Member Function Documentation

void lemur::file::Keyfile::_buildHandle int  cacheSize  )  [private]
 

void lemur::file::Keyfile::_createKey char *  keyBuf,
int  number
const [inline, private]
 

int lemur::file::Keyfile::_decodeKey char *  keyBuf  )  const [inline, private]
 

void lemur::file::Keyfile::close  ) 
 

Close a keyfile.

void lemur::file::Keyfile::create const char *  filename,
int  cacheSize = 1024 *1024
 

Create a keyfile with the given filename, with cacheSize (default 1MB).

void lemur::file::Keyfile::create const std::string &  filename,
int  cacheSize = 1024 *1024
 

Create a keyfile with the given filename, with cacheSize (default 1MB).

bool lemur::file::Keyfile::get int  key,
char **  value,
int &  actualSize
const
 

Retrieve the value in the b-tree for the given key. Returns false if key does not exist in the b-tree.

bool lemur::file::Keyfile::get int  key,
void *  value,
int &  actualSize,
int  maxSize
const
 

Retrieve the value in the b-tree for the given key. Returns false if key does not exist in the b-tree.

bool lemur::file::Keyfile::get const char *  key,
char **  value,
int &  actualSize
const
 

Retrieve the value in the b-tree for the given key. Returns false if key does not exist in the b-tree.

bool lemur::file::Keyfile::get const char *  key,
void *  value,
int &  actualSize,
int  maxSize
const
 

Retrieve the value in the b-tree for the given key. Returns false if key does not exist in the b-tree.

bool lemur::file::Keyfile::getNext char *  key,
int &  actKeySize,
int  maxKeySize,
void *  value,
int &  actualSize,
int  maxSize
const
 

get the next key and value pair from the keyfile. return size of key in actKeySize

bool lemur::file::Keyfile::getNext char *  key,
int  maxKeySize,
void *  value,
int &  actualSize,
int  maxSize
const
 

get the next key and value pair from the keyfile.

bool lemur::file::Keyfile::getNext int &  key,
void *  value,
int &  actualSize,
int  maxSize
const
 

get the next key and value pair from the keyfile.

int lemur::file::Keyfile::getSize int  key  )  const
 

Return the size of the data in the b-tree for the given key. Returns -1 if key does not exist in the b-tree.

int lemur::file::Keyfile::getSize const char *  key  )  const
 

Return the size of the data in the b-tree for the given key. Returns -1 if key does not exist in the b-tree.

bool lemur::file::Keyfile::next int &  key,
char *  value,
int &  valueLength
 

bool lemur::file::Keyfile::next char *  key,
int &  keyLength,
char *  value,
int &  valueLength
 

void lemur::file::Keyfile::open const char *  filename,
int  cacheSize = 1024 *1024,
bool  readOnly = false
 

Open a keyfile with the given filename, with cacheSize (default 1MB).

void lemur::file::Keyfile::open const std::string &  filename,
int  cacheSize = 1024 *1024,
bool  readOnly = false
 

Open a keyfile with the given filename, with cacheSize (default 1MB).

void lemur::file::Keyfile::openRead const std::string &  filename,
int  cacheSize = 1024 *1024
 

bool lemur::file::Keyfile::previous int &  key,
char *  value,
int &  valueLength
 

bool lemur::file::Keyfile::previous char *  key,
int &  keyLength,
char *  value,
int &  valueLength
 

void lemur::file::Keyfile::put int  key,
const void *  value,
int  valueSize
 

Insert value into b-tree for the given key. Throws an Exception if the operation fails.

void lemur::file::Keyfile::put const char *  key,
const void *  value,
int  valueSize
 

Insert value into b-tree for the given key. Throws an Exception if the operation fails.

void lemur::file::Keyfile::remove int  key  ) 
 

Remove the entry in the b-tree for the given key.

void lemur::file::Keyfile::remove const char *  key  ) 
 

Remove the entry in the b-tree for the given key.

void lemur::file::Keyfile::setFirst  ) 
 

Initialize keyfile to first key for iteration.


Member Data Documentation

char* lemur::file::Keyfile::_handle [private]
 

int lemur::file::Keyfile::_handleSize [private]
 


The documentation for this class was generated from the following files:
Generated on Tue Jun 15 11:03:05 2010 for Lemur by doxygen 1.3.4