Kyoto Cabinet: kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor Class Reference

Kyoto Cabinet

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Friends
kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor Class Reference

Cursor to indicate a record. More...

`#include <kcprotodb.h>`

List of all members.

## Public Member Functions
| Cursor (ProtoDB *db)
| Constructor.
virtual | ~Cursor ()
| Destructor.
bool | accept (Visitor *visitor, bool writable=true, bool step=false)
| Accept a visitor to the current record.
bool | jump ()
| Jump the cursor to the first record for forward scan.
bool | jump (const char *kbuf, size_t ksiz)
| Jump the cursor to a record for forward scan.
bool | jump (const std::string &key)
| Jump the cursor to a record for forward scan.
bool | jump_back ()
| Jump the cursor to the last record for backward scan.
bool | jump_back (const char *kbuf, size_t ksiz)
| Jump the cursor to a record for backward scan.
bool | jump_back (const std::string &key)
| Jump the cursor to a record for backward scan.
bool | step ()
| Step the cursor to the next record.
bool | step_back ()
| Step the cursor to the previous record.
ProtoDB * | db ()
| Get the database object.
## Friends
class | ProtoDB

## Detailed Description

### template<class STRMAP, uint8_t DBTYPE>
class kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor

Cursor to indicate a record.

## Constructor & Destructor Documentation

template<class STRMAP , uint8_t DBTYPE>

kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::Cursor | ( | ProtoDB * | db | ) | `[explicit]`

Constructor.

Parameters:

  db | the container database object.

template<class STRMAP , uint8_t DBTYPE>

virtual kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::~Cursor | ( |  | ) | `[virtual]`

Destructor.

Reimplemented from kyotocabinet::BasicDB::Cursor.

## Member Function Documentation

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::accept | ( | Visitor * | visitor,
|  | bool | writable = `true`,
|  | bool | step = `false`
| ) |  | `[virtual]`

Accept a visitor to the current record.

Parameters:

  visitor | a visitor object.
  writable | true for writable operation, or false for read-only operation.
  step | true to move the cursor to the next record, or false for no move.

Returns:
  true on success, or false on failure.

Note:
  The operation for each record is performed atomically and other threads accessing the same record are blocked. To avoid deadlock, any explicit database operation must not be performed in this function.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::jump | ( |  | ) | `[virtual]`

Jump the cursor to the first record for forward scan.

Returns:
  true on success, or false on failure.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::jump | ( | const char * | kbuf,
|  | size_t | ksiz
| ) |  | `[virtual]`

Jump the cursor to a record for forward scan.

Parameters:

  kbuf | the pointer to the key region.
  ksiz | the size of the key region.

Returns:
  true on success, or false on failure.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::jump | ( | const std::string & | key | ) | `[virtual]`

Jump the cursor to a record for forward scan.

Note:
  Equal to the original Cursor::jump method except that the parameter is std::string.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::jump_back | ( |  | ) | `[virtual]`

Jump the cursor to the last record for backward scan.

Returns:
  true on success, or false on failure.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::jump_back | ( | const char * | kbuf,
|  | size_t | ksiz
| ) |  | `[virtual]`

Jump the cursor to a record for backward scan.

Parameters:

  kbuf | the pointer to the key region.
  ksiz | the size of the key region.

Returns:
  true on success, or false on failure.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::jump_back | ( | const std::string & | key | ) | `[virtual]`

Jump the cursor to a record for backward scan.

Note:
  Equal to the original Cursor::jump_back method except that the parameter is std::string.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::step | ( |  | ) | `[virtual]`

Step the cursor to the next record.

Returns:
  true on success, or false on failure.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

bool kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::step_back | ( |  | ) | `[virtual]`

Step the cursor to the previous record.

Returns:
  true on success, or false on failure.

Implements kyotocabinet::DB::Cursor.

template<class STRMAP , uint8_t DBTYPE>

ProtoDB* kyotocabinet::ProtoDB< STRMAP, DBTYPE >::Cursor::db | ( |  | ) | `[virtual]`

Get the database object.

Returns:
  the database object.

Implements kyotocabinet::BasicDB::Cursor.