13 #ifndef STXXL_MNG_BUF_ISTREAM_HEADER
14 #define STXXL_MNG_BUF_ISTREAM_HEADER
27 #define BUF_ISTREAM_CHECK_END
33 template <
typename BlockType,
typename B
idIteratorType>
49 #ifdef BUF_ISTREAM_CHECK_END
67 const unsigned_type ndisks = config::get_instance()->disks_number();
68 const unsigned_type mdevid = config::get_instance()->get_max_device_id();
69 const int_type seq_length = end - begin;
70 prefetch_seq =
new int_type[seq_length];
83 current_blk = prefetcher->pull_block();
92 #ifdef BUF_ISTREAM_CHECK_END
96 record = current_blk->elem[current_elem++];
98 if (
UNLIKELY(current_elem >= block_type::size))
101 #ifdef BUF_ISTREAM_CHECK_END
102 not_finished = prefetcher->block_consumed(current_blk);
104 prefetcher->block_consumed(current_blk);
114 return current_blk->elem[current_elem];
120 return current_blk->elem[current_elem];
127 #ifdef BUF_ISTREAM_CHECK_END
128 assert(not_finished);
133 if (
UNLIKELY(current_elem >= block_type::size))
136 #ifdef BUF_ISTREAM_CHECK_END
137 not_finished = prefetcher->block_consumed(current_blk);
139 prefetcher->block_consumed(current_blk);
149 delete[] prefetch_seq;
157 #endif // !STXXL_MNG_BUF_ISTREAM_HEADER
buf_istream< block_type, bid_iterator_type > self_type
#define BUF_ISTREAM_CHECK_END
uint_pair & operator++()
prefix increment operator (directly manipulates the integer parts)
prefetcher_type * prefetcher
Encapsulates asynchronous prefetching engine.
choose_int_types< my_pointer_size >::int_type int_type
buf_istream(bid_iterator_type begin, bid_iterator_type end, unsigned_type nbuffers)
Constructs input stream object.
const Type & STXXL_MAX(const Type &a, const Type &b)
#define STXXL_BEGIN_NAMESPACE
BidIteratorType bid_iterator_type
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)
block_prefetcher< block_type, bid_iterator_type > prefetcher_type
reference current()
Returns reference to the current record in the stream.
~buf_istream()
Frees used internal objects.
#define STXXL_END_NAMESPACE
block_type::reference reference