#include <Iterator.hpp>
Classes | |
struct | Chunk |
struct | Header |
struct | Page |
Public Types | |
typedef uint16_t | value_size_t |
typedef std::vector< value_size_t > | SizeVector |
typedef boost::shared_ptr < Iterator > | SharedPointer |
Public Member Functions | |
Iterator () | |
Iterator (const Header &header, FILE *page) | |
Iterator (const Header &header, ByteBuffer *buffer) | |
Iterator (const Header &header, SizeVector *value_sizes, FILE *page) | |
Iterator (const Header &header, SizeVector *value_sizes, ByteBuffer *buffer) | |
~Iterator () | |
void | advance () |
uint16_t | checksum () const |
const Chunk & | chunk () const |
const SizeVector & | value_sizes () const |
const Header & | header () const |
bool | is_paged () const |
bool | is_valid () const |
size_t | length () const |
size_t | payload () const |
void | rewind () |
size_t | size () const |
bool | swap () throw (std::runtime_error) |
const char * | value () const |
Static Public Attributes | |
static const size_t | max_chunk_size = 10 * 1024 * 1024 |
static const size_t | sizeof_value_size_t = sizeof(value_size_t) |
static const size_t | sizeof_header = sizeof(Header) |
Private Attributes | |
Header | header_ |
SizeVector * | vsizes_ |
Chunk | chunk_ |
Page | page_ |
size_t | index_ |
A class that represents a iteratable postlist.
Created on Jun 22, 2008
Definition at line 27 of file Iterator.hpp.
typedef boost::shared_ptr<Iterator> aitools::invertedindex::Iterator::SharedPointer |
Definition at line 35 of file Iterator.hpp.
typedef std::vector<value_size_t> aitools::invertedindex::Iterator::SizeVector |
Definition at line 33 of file Iterator.hpp.
typedef uint16_t aitools::invertedindex::Iterator::value_size_t |
Definition at line 31 of file Iterator.hpp.
aitools::invertedindex::Iterator::Iterator | ( | ) |
Definition at line 7 of file Iterator.cpp.
aitools::invertedindex::Iterator::Iterator | ( | const Header & | header, | |
FILE * | page | |||
) |
Definition at line 12 of file Iterator.cpp.
References length(), swap(), aitools::invertedindex::Iterator::Header::value_size, and vsizes_.
aitools::invertedindex::Iterator::Iterator | ( | const Header & | header, | |
ByteBuffer * | buffer | |||
) |
Definition at line 25 of file Iterator.cpp.
References chunk_, aitools::invertedindex::Iterator::Chunk::end, header_, length(), aitools::invertedindex::Iterator::Header::value_count, aitools::invertedindex::Iterator::Header::value_size, and vsizes_.
aitools::invertedindex::Iterator::Iterator | ( | const Header & | header, | |
SizeVector * | value_sizes, | |||
FILE * | page | |||
) |
Definition at line 38 of file Iterator.cpp.
References length(), swap(), aitools::invertedindex::Iterator::Header::value_size, and vsizes_.
aitools::invertedindex::Iterator::Iterator | ( | const Header & | header, | |
SizeVector * | value_sizes, | |||
ByteBuffer * | buffer | |||
) |
Definition at line 52 of file Iterator.cpp.
References chunk_, aitools::invertedindex::Iterator::Chunk::end, header_, length(), aitools::invertedindex::Iterator::Header::value_count, aitools::invertedindex::Iterator::Header::value_size, and vsizes_.
aitools::invertedindex::Iterator::~Iterator | ( | ) |
Definition at line 66 of file Iterator.cpp.
References vsizes_.
void aitools::invertedindex::Iterator::advance | ( | ) |
Definition at line 72 of file Iterator.cpp.
References chunk_, aitools::invertedindex::Iterator::Chunk::end, index_, aitools::invertedindex::Iterator::Chunk::offset, size(), and swap().
uint16_t aitools::invertedindex::Iterator::checksum | ( | ) | const |
Definition at line 82 of file Iterator.cpp.
References aitools::invertedindex::Iterator::Header::checksum, and header_.
const Iterator::Chunk & aitools::invertedindex::Iterator::chunk | ( | ) | const |
Definition at line 88 of file Iterator.cpp.
References chunk_.
const Iterator::Header & aitools::invertedindex::Iterator::header | ( | ) | const |
Definition at line 94 of file Iterator.cpp.
References header_.
bool aitools::invertedindex::Iterator::is_paged | ( | ) | const [inline] |
Definition at line 134 of file Iterator.hpp.
References aitools::invertedindex::Iterator::Page::file, and page_.
Referenced by rewind().
bool aitools::invertedindex::Iterator::is_valid | ( | ) | const [inline] |
Definition at line 139 of file Iterator.hpp.
References header_, index_, and aitools::invertedindex::Iterator::Header::value_count.
size_t aitools::invertedindex::Iterator::length | ( | ) | const |
Definition at line 106 of file Iterator.cpp.
References header_, and aitools::invertedindex::Iterator::Header::value_count.
Referenced by Iterator().
size_t aitools::invertedindex::Iterator::payload | ( | ) | const |
Definition at line 112 of file Iterator.cpp.
References header_, and aitools::invertedindex::Iterator::Header::payload.
void aitools::invertedindex::Iterator::rewind | ( | ) |
Definition at line 118 of file Iterator.cpp.
References aitools::invertedindex::Iterator::Chunk::begin, chunk_, aitools::invertedindex::Iterator::Chunk::end, aitools::invertedindex::Iterator::Page::file, aitools::util::fseek(), index_, is_paged(), aitools::invertedindex::Iterator::Page::offset, aitools::invertedindex::Iterator::Chunk::offset, page_, and swap().
size_t aitools::invertedindex::Iterator::size | ( | ) | const [inline] |
Definition at line 150 of file Iterator.hpp.
References header_, index_, and aitools::invertedindex::Iterator::Header::value_size.
Referenced by advance().
bool aitools::invertedindex::Iterator::swap | ( | ) | throw (std::runtime_error) |
Definition at line 132 of file Iterator.cpp.
References aitools::invertedindex::Iterator::Chunk::begin, aitools::invertedindex::Iterator::Chunk::buffer, chunk_, aitools::invertedindex::ByteBuffer::data(), aitools::invertedindex::Iterator::Chunk::end, aitools::invertedindex::Iterator::Page::file, aitools::util::fread(), header_, index_, max_chunk_size, aitools::invertedindex::Iterator::Chunk::offset, page_, aitools::invertedindex::ByteBuffer::resize(), aitools::invertedindex::Iterator::Header::value_count, and aitools::invertedindex::Iterator::Header::value_size.
Referenced by advance(), Iterator(), and rewind().
const char* aitools::invertedindex::Iterator::value | ( | ) | const [inline] |
Definition at line 157 of file Iterator.hpp.
References aitools::invertedindex::Iterator::Chunk::buffer, chunk_, aitools::invertedindex::ByteBuffer::data(), and aitools::invertedindex::Iterator::Chunk::offset.
const Iterator::SizeVector & aitools::invertedindex::Iterator::value_sizes | ( | ) | const |
Definition at line 100 of file Iterator.cpp.
References vsizes_.
Definition at line 166 of file Iterator.hpp.
Referenced by advance(), chunk(), Iterator(), rewind(), swap(), and value().
Definition at line 164 of file Iterator.hpp.
Referenced by checksum(), header(), is_valid(), Iterator(), length(), payload(), size(), and swap().
size_t aitools::invertedindex::Iterator::index_ [private] |
Definition at line 168 of file Iterator.hpp.
Referenced by advance(), is_valid(), rewind(), size(), and swap().
const size_t aitools::invertedindex::Iterator::max_chunk_size = 10 * 1024 * 1024 [static] |
Definition at line 104 of file Iterator.hpp.
Referenced by aitools::invertedindex::PostlistBuilder::append(), and swap().
Page aitools::invertedindex::Iterator::page_ [private] |
Definition at line 167 of file Iterator.hpp.
Referenced by is_paged(), rewind(), and swap().
const size_t aitools::invertedindex::Iterator::sizeof_header = sizeof(Header) [static] |
Definition at line 106 of file Iterator.hpp.
const size_t aitools::invertedindex::Iterator::sizeof_value_size_t = sizeof(value_size_t) [static] |
Definition at line 105 of file Iterator.hpp.
Definition at line 165 of file Iterator.hpp.
Referenced by Iterator(), value_sizes(), and ~Iterator().