\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)

CGAL 4.8 - IO Streams

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Classes | Enumerations | Functions
IO Streams Reference

##

Andreas Fabri, Geert-Jan Giezeman, and Lutz Kettner
All classes in the CGAL kernel provide input and output operators for IO streams. The basic task of such an operator is to produce a representation of an object that can be written as a sequence of characters on devices as a console, a file, or a pipe. In CGAL we distinguish between a raw ascii, a raw binary and a pretty printing format.

Introduced in: CGAL 1.0
BibTeX: cgal:fgk-ios-12-16a
License: LGPL

All classes in the CGAL kernel provide input and output operators for IO streams. CGAL provides three different printing mode, defined in the enum `Mode`, as well as different functions to set and get the printing mode.

## Classified Reference Pages

## Enum

- `CGAL::Mode`

## Functions

- `CGAL::get_mode()`
- `CGAL::is_ascii()`
- `CGAL::is_binary()`
- `CGAL::is_pretty()`
- `CGAL::set_mode()`
- `CGAL::set_ascii_mode()`
- `CGAL::set_binary_mode()`
- `CGAL::set_pretty_mode()`
- `CGAL::operator>>()`
- `CGAL::operator<<()`
- `CGAL::iformat()`
- `CGAL::oformat()`

## Classes

- `CGAL::Color`
- `CGAL::Istream_iterator<T,Stream>`
- `CGAL::Ostream_iterator<T,Stream>`
- `CGAL::Verbose_ostream`
- `CGAL::Input_rep<T,F>`
- `CGAL::Output_rep<T,F>`

## Modules
| Stream Operators

## Classes
class | CGAL::Color
| An object of the class `Color` is a color available for drawing operations in many CGAL output streams. More...
class | CGAL::Input_rep< T, F >
| The definition of `Input_rep` is completely symmetric to `Output_rep`. More...
class | CGAL::Output_rep< T, F >
| The purpose of `Output_rep` is to provide a way to control output formatting that works independently of the object's stream output operator. More...
class | CGAL::Istream_iterator< T, Stream >
| The class `Istream_iterator` is an input iterator adaptor for the input stream class `Stream` and value type `T`. More...
class | CGAL::Ostream_iterator< T, Stream >
| The class `Ostream_iterator` is an output iterator adaptor for the output stream class `Stream` and value type `T`. More...
class | CGAL::Verbose_ostream
| The class `Verbose_ostream` can be used as an output stream. More...

## Enumerations
enum | CGAL::IO::Mode { CGAL::IO::ASCII = 0, CGAL::IO::BINARY, CGAL::IO::PRETTY }
| All classes in the CGAL `Kernel` provide input and output operators for IOStreams. More...

## Functions
Mode | CGAL::get_mode (std::ios &s)
| returns the printing mode of the IO stream `s`. More...
Mode | CGAL::set_ascii_mode (std::ios &s)
| sets the mode of the IO stream `s` to be the `ASCII` mode. More...
Mode | CGAL::set_binary_mode (std::ios &s)
Mode | CGAL::set_mode (std::ios &s, IO::Mode m)
| sets the printing mode of the IO stream `s`. More...
Mode | CGAL::set_pretty_mode (std::ios &s)
| sets the mode of the IO stream `s` to be the `PRETTY` mode. More...
bool | CGAL::is_ascii (std::ios &s)
| checks if the IO stream `s` is in `ASCII` mode. More...
bool | CGAL::is_binary (std::ios &s)
| checks if the IO stream `s` is in `BINARY` mode. More...
bool | CGAL::is_pretty (std::ios &s)
| checks if the IO stream `s` is in `PRETTY` mode. More...
template<class T >
Output_rep< T > | CGAL::oformat (const T &t)
| Convenience function to construct an output representation (`Output_rep`) for type `T`. More...
template<class T >
Input_rep< T > | CGAL::iformat (const T &t)
| The definition of this function is completely symmetric to `oformat()`.
template<class T , typename F >
Output_rep< T, F > | CGAL::oformat (const T &t, F)
| Convenience function to construct an output representation (`Output_rep`) for type `T`. More...

## Enumeration Type Documentation

enum CGAL::IO::Mode

All classes in the CGAL `Kernel` provide input and output operators for IOStreams.

The basic task of such an operator is to produce a representation of an object that can be written as a sequence of characters on devices as a console, a file, or a pipe. The enum `Mode` distinguish between three different printing formats.

In `ASCII` mode, numbers e.g. the coordinates of a point or the coefficients of a line, are written in a machine independent format. In BINARY mode, data are written in a binary format, e.g. a double is represented as a sequence of four byte. The format depends on the machine. The mode PRETTY serves mainly for debugging as the type of the geometric object is written, as well as the data defining the object. For example for a point at the origin with Cartesian double coordinates, the output would be `PointC2(0.0, 0.0)`. At the moment CGAL does not provide input operations for pretty printed data. By default a stream is in Ascii mode.

See Also
  `CGAL::set_mode()`
  `CGAL::set_ascii_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::get_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_binary()`
  `CGAL::is_pretty()`

`#include <CGAL/IO/io.h>`

Enumerator
ASCII |
BINARY |
PRETTY |

## Function Documentation

Mode CGAL::get_mode | ( | std::ios & | s) |  |

returns the printing mode of the IO stream `s`.

See Also
  `CGAL::Mode`
  `CGAL::set_mode()`
  `CGAL::set_ascii_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_binary()`
  `CGAL::is_pretty()`

`#include <CGAL/IO/io.h>`

bool CGAL::is_ascii | ( | std::ios & | s) |  |

checks if the IO stream `s` is in `ASCII` mode.

See Also
  `CGAL::Mode`
  `CGAL::set_mode()`
  `CGAL::set_ascii_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::get_mode()`
  `CGAL::is_binary()`
  `CGAL::is_pretty()`

`#include <CGAL/IO/io.h>`

bool CGAL::is_binary | ( | std::ios & | s) |  |

checks if the IO stream `s` is in `BINARY` mode.

See Also
  `CGAL::Mode`
  `CGAL::set_mode()`
  `CGAL::set_ascii_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::get_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_pretty()`

`#include <CGAL/IO/io.h>`

bool CGAL::is_pretty | ( | std::ios & | s) |  |

checks if the IO stream `s` is in `PRETTY` mode.

See Also
  `CGAL::Mode`
  `CGAL::set_mode()`
  `CGAL::set_ascii_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::get_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_binary()`

`#include <CGAL/IO/io.h>`

template<class T >

Output_rep<T> CGAL::oformat | ( | const T & | t) |  |

Convenience function to construct an output representation (`Output_rep`) for type `T`.

Generic IO for type `T`.

`#include <CGAL/IO/io.h>`

template<class T , typename F >

Output_rep<T,F> CGAL::oformat | ( | const T & | t,
|  | F |
| ) |  |

Convenience function to construct an output representation (`Output_rep`) for type `T`.

Generic IO for type `T` with formatting tag.

`#include <CGAL/IO/io.h>`

Mode CGAL::set_ascii_mode | ( | std::ios & | s) |  |

sets the mode of the IO stream `s` to be the `ASCII` mode.

Returns the previous mode of `s`.

See Also
  `CGAL::Mode`
  `CGAL::set_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::get_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_binary()`
  `CGAL::is_pretty()`

`#include <CGAL/IO/io.h>`

Mode CGAL::set_binary_mode | ( | std::ios & | s) |  |

See Also
  `CGAL::Mode`
  `CGAL::set_mode()`
  `CGAL::set_ascii_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::get_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_binary()`
  `CGAL::is_pretty()`

sets the mode of the IO stream `s` to be the `BINARY` mode. Returns the previous mode of `s`.

`#include <CGAL/IO/io.h>`

Mode CGAL::set_mode | ( | std::ios & | s,
|  | IO::Mode | m
| ) |  |

sets the printing mode of the IO stream `s`.

See Also
  `CGAL::Mode`
  `CGAL::set_ascii_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::set_pretty_mode()`
  `CGAL::get_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_binary()`
  `CGAL::is_pretty()`

`#include <CGAL/IO/io.h>`

Mode CGAL::set_pretty_mode | ( | std::ios & | s) |  |

sets the mode of the IO stream `s` to be the `PRETTY` mode.

Returns the previous mode of `s`.

See Also
  `CGAL::Mode`
  `CGAL::set_mode()`
  `CGAL::set_ascii_mode()`
  `CGAL::set_binary_mode()`
  `CGAL::get_mode()`
  `CGAL::is_ascii()`
  `CGAL::is_binary()`
  `CGAL::is_pretty()`

`#include <CGAL/IO/io.h>`