leveldb
Public Member Functions | Private Attributes | List of all members
leveldb::SkipList< Key, Comparator >::Iterator Class Reference

#include <skiplist.h>

Collaboration diagram for leveldb::SkipList< Key, Comparator >::Iterator:
Collaboration graph
[legend]

Public Member Functions

 Iterator (const SkipList *list)
 
bool Valid () const
 
const Keykey () const
 
void Next ()
 
void Prev ()
 
void Seek (const Key &target)
 
void SeekToFirst ()
 
void SeekToLast ()
 

Private Attributes

const SkipListlist_
 
Nodenode_
 

Detailed Description

template<typename Key, class Comparator>
class leveldb::SkipList< Key, Comparator >::Iterator

Definition at line 59 of file skiplist.h.

Constructor & Destructor Documentation

§ Iterator()

template<typename Key , class Comparator >
leveldb::SkipList< Key, Comparator >::Iterator::Iterator ( const SkipList list)
inlineexplicit

Definition at line 191 of file skiplist.h.

191  {
192  list_ = list;
193  node_ = NULL;
194 }
const SkipList * list_
Definition: skiplist.h:92

Member Function Documentation

§ key()

template<typename Key , class Comparator >
const Key & leveldb::SkipList< Key, Comparator >::Iterator::key ( ) const
inline

Definition at line 202 of file skiplist.h.

202  {
203  assert(Valid());
204  return node_->key;
205 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ Next()

template<typename Key , class Comparator >
void leveldb::SkipList< Key, Comparator >::Iterator::Next ( )
inline

Definition at line 208 of file skiplist.h.

208  {
209  assert(Valid());
210  node_ = node_->Next(0);
211 }
Node * Next(int n)
Definition: skiplist.h:154
Here is the call graph for this function:
Here is the caller graph for this function:

§ Prev()

template<typename Key , class Comparator >
void leveldb::SkipList< Key, Comparator >::Iterator::Prev ( )
inline

Definition at line 214 of file skiplist.h.

214  {
215  // Instead of using explicit "prev" links, we just search for the
216  // last node that falls before key.
217  assert(Valid());
219  if (node_ == list_->head_) {
220  node_ = NULL;
221  }
222 }
const SkipList * list_
Definition: skiplist.h:92
Node *const head_
Definition: skiplist.h:104
Node * FindLessThan(const Key &key) const
Definition: skiplist.h:285
Here is the call graph for this function:
Here is the caller graph for this function:

§ Seek()

template<typename Key, class Comparator >
void leveldb::SkipList< Key, Comparator >::Iterator::Seek ( const Key target)
inline

Definition at line 225 of file skiplist.h.

225  {
226  node_ = list_->FindGreaterOrEqual(target, NULL);
227 }
const SkipList * list_
Definition: skiplist.h:92
Node * FindGreaterOrEqual(const Key &key, Node **prev) const
Definition: skiplist.h:262
Here is the call graph for this function:
Here is the caller graph for this function:

§ SeekToFirst()

template<typename Key , class Comparator >
void leveldb::SkipList< Key, Comparator >::Iterator::SeekToFirst ( )
inline

Definition at line 230 of file skiplist.h.

230  {
231  node_ = list_->head_->Next(0);
232 }
const SkipList * list_
Definition: skiplist.h:92
Node *const head_
Definition: skiplist.h:104
Node * Next(int n)
Definition: skiplist.h:154
Here is the call graph for this function:
Here is the caller graph for this function:

§ SeekToLast()

template<typename Key , class Comparator >
void leveldb::SkipList< Key, Comparator >::Iterator::SeekToLast ( )
inline

Definition at line 235 of file skiplist.h.

235  {
236  node_ = list_->FindLast();
237  if (node_ == list_->head_) {
238  node_ = NULL;
239  }
240 }
const SkipList * list_
Definition: skiplist.h:92
Node *const head_
Definition: skiplist.h:104
Node * FindLast() const
Definition: skiplist.h:305
Here is the call graph for this function:
Here is the caller graph for this function:

§ Valid()

template<typename Key , class Comparator >
bool leveldb::SkipList< Key, Comparator >::Iterator::Valid ( ) const
inline

Definition at line 197 of file skiplist.h.

197  {
198  return node_ != NULL;
199 }
Here is the caller graph for this function:

Member Data Documentation

§ list_

template<typename Key, class Comparator>
const SkipList* leveldb::SkipList< Key, Comparator >::Iterator::list_
private

Definition at line 92 of file skiplist.h.

§ node_

template<typename Key, class Comparator>
Node* leveldb::SkipList< Key, Comparator >::Iterator::node_
private

Definition at line 93 of file skiplist.h.


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