Compressed stream. More...
#include <tpie/compressed/stream.h>
Public Types | |
| typedef T | item_type |
Public Member Functions | |
| file_stream (double blockFactor=1.0) | |
| const T & | read () |
| Reads next item from stream if can_read() == true. More... | |
| const T & | peek () |
| Peeks next item from stream if can_read() == true. More... | |
| void | skip () |
| void | skip_back () |
| template<typename IT > | |
| void | read (IT const a, IT const b) |
| Precondition: is_open(). More... | |
| const T & | read_back () |
| void | write (const T &item) |
| template<typename IT > | |
| void | write (IT const a, IT const b) |
Static Public Member Functions | |
| static memory_size_type | memory_usage (double blockFactor=1.0) noexcept |
Compressed stream.
We assume that T is trivially copyable and that its copy constructor and assignment operator never throws.
As a rule of thumb, when a tpie::stream_exception is thrown from a method, the stream is left in the state it was in prior to the method call. When a tpie::exception is thrown, the stream may have changed. In particular, the stream may have been closed, and it is up to the caller (if the exception is caught) to ensure that the stream is reopened as necessary.
Several methods claim the nothrow guarantee even though the implementation has throw statements. In this case, there are two reasons an exception may be thrown: A tpie::exception is thrown if some invariant in the stream has been violated, and this is a bug we must fix in the compressed stream. A tpie::stream_exception is thrown if the user has violated a precondition (for instance by passing an invalid parameter).
Definition at line 49 of file predeclare.h.
|
inline |
Peeks next item from stream if can_read() == true.
If can_read() == false, throws an end_of_stream_exception.
Blocks to take the compressor lock.
If a stream_exception is thrown, the stream is left in the state it was in before the call to peek().
|
inline |
Reads next item from stream if can_read() == true.
If can_read() == false, throws an end_of_stream_exception.
Blocks to take the compressor lock.
If a stream_exception is thrown, the stream is left in the state it was in before the call to read().
Definition at line 425 of file stream.h.
Referenced by tpie::pipelining::bits::input_t< dest_t >::go(), tpie::pipelining::bits::buffer_output_t< dest_t >::go(), tpie::file_stream< tpie::stream_position >::read(), tpie::sort_manager< T, I, M >::sort(), and tpie::ami::Internal_Sorter_Obj< T, Compare >::sort().
|
inline |
Precondition: is_open().
Reads min(b-a, size()-offset()) items into the range [a, b). If less than b-a items are read, throws an end_of_stream_exception.