Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of ~archive/OutputBuffer


Ignore:
Timestamp:
Aug 22, 2011, 2:04:13 PM (13 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ~archive/OutputBuffer

    v1 v1  
     1= OutputBuffer =
     2
     3== Description ==
     4!OutputBuffer is a buffer between [wiki:OutputHandler] and [wiki: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.
     5
     6To 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.
     7
     8Output 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.
     9 * '''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.
     10If there is no more line in the !OutputBuffer, the functions returns false.
     11
     12Output is passed to the !OutputBuffer through the << operator (as with std::cout or any other ostream or the OutputHandler).
     13
     14== Illustration ==
     15[[Image(OutputBuffer.png)]]
     16
     17The illustration shows how text is passed via [wiki:Debug COUT] into an !OutputBuffer, where it gets extracted line by line by a console.