20 #ifndef __TPIE_PIPELINING_MERGER_H__
21 #define __TPIE_PIPELINING_MERGER_H__
29 template <
typename T,
typename pred_t>
37 inline bool can_pull() {
42 tp_assert(can_pull(),
"pull() while !can_pull()");
43 T el = pq.top().first;
44 size_t i = pq.top().second;
45 if (in[i].can_read() && itemsRead[i] < runLength) {
46 pq.pop_and_push(std::make_pair(in[i].read(), i));
69 this->runLength = runLength;
70 tp_assert(pq.empty(),
"Reset before we are done");
74 for (
size_t i = 0; i < n; ++i) {
75 pq.unsafe_push(std::make_pair(in[i].read(), i));
81 inline static memory_size_type memory_usage(memory_size_type fanout) {
96 typedef std::pair<T, size_t> item_type;
97 typedef item_type first_argument_type;
98 typedef item_type second_argument_type;
99 typedef bool result_type;
106 inline bool operator()(
const item_type & lhs,
const item_type & rhs) {
107 return pred(lhs.first, rhs.first);
124 #endif // __TPIE_PIPELINING_MERGER_H__
Defines the tp_assert macro.
A generic array with a fixed size.
Standard binary internal heap.
Simple heap based priority queue implementation.
void resize(size_t size, const T &elm)
Change the size of the array.
static memory_size_type memory_usage(float blockFactor=1.0, bool includeDefaultFileAccessor=true)
Calculate the amount of memory used by a single file_stream.
Simple class acting both as file and a file::stream.
#define tp_assert(condition, message)
Simple class acting both as a tpie::file and a tpie::file::stream.