Definition
The type decoding_ifstream<Coder> is the decoding counterpart of the type ifstream from the C++ iostream library. Each instance is of type decoding_ifstream<Coder> is associated with a file. Whenever data is requested from an instance is of type decoding_ifstream<Coder>, is reads some data from the associated file and then decodes it on-the-fly with an intance of type Coder. All operations and all operators (») defined for C++ istreams can be applied to decoding_ifstream as well.
decoding_ifstream supports random access read operations by providing seek operations.
For this purpose it maintains a so-called get pointer. This pointer
specifies the position in the decoded data stream from which the next read
operation will extract its data. After the operation the get pointer refers to
the position immediately behind the last extracted character.
E.g., if you are not interested in the first 5000 characters and you want to
extract the 10 characters in positions 5000 - 5009, you can perform a seek
operation which moves the get pointer to position 5000 and then read 10
characters. (After that the get pointer will refer to position 5010.)
This seek operation will usually be faster than skipping 5000 characters by
hand.
Seek operations are supported no matter which coder is plugged into decoding_ifstream.
However, some coders (like checksummers) provide fast seek operations. This
manual mentions these coders explicitly.
Moreover, we provide a class called BlockCoder (in Section Block Coder)
which allows you to speed up seeks for any coder.
#include < LEDA/coding/coder_util.h >
Creation
decoding_ifstream<Coder> | is(const char* file_name = 0, ios::openmode mode = ios::in) | |
creates an instance is. If file_name is specified, the stream is attached to the file with the given name. |
Operations