hamsterdb Embedded Database  2.1.7
Public Member Functions | Protected Member Functions | Private Attributes
hamsterdb::cursor Class Reference

#include <hamsterdb.hpp>

Public Member Functions

 cursor (db *db=0, txn *t=0, ham_u32_t flags=0)
 
 cursor (txn *t, db *db=0, ham_u32_t flags=0)
 
 ~cursor ()
 
void create (db *db, txn *t=0, ham_u32_t flags=0)
 
cursor clone ()
 
void move (key *k, record *r, ham_u32_t flags=0)
 
void move_first (key *k=0, record *r=0)
 
void move_last (key *k=0, record *r=0)
 
void move_next (key *k=0, record *r=0)
 
void move_previous (key *k=0, record *r=0)
 
void overwrite (record *r, ham_u32_t flags=0)
 
void find (key *k, record *r=0, ham_u32_t flags=0)
 
void insert (key *k, record *r, ham_u32_t flags=0)
 
void erase (ham_u32_t flags=0)
 
ham_u32_t get_duplicate_count (ham_u32_t flags=0)
 
ham_u64_t get_record_size ()
 
void close ()
 

Protected Member Functions

 cursor (ham_cursor_t *c)
 

Private Attributes

ham_cursor_tm_cursor
 

Detailed Description

A Database Cursor.

This class wraps the ham_cursor_t Cursor handles.

Definition at line 441 of file hamsterdb.hpp.

Constructor & Destructor Documentation

hamsterdb::cursor::cursor ( db db = 0,
txn t = 0,
ham_u32_t  flags = 0 
)
inline

Constructor

Definition at line 444 of file hamsterdb.hpp.

References create().

Referenced by clone().

hamsterdb::cursor::cursor ( txn t,
db db = 0,
ham_u32_t  flags = 0 
)
inline

Constructor

Definition at line 450 of file hamsterdb.hpp.

References create().

hamsterdb::cursor::~cursor ( )
inline

Destructor - automatically closes the Cursor, if necessary.

Definition at line 456 of file hamsterdb.hpp.

References close().

hamsterdb::cursor::cursor ( ham_cursor_t c)
inlineprotected

Definition at line 570 of file hamsterdb.hpp.

References m_cursor.

Member Function Documentation

cursor hamsterdb::cursor::clone ( )
inline

Clones the Cursor.

Definition at line 473 of file hamsterdb.hpp.

References cursor(), error(), ham_cursor_clone(), and m_cursor.

void hamsterdb::cursor::close ( )
inline

Closes the Cursor.

Definition at line 559 of file hamsterdb.hpp.

References error(), ham_cursor_close(), and m_cursor.

Referenced by create(), and ~cursor().

void hamsterdb::cursor::create ( db db,
txn t = 0,
ham_u32_t  flags = 0 
)
inline

Creates a new Cursor.

Definition at line 461 of file hamsterdb.hpp.

References close(), error(), hamsterdb::db::get_handle(), ham_cursor_create(), and m_cursor.

Referenced by cursor().

void hamsterdb::cursor::erase ( ham_u32_t  flags = 0)
inline

Erases the current key/record pair.

Definition at line 534 of file hamsterdb.hpp.

References error(), ham_cursor_erase(), and m_cursor.

void hamsterdb::cursor::find ( key k,
record r = 0,
ham_u32_t  flags = 0 
)
inline

Finds a key.

Definition at line 518 of file hamsterdb.hpp.

References error(), hamsterdb::key::get_handle(), ham_cursor_find(), and m_cursor.

Referenced by run_demo().

ham_u32_t hamsterdb::cursor::get_duplicate_count ( ham_u32_t  flags = 0)
inline

Returns the number of duplicate keys.

Definition at line 541 of file hamsterdb.hpp.

References error(), ham_cursor_get_duplicate_count(), and m_cursor.

ham_u64_t hamsterdb::cursor::get_record_size ( )
inline

Returns the size of the current record.

Definition at line 550 of file hamsterdb.hpp.

References error(), ham_cursor_get_record_size(), and m_cursor.

void hamsterdb::cursor::insert ( key k,
record r,
ham_u32_t  flags = 0 
)
inline

Inserts a key/record pair.

Definition at line 526 of file hamsterdb.hpp.

References error(), hamsterdb::key::get_handle(), hamsterdb::record::get_handle(), ham_cursor_insert(), and m_cursor.

void hamsterdb::cursor::move ( key k,
record r,
ham_u32_t  flags = 0 
)
inline

Moves the Cursor, and retrieves the key/record of the new position.

Definition at line 482 of file hamsterdb.hpp.

References error(), hamsterdb::key::get_handle(), hamsterdb::record::get_handle(), ham_cursor_move(), and m_cursor.

Referenced by move_first(), move_last(), move_next(), move_previous(), and run_demo().

void hamsterdb::cursor::move_first ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the first Database element.

Definition at line 490 of file hamsterdb.hpp.

References HAM_CURSOR_FIRST, and move().

void hamsterdb::cursor::move_last ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the last Database element.

Definition at line 495 of file hamsterdb.hpp.

References HAM_CURSOR_LAST, and move().

void hamsterdb::cursor::move_next ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the next Database element.

Definition at line 500 of file hamsterdb.hpp.

References HAM_CURSOR_NEXT, and move().

Referenced by run_demo().

void hamsterdb::cursor::move_previous ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the previous Database element.

Definition at line 505 of file hamsterdb.hpp.

References HAM_CURSOR_PREVIOUS, and move().

void hamsterdb::cursor::overwrite ( record r,
ham_u32_t  flags = 0 
)
inline

Overwrites the current record.

Definition at line 510 of file hamsterdb.hpp.

References error(), hamsterdb::record::get_handle(), ham_cursor_overwrite(), and m_cursor.

Field Documentation

ham_cursor_t* hamsterdb::cursor::m_cursor
private

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