Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interface for querying the block sizes in runs_merger and runs_creator #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/stxxl/bits/containers/sorter.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,20 @@ class sorter
return m_runs_merger.empty();
}

//! Return the number of elements in a single run of the runs_creator
size_t num_els_in_run() const {
return m_runs_creator.num_els_in_run();
}

//! This number of elements will be merged at one
size_t num_els_in_output_block() const {
return m_runs_merger.num_els_in_output_block();
}
//! Will the next call to operator++ block, because it needs to merge?
bool next_call_would_block() const {
return m_runs_merger.next_call_would_block();
}

//! \}

//! \name Operators
Expand All @@ -274,6 +288,14 @@ class sorter
return *this;
}

bool next_output_would_block() const {
return m_runs_merger.next_output_would_block();
}

size_t output_block_size() const {
return m_runs_merger.output_block_size();
}

//! \}
};

Expand Down
11 changes: 11 additions & 0 deletions include/stxxl/bits/stream/sort_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ class runs_creator<
{
return m_memory_to_use;
}

//! return number of elements in a single sort run
size_t num_els_in_run() const {
return m_el_in_run;
}
};

//! Input strategy for \c runs_creator class.
Expand Down Expand Up @@ -1342,6 +1347,12 @@ class basic_runs_merger
return &(operator * ());
}

bool next_output_would_block() const {
return m_current_ptr + 1 == m_current_end;
}

size_t output_block_size() const { return out_block_type::size; }

//! Standard stream method.
basic_runs_merger& operator ++ () // preincrement operator
{
Expand Down