14 #ifndef STXXL_MNG_BUF_ISTREAM_REVERSE_HEADER
15 #define STXXL_MNG_BUF_ISTREAM_REVERSE_HEADER
31 #define BUF_ISTREAM_CHECK_END
38 template <
typename BlockType,
typename BIDIteratorType>
58 #ifdef BUF_ISTREAM_CHECK_END
79 std::reverse_copy(begin, end, bids_.begin());
82 const unsigned_type ndisks = config::get_instance()->disks_number();
84 prefetch_seq =
new int_type[bids_.size()];
92 prefetcher =
new prefetcher_type(bids_.begin(), bids_.end(), prefetch_seq, nbuffers);
96 current_elem = block_type::size - 1;
105 #ifdef BUF_ISTREAM_CHECK_END
106 assert(not_finished);
109 record = current_blk->elem[current_elem--];
113 current_elem = block_type::size - 1;
114 #ifdef BUF_ISTREAM_CHECK_END
115 not_finished = prefetcher->block_consumed(current_blk);
117 prefetcher->block_consumed(current_blk);
127 return current_blk->elem[current_elem];
133 return current_blk->elem[current_elem];
140 #ifdef BUF_ISTREAM_CHECK_END
141 assert(not_finished);
148 current_elem = block_type::size - 1;
149 #ifdef BUF_ISTREAM_CHECK_END
150 not_finished = prefetcher->block_consumed(current_blk);
152 prefetcher->block_consumed(current_blk);
162 delete[] prefetch_seq;
170 #endif // !STXXL_MNG_BUF_ISTREAM_REVERSE_HEADER
block_type::reference reference
#define BUF_ISTREAM_CHECK_END
block_type * pull_block()
Pulls next unconsumed block from the consumption sequence.
uint_pair & operator++()
prefix increment operator (directly manipulates the integer parts)
Encapsulates asynchronous prefetching engine.
const Tp & STXXL_MAX(const Tp &a, const Tp &b)
choose_int_types< my_pointer_size >::int_type int_type
buf_istream_reverse< block_type, bid_iterator_type > _Self
Buffered input stream, reading the items in the blocks in reverse order.
#define STXXL_BEGIN_NAMESPACE
buf_istream_reverse(bid_iterator_type begin, bid_iterator_type end, int_type nbuffers)
Constructs input stream object, reading [first,last) blocks in reverse.
prefetcher_type * prefetcher
reference current()
Returns reference to the current record in the stream.
choose_int_types< my_pointer_size >::unsigned_type unsigned_type
void compute_prefetch_schedule(const int_type *first, const int_type *last, int_type *out_first, int_type m, int_type D)
~buf_istream_reverse()
Frees used internal objects.
block_prefetcher< block_type, typename bid_vector_type::iterator > prefetcher_type
BIDArray< block_type::raw_size > bid_vector_type
BIDIteratorType bid_iterator_type
#define STXXL_END_NAMESPACE