1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
The tt(osyncstream) stream in fact is only a wrapper of tt(ostream), using a
tt(syncbuf) as its stream buffer. The tt(std::syncbuf) handles the actual
synchronization. In order to use the tt(syncbuf) stream buffer the
tthi(syncstream) header file must be included.
A tt(syncbuf) stream buffer collects the information it receives from an
tt(ostream) in an internal buffer, and its destructor and tt(emit) member
flush its buffer as a block to its destination stream.
bf(Constructors)
itemization(
itt(syncbuf()), the default constructor, constructs a tt(syncbuf) object
with its tt(emit-on-sync) policy (see below) set to tt(false);
itt(explicit syncbuf(streambuf *destbuf)) constructs a tt(std::syncbuf)
with its emit-on-sync policy set to tt(false), using tt(destbuf) as
the destination stream's tt(streambuf);
itt(syncbuf(syncbuf &&rhs)), the move constructor, moves the content of
tt(rhs) to the constructed tt(syncbuf).
)
bf(Member functions)
In addition to the members inherited from tt(std::streambuf) the class
tt(syncbuf) offers these members:
itemization(
iti(get_wrapped), returning a pointer to the destination stream's stream
buffer;
iti(emit), copies the received information as a block to the destination
stream;
itht(set_emit_on_sync)(void set_emit_on_sync(bool how)) changes the
current emit-on-sync policy. By default tt(how == false) flushing its
internal buffer to the destination's stream buffer. When tt(how ==
true) the internal buffer is always immediately flushed;
)
|