stream_ops Struct Reference
[Character Stream Implementation]

Stream backend operations. More...

#include <stream.h>

Data Fields

void(* commit )(struct stream *stream)
 Commit the stream buffer.
bool(* make_room )(struct stream *stream, unsigned int goal)
 Try to make room for additional character data.

Detailed Description

Stream backend operations.

These operations are implemented by the stream backend responsible for consuming the character data.

Definition at line 102 of file stream.h.


Field Documentation

void(* stream_ops::commit)(struct stream *stream)

Commit the stream buffer.

Called after new data has been inserted into the stream buffer and the backend should start consuming them. The stream backend is not required to consume all the data before returning; it is enough to e.g. initiate a hardware transfer which will eventually consume the buffer.

Parameters:
stream The stream which just had data inserted into it

Definition at line 114 of file stream.h.

Referenced by stream_priv_commit(), and string_stream_make_room().

bool(* stream_ops::make_room)(struct stream *stream, unsigned int goal)

Try to make room for additional character data.

This function should try to consume data from the stream until there are goal bytes available for new character data. It may return earlier if this goal cannot be met (for example if goal is larger than the buffer size), but for performance reasons, it is recommended to get as close to the goal as possible.

For asynchronous backends, it is also recommended to let the hardware keep consuming data even after the goal has been met, as it may eliminate the need to call this function later.

Parameters:
stream The stream in which to make room
goal The number of free bytes needed
Return values:
true There is room for at least one byte in the stream buffer
false The underlying buffer is completely full, and the stream backend will not be able to consume any of the data.

Definition at line 139 of file stream.h.

Referenced by stream_priv_write().


The documentation for this struct was generated from the following file:
Generated on Thu Apr 29 15:18:25 2010 for display-training by  doxygen 1.6.3