Navigation: Up, Table of Contents, Bibliography, Index, Title Page

Operators for IO streams

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. In CGAL we distinguish between a raw Ascii, a raw binary and a pretty printing format.

CGAL_IO::Mode = { ASCII = 0, BINARY, PRETTY};

The first one just writes number, e.g. the coordinates of a point or the coefficients of a line in a machine independent format. The second one writes the data in a binary format, e.g. a double is represented as a sequence of four byte. The format depends on the machine. The last one 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 CGAL_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.

CGAL provides the following functions to modify the mode of an IO stream.

CGAL_IO::Mode CGAL_set_mode ( ios& s, CGAL_IO::Mode m)

CGAL_IO::Mode CGAL_set_ascii_mode ( ios& s)

CGAL_IO::Mode CGAL_set_binary_mode ( ios& s)

CGAL_IO::Mode CGAL_set_pretty_mode ( ios& s)

The following functions allow to test whether a stream is in a certain mode.

CGAL_IO::Mode CGAL_get_mode ( ios& s)

bool CGAL_is_ascii ( ios& s)

bool CGAL_is_binary ( ios& s)

bool CGAL_is_pretty ( ios& s)


Next chapter: Colors
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. Wed, January 20, 1999.