Stxxl
1.4.0
|
Merges sorted runs. More...
#include <sort_stream.h>
Public Types | |
typedef RunsType_ | sorted_runs_type |
typedef CompareType_ | value_cmp |
typedef AllocStr_ | alloc_strategy |
typedef sorted_runs_type::element_type | sorted_runs_data_type |
typedef sorted_runs_data_type::size_type | size_type |
typedef sorted_runs_data_type::run_type | run_type |
typedef sorted_runs_data_type::block_type | block_type |
typedef block_type | out_block_type |
typedef run_type::value_type | trigger_entry_type |
typedef block_prefetcher < block_type, typename run_type::iterator > | prefetcher_type |
typedef run_cursor2 < block_type, prefetcher_type > | run_cursor_type |
typedef sort_helper::run_cursor2_cmp < block_type, prefetcher_type, value_cmp > | run_cursor2_cmp_type |
typedef loser_tree < run_cursor_type, run_cursor2_cmp_type > | loser_tree_type |
typedef stxxl::int64 | diff_type |
typedef std::pair< typename block_type::iterator, typename block_type::iterator > | sequence |
typedef std::vector< sequence > ::size_type | seqs_size_type |
typedef sorted_runs_data_type::value_type | value_type |
Standard stream typedef. | |
Public Member Functions | |
basic_runs_merger (value_cmp c, unsigned_type memory_to_use) | |
Creates a runs merger object. | |
void | set_memory_to_use (unsigned_type memory_to_use) |
Set memory amount to use for the merger in bytes. | |
void | initialize (const sorted_runs_type &sruns) |
Initialize the runs merger object with a new round of sorted_runs. | |
void | deallocate () |
Deallocate temporary structures freeing memory prior to next initialize() | |
bool | empty () const |
Standard stream method. | |
size_type | size () const |
Standard size method. | |
const value_type & | operator* () const |
Standard stream method. | |
const value_type * | operator-> () const |
Standard stream method. | |
basic_runs_merger & | operator++ () |
Standard stream method. | |
virtual | ~basic_runs_merger () |
Destructor. | |
Private Member Functions | |
void | merge_recursively () |
void | deallocate_prefetcher () |
void | fill_buffer_block () |
Private Attributes | |
value_cmp | m_cmp |
comparator object to sort runs | |
unsigned_type | m_memory_to_use |
memory size in bytes to use | |
sorted_runs_type | m_sruns |
smart pointer to sorted_runs object | |
size_type | m_elements_remaining |
items remaining in input | |
out_block_type * | m_buffer_block |
memory buffer for merging from external streams | |
const value_type * | m_current_ptr |
pointer into current memory buffer: this is either m_buffer_block or the small_runs vector | |
const value_type * | m_current_end |
pointer into current memory buffer: end after range of current values | |
run_type | m_consume_seq |
sequence of block needed for merging | |
int_type * | m_prefetch_seq |
precalculated order of blocks in which they are prefetched | |
prefetcher_type * | m_prefetcher |
prefetcher object | |
loser_tree_type * | m_losers |
loser tree used for native merging |
Merges sorted runs.
RunsType_ | type of the sorted runs, available as runs_creator::sorted_runs_type , |
CompareType_ | type of comparison object used for merging |
AllocStr_ | allocation strategy used to allocate the blocks for storing intermediate results if several merge passes are required |
Definition at line 914 of file sort_stream.h.
typedef AllocStr_ stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::alloc_strategy |
Definition at line 919 of file sort_stream.h.
typedef sorted_runs_data_type::block_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::block_type |
Reimplemented in stxxl::stream::runs_merger< RunsType_, CompareType_, AllocStr_ >, stxxl::stream::runs_merger< typename runs_creator_type::sorted_runs_type, cmp_type, alloc_strategy_type >, and stxxl::stream::runs_merger< sorted_runs_type, CompareType_, AllocStr_ >.
Definition at line 924 of file sort_stream.h.
typedef stxxl::int64 stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::diff_type |
Definition at line 931 of file sort_stream.h.
typedef loser_tree<run_cursor_type, run_cursor2_cmp_type> stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::loser_tree_type |
Definition at line 930 of file sort_stream.h.
typedef block_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::out_block_type |
Definition at line 925 of file sort_stream.h.
typedef block_prefetcher<block_type, typename run_type::iterator> stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::prefetcher_type |
Definition at line 927 of file sort_stream.h.
typedef sort_helper::run_cursor2_cmp<block_type, prefetcher_type, value_cmp> stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::run_cursor2_cmp_type |
Definition at line 929 of file sort_stream.h.
typedef run_cursor2<block_type, prefetcher_type> stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::run_cursor_type |
Definition at line 928 of file sort_stream.h.
typedef sorted_runs_data_type::run_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::run_type |
Definition at line 923 of file sort_stream.h.
typedef std::vector<sequence>::size_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::seqs_size_type |
Definition at line 933 of file sort_stream.h.
typedef std::pair<typename block_type::iterator, typename block_type::iterator> stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::sequence |
Definition at line 932 of file sort_stream.h.
typedef sorted_runs_data_type::size_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::size_type |
Definition at line 922 of file sort_stream.h.
typedef sorted_runs_type::element_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::sorted_runs_data_type |
Definition at line 921 of file sort_stream.h.
typedef RunsType_ stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::sorted_runs_type |
Reimplemented in stxxl::stream::runs_merger< RunsType_, CompareType_, AllocStr_ >, stxxl::stream::runs_merger< typename runs_creator_type::sorted_runs_type, cmp_type, alloc_strategy_type >, and stxxl::stream::runs_merger< sorted_runs_type, CompareType_, AllocStr_ >.
Definition at line 917 of file sort_stream.h.
typedef run_type::value_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::trigger_entry_type |
Definition at line 926 of file sort_stream.h.
typedef CompareType_ stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::value_cmp |
Reimplemented in stxxl::stream::runs_merger< RunsType_, CompareType_, AllocStr_ >, stxxl::stream::runs_merger< typename runs_creator_type::sorted_runs_type, cmp_type, alloc_strategy_type >, and stxxl::stream::runs_merger< sorted_runs_type, CompareType_, AllocStr_ >.
Definition at line 918 of file sort_stream.h.
typedef sorted_runs_data_type::value_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::value_type |
Standard stream typedef.
Definition at line 937 of file sort_stream.h.
stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::basic_runs_merger | ( | value_cmp | c, |
unsigned_type | memory_to_use | ||
) | [inline] |
Creates a runs merger object.
c | comparison object |
memory_to_use | amount of memory available for the merger in bytes |
Definition at line 1079 of file sort_stream.h.
virtual stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::~basic_runs_merger | ( | ) | [inline, virtual] |
Destructor.
Definition at line 1302 of file sort_stream.h.
void stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::deallocate | ( | ) | [inline] |
Deallocate temporary structures freeing memory prior to next initialize()
Definition at line 1239 of file sort_stream.h.
void stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::deallocate_prefetcher | ( | ) | [inline, private] |
Definition at line 988 of file sort_stream.h.
bool stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::empty | ( | ) | const [inline] |
Standard stream method.
Definition at line 1247 of file sort_stream.h.
Referenced by main(), and stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::merge_recursively().
void stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::fill_buffer_block | ( | ) | [inline, private] |
Definition at line 1003 of file sort_stream.h.
void stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::initialize | ( | const sorted_runs_type & | sruns | ) | [inline] |
Initialize the runs merger object with a new round of sorted_runs.
Definition at line 1105 of file sort_stream.h.
Referenced by stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::merge_recursively().
const value_type& stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::operator* | ( | ) | const [inline] |
Standard stream method.
Definition at line 1259 of file sort_stream.h.
basic_runs_merger& stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::operator++ | ( | ) | [inline] |
Standard stream method.
Definition at line 1272 of file sort_stream.h.
const value_type* stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::operator-> | ( | ) | const [inline] |
Standard stream method.
Definition at line 1266 of file sort_stream.h.
void stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::set_memory_to_use | ( | unsigned_type | memory_to_use | ) | [inline] |
Set memory amount to use for the merger in bytes.
Definition at line 1099 of file sort_stream.h.
size_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::size | ( | ) | const [inline] |
Standard size method.
Definition at line 1253 of file sort_stream.h.
out_block_type* stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_buffer_block [private] |
memory buffer for merging from external streams
Definition at line 953 of file sort_stream.h.
value_cmp stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_cmp [private] |
comparator object to sort runs
Definition at line 941 of file sort_stream.h.
run_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_consume_seq [private] |
sequence of block needed for merging
Definition at line 962 of file sort_stream.h.
const value_type* stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_current_end [private] |
pointer into current memory buffer: end after range of current values
Definition at line 959 of file sort_stream.h.
const value_type* stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_current_ptr [private] |
pointer into current memory buffer: this is either m_buffer_block or the small_runs vector
Definition at line 956 of file sort_stream.h.
size_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_elements_remaining [private] |
items remaining in input
Definition at line 950 of file sort_stream.h.
loser_tree_type* stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_losers [private] |
loser tree used for native merging
Definition at line 971 of file sort_stream.h.
unsigned_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_memory_to_use [private] |
memory size in bytes to use
Definition at line 944 of file sort_stream.h.
int_type* stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_prefetch_seq [private] |
precalculated order of blocks in which they are prefetched
Definition at line 965 of file sort_stream.h.
prefetcher_type* stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_prefetcher [private] |
prefetcher object
Definition at line 968 of file sort_stream.h.
sorted_runs_type stxxl::stream::basic_runs_merger< RunsType_, CompareType_, AllocStr_ >::m_sruns [private] |
smart pointer to sorted_runs object
Definition at line 947 of file sort_stream.h.