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.

pression module available. <strong>The</strong>n you simply replace every occurrence of ofstream by<br />

encoding ofstream and every occurence of ifstream by autodecoding ifstream.<br />

Of course, you can also use the <strong>LEDA</strong> coders in file mode. This means you can encode a<br />

file “foo” into a file “bar” and decode “bar” again. <strong>The</strong> example below shows how. We<br />

also demonstrate a nice feature of the AutoDecoder: If you query a description after the<br />

decoding the object tells you which combination has been used for encoding the input.<br />

#include <br />

using namespace leda;<br />

typedef CoderPipe2 Coder;<br />

int main()<br />

{<br />

Coder coder("foo", "bar");<br />

coder.encode();<br />

if (coder.fail()) std::cout

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

Saved successfully!

Ooh no, something went wrong!