All Classes Namespaces Functions Variables Typedefs Enumerations Friends
Public Member Functions
badgerdb::FileIterator Class Reference

Iterator for iterating over the pages in a file. More...

#include <file_iterator.h>

List of all members.

Public Member Functions

 FileIterator ()
 FileIterator (PageFile *file)
 FileIterator (PageFile *file, PageId page_number)
FileIteratoroperator++ ()
FileIterator operator++ (int)
bool operator== (const FileIterator &rhs) const
bool operator!= (const FileIterator &rhs) const
Page operator* () const
PageId getCurrentPageNo ()

Detailed Description

Iterator for iterating over the pages in a file.

This class provides a forward-only iterator for iterating over all of the pages in a file.

Definition at line 23 of file file_iterator.h.

Constructor & Destructor Documentation

Constructs an empty iterator.

Definition at line 28 of file file_iterator.h.

      : file_(NULL),
        current_page_number_(Page::INVALID_NUMBER) {

Constructors an iterator over the pages in a file, starting at the first page.

fileFile to iterate over.

Definition at line 39 of file file_iterator.h.

      : file_(file) {
    assert(file_ != NULL);
    const FileHeader& header = file_->readHeader();
    current_page_number_ = header.first_used_page;
badgerdb::FileIterator::FileIterator ( PageFile file,
PageId  page_number 
) [inline]

Constructs an iterator over the pages in a file, starting at the given page number.

fileFile to iterate over.
page_numberNumber of page to start iterator at.

Definition at line 53 of file file_iterator.h.

      : file_(file),
        current_page_number_(page_number) {

Member Function Documentation

Get current page number.

Definition at line 110 of file file_iterator.h.

    return current_page_number_;
Page badgerdb::FileIterator::operator* ( ) const [inline]

Dereferences the iterator, returning a copy of the current page in the file.

Page in file.

Definition at line 103 of file file_iterator.h.

  { return file_->readPage(current_page_number_); }
FileIterator& badgerdb::FileIterator::operator++ ( ) [inline]

Advances the iterator to the next page in the file.

Definition at line 61 of file file_iterator.h.

    assert(file_ != NULL);
    const PageHeader& header = file_->readPageHeader(current_page_number_);
    current_page_number_ = header.next_page_number;

    return *this;
bool badgerdb::FileIterator::operator== ( const FileIterator rhs) const [inline]

Returns true if this iterator is equal to the given iterator.

rhsIterator to compare against.
True if other iterator is equal to this one.

Definition at line 87 of file file_iterator.h.

    return file_->filename() == rhs.file_->filename() &&
        current_page_number_ == rhs.current_page_number_;

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends