31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9.23 Coder Pipes ( CoderPipe2 )<br />

1. Definition<br />

<strong>The</strong> type CoderPipe2< Coder1 , Coder2 > can be used to combine two coders of type<br />

Coder1 and Coder2 into one single coder. This works in an analogous way as a pipe of<br />

the operating system: In encoding mode the original input is processed by Coder1 . Its<br />

output is fed into Coder2 . <strong>The</strong> output of Coder2 becomes the output of the pipe. In<br />

decoding mode the situation is reversed: <strong>The</strong> data is sent through Coder2 first and then<br />

through Coder1 .<br />

We also provide pipes for combining more than two coders (up to six):<br />

CoderPipe3, . . . , CoderPipe6. (Since these classes have a similar interface as CoderPipe2,<br />

we do not include manual pages for them.)<br />

#include < <strong>LEDA</strong>/coding/coder util.h ><br />

2. Types<br />

CoderPipe2< Coder1 , Coder2 >:: coder1<br />

the type Coder1 .<br />

CoderPipe2< Coder1 , Coder2 >:: coder2<br />

3. Creation<br />

the type Coder2 .<br />

CoderPipe2< Coder1 , Coder2 > C(streambuf ∗ src stream = 0,<br />

streambuf ∗ tgt stream = 0,<br />

bool own streams = false);<br />

creates an instance C which uses the given source and target<br />

streams. If own streams is set, then C is responsible for the destruction<br />

of the streams, otherwise the pointers src stream and tgt stream<br />

must be valid during the life-time of C.<br />

CoderPipe2< Coder1 , Coder2 > C(const char ∗ src file name,<br />

const char ∗ tgt file name);<br />

creates an instance C which uses file-streams for input and output.<br />

4. Operations<br />

Standard Operations<br />

void C.encode( ) encodes the source stream and writes the output to<br />

the target stream.<br />

void C.decode( ) decodes the source stream and writes the output to<br />

the target stream.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!