#include <rewindable_stream.hh>

Public Member Functions | |
| RewindableStream () | |
| ~RewindableStream () | |
| void | Init (const ChainPosition &position) |
| RewindableStream (const ChainPosition &position) | |
| const void * | Get () const |
| void * | Get () |
| operator bool () const | |
| bool | operator! () const |
| void | Mark () |
| void | Rewind () |
| RewindableStream & | operator++ () |
| void | Poison () |
Definition at line 20 of file rewindable_stream.hh.
| util::stream::RewindableStream::RewindableStream | ( | ) |
Creates an uninitialized RewindableStream. You **must** call Init() on it later!
Definition at line 9 of file rewindable_stream.cc.
| util::stream::RewindableStream::~RewindableStream | ( | ) | [inline] |
Definition at line 28 of file rewindable_stream.hh.
References Poison().

| util::stream::RewindableStream::RewindableStream | ( | const ChainPosition & | position | ) | [inline, explicit] |
Constructs a RewindableStream at a specific position in a Chain all in one step.
Equivalent to RewindableStream a(); a.Init(....);
Definition at line 47 of file rewindable_stream.hh.
References Init().

| void* util::stream::RewindableStream::Get | ( | ) | [inline] |
Gets the record at the current stream position.
Definition at line 64 of file rewindable_stream.hh.
| const void* util::stream::RewindableStream::Get | ( | ) | const [inline] |
Gets the record at the current stream position. Const version.
Definition at line 55 of file rewindable_stream.hh.
Referenced by operator++(), and Rewind().

| void util::stream::RewindableStream::Init | ( | const ChainPosition & | position | ) |
Initializes an existing RewindableStream at a specific position in a Chain.
| position | The position in the chain to get input from and produce output on |
Definition at line 14 of file rewindable_stream.cc.
References util::stream::Chain::BlockCount(), util::stream::Chain::BlockSize(), util::stream::Chain::EntrySize(), util::stream::ChainPosition::GetChain(), NULL, and UTIL_THROW_IF2.
Referenced by util::stream::operator>>(), and RewindableStream().


| void util::stream::RewindableStream::Mark | ( | ) |
Marks the current position in the stream to be rewound to later. Note that you can only rewind back as far as 2 * block_size_ - 1!
Definition at line 58 of file rewindable_stream.cc.
| util::stream::RewindableStream::operator bool | ( | ) | const [inline] |
Definition at line 70 of file rewindable_stream.hh.
| bool util::stream::RewindableStream::operator! | ( | ) | const [inline] |
Definition at line 72 of file rewindable_stream.hh.
| RewindableStream & util::stream::RewindableStream::operator++ | ( | ) |
Moves the stream forward to the next record. This internally may buffer a block for the purposes of rewinding.
Definition at line 30 of file rewindable_stream.cc.
References Get(), util::stream::Block::Get(), UTIL_UNLIKELY, and util::stream::Block::ValidSize().

| void util::stream::RewindableStream::Poison | ( | ) |
Poisons the stream. This sends any buffered blocks down the chain and sends a poison block as well (sending at most 2 non-poison and 1 poison block).
Definition at line 78 of file rewindable_stream.cc.
References util::PCQueue< T >::Consume(), and util::PCQueue< T >::Produce().
Referenced by ~RewindableStream().


| void util::stream::RewindableStream::Rewind | ( | ) |
Rewinds the stream back to the marked position. This will throw an exception if the marked position is too far away.
Definition at line 64 of file rewindable_stream.cc.
References Get().

1.5.9