13 #ifndef STXXL_BUF_OSTREAM_HEADER
14 #define STXXL_BUF_OSTREAM_HEADER
16 #include <stxxl/bits/mng/buf_writer.h>
19 __STXXL_BEGIN_NAMESPACE
29 template <
typename BlkTp_,
typename BIDIteratorTp_>
32 typedef BlkTp_ block_type;
33 typedef BIDIteratorTp_ bid_iterator_type;
37 bid_iterator_type current_bid;
38 int_type current_elem;
39 block_type * current_blk;
42 typedef typename block_type::const_reference const_reference;
43 typedef typename block_type::reference reference;
50 writer(nbuffers, nbuffers / 2), current_bid(first_bid),
53 current_blk = writer.get_free_block();
61 current_blk->elem[current_elem++] = record;
62 if (current_elem >= block_type::size)
65 current_blk = writer.write(current_blk, *(current_bid++));
74 return current_blk->elem[current_elem];
81 return current_blk->elem[current_elem];
89 if (current_elem >= block_type::size)
92 current_blk = writer.write(current_blk, *(current_bid++));
101 assert(current_elem == 0);
107 __STXXL_END_NAMESPACE
109 #endif // !STXXL_BUF_OSTREAM_HEADER
Encapsulates asynchronous buffered block writing engine.
Definition: buf_writer.h:37
_Self & operator++()
Moves to the next record in the stream.
Definition: buf_ostream.h:86
virtual ~buf_ostream()
Deallocates internal objects.
Definition: buf_ostream.h:99
buf_ostream(bid_iterator_type first_bid, int_type nbuffers)
Constructs output stream object.
Definition: buf_ostream.h:49
Buffered output stream.
Definition: buf_ostream.h:30
_Self & operator<<(const_reference record)
Output stream operator, writes out record.
Definition: buf_ostream.h:59
reference current()
Returns reference to the current record.
Definition: buf_ostream.h:72
reference operator*()
Returns reference to the current record.
Definition: buf_ostream.h:79