14 #ifndef STXXL_MNG_BUF_ISTREAM_REVERSE_HEADER
15 #define STXXL_MNG_BUF_ISTREAM_REVERSE_HEADER
29 #define BUF_ISTREAM_CHECK_END
35 template <
typename BlockType,
typename B
idIteratorType>
55 #ifdef BUF_ISTREAM_CHECK_END
76 std::reverse_copy(begin, end, bids_.begin());
79 const unsigned_type ndisks = config::get_instance()->disks_number();
80 const unsigned_type mdevid = config::get_instance()->get_max_device_id();
82 prefetch_seq =
new int_type[bids_.size()];
90 prefetcher =
new prefetcher_type(bids_.begin(), bids_.end(), prefetch_seq, nbuffers);
94 current_elem = block_type::size - 1;
103 #ifdef BUF_ISTREAM_CHECK_END
104 assert(not_finished);
107 record = current_blk->elem[current_elem--];
111 current_elem = block_type::size - 1;
112 #ifdef BUF_ISTREAM_CHECK_END
113 not_finished = prefetcher->block_consumed(current_blk);
115 prefetcher->block_consumed(current_blk);
125 return current_blk->elem[current_elem];
131 return current_blk->elem[current_elem];
138 #ifdef BUF_ISTREAM_CHECK_END
139 assert(not_finished);
146 current_elem = block_type::size - 1;
147 #ifdef BUF_ISTREAM_CHECK_END
148 not_finished = prefetcher->block_consumed(current_blk);
150 prefetcher->block_consumed(current_blk);
160 delete[] prefetch_seq;
168 #endif // !STXXL_MNG_BUF_ISTREAM_REVERSE_HEADER
~buf_istream_reverse()
Frees used internal objects.
BidIteratorType bid_iterator_type
#define BUF_ISTREAM_CHECK_END
uint_pair & operator++()
prefix increment operator (directly manipulates the integer parts)
Encapsulates asynchronous prefetching engine.
choose_int_types< my_pointer_size >::int_type int_type
Buffered input stream, reading the items in the blocks in reverse order.
const Type & STXXL_MAX(const Type &a, const Type &b)
#define STXXL_BEGIN_NAMESPACE
block_type::reference reference
reference current()
Returns reference to the current record in the stream.
prefetcher_type * prefetcher
block_prefetcher< block_type, typename bid_vector_type::iterator > prefetcher_type
choose_int_types< my_pointer_size >::unsigned_type unsigned_type
block_type * pull_block()
Pulls next unconsumed block from the consumption sequence.
void compute_prefetch_schedule(const int_type *first, const int_type *last, int_type *out_first, int_type m, int_type D)
BIDArray< block_type::raw_size > bid_vector_type
#define STXXL_END_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.
buf_istream_reverse< block_type, bid_iterator_type > self_type