[[ArchivePage]] = OutputBuffer = == Description == !OutputBuffer is a buffer between [wiki:OutputHandler 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. 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). == Illustration == [[Image(OutputBuffer.png)]] The illustration shows how text is passed via [wiki:Debug COUT] into an !OutputBuffer, where it gets extracted line by line by a console.