navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 3 (modified by landauf, 3 years ago) (diff)

fixed links

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!



OutputBuffer is a buffer between OutputHandler and Shell. OutputHandler passes arbitrary output to all output streams, but the Shell needs line-by-line output. That's where the OutputBuffer comes in: It buffers as many lines as you want (almost) and provides a function for the Shell to get those lines.

To avoid polling, the Shell and other interested classes have to register as a listener to the OutputBuffer. Therefore they must inherit from OutputBufferListener and implement outputChanged(), the function which gets called everytime text gets passed to the OutputBuffer.

Output lines can be retrieved by calling "bool getLine(pointer)" where pointer is of the type std::string*. If there is at least one line in the buffer, the functions assigns the oldest line to the pointer and returns true.

  • Important: The returned line will then be removed from the OutputBuffer. If there are multiple objects listening to an OutputBuffer, they have to be coordinated.

If there is no more line in the OutputBuffer, the functions returns false.

Output is passed to the OutputBuffer through the << operator (as with std::cout or any other ostream or the OutputHandler).


The illustration shows how text is passed via COUT into an OutputBuffer, where it gets extracted line by line by a console.

Attachments (1)

Download all attachments as: .zip