diff --git a/include/stxxl/bits/containers/sorter.h b/include/stxxl/bits/containers/sorter.h index 08d6fe570..f8c24876b 100644 --- a/include/stxxl/bits/containers/sorter.h +++ b/include/stxxl/bits/containers/sorter.h @@ -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 @@ -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(); + } + //! \} }; diff --git a/include/stxxl/bits/stream/sort_stream.h b/include/stxxl/bits/stream/sort_stream.h index 7bb126ec1..7ea46496d 100644 --- a/include/stxxl/bits/stream/sort_stream.h +++ b/include/stxxl/bits/stream/sort_stream.h @@ -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. @@ -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 {