next up previous contents
Next: Using the cyclic log Up: Introduction Previous: Machine-independent structure   Contents

Simple API

The methods in the cyclic_log class are intended to be analogous to the UNIX routines read and write, which operate on byte buffers. No equivalent to an ostream object is provided for C++ users. There is a good reason for this: ostream objects allow output to be performed for those types that have an output operator defined. Output is thus type-sensitive. This is useful for ostream objects because one can define custom formatting for various types (e.g (x,y) for complex numbers). This is not particularly useful for cyclic logs since cyclic logs are just intended to capture bytes sent to standard output and standard error and it doesn't matter what those bytes represent.

read and write have return values since the analogous UNIX routines also have return values. The return value indicates how many bytes have been read or written. The return value can be used to indicate if something went wrong. The constructor does not have a return value so it throws an exception if something goes wrong.



Andrew Marlow 2004-01-01