Class to maintain the positions where sorted runs start. More...
#include <tpie/pipelining/merge_sorter.h>
Public Member Functions | |
void | open () |
Switch from closed to open state. More... | |
void | close () |
Switch from any state to closed state. More... | |
void | evacuate () |
Switch from any state to the corresponding evacuated state. More... | |
void | unevacuate () |
Switch from any state to the corresponding non-evacuated state. More... | |
void | next_level () |
Go to next level in the merge heap - see class docstring. More... | |
void | final_level (memory_size_type fanout) |
Set this to be the final level in the merge heap - see class docstring. More... | |
void | set_position (memory_size_type mergeLevel, memory_size_type runNumber, stream_position pos) |
Store a stream position - see class docstring. More... | |
stream_position | get_position (memory_size_type mergeLevel, memory_size_type runNumber) |
Fetch a stream position - see class docstring. More... | |
Static Public Member Functions | |
static memory_size_type | memory_usage () |
Memory usage when open and not evacuated. More... | |
Class to maintain the positions where sorted runs start.
The run_positions object has the following states:
When open and not evacuated, the memory usage is two stream blocks (as reported by memory_usage()). When evacuated, the memory usage is nothing.
The object remembers the merge tree depth d
. Initially, d = 1, and only set_position may be called with mergeLevel = 0 and runNumbers always increasing by one. When next_level is called, d increases to 2, and now set_position may be called with mergeLevel = 1, and get_position may be called with mergeLevel = 0, runNumber ranging from 0 and upwards in each case. When final_level is called, the restriction on the runNumber order is lifted, but set_position may only be called with mergeLevel = d-1 and runNumber = 0. get_position may be called with mergeLevel = d-2 and any runNumber in any order.
Definition at line 61 of file merge_sorter.h.
void tpie::bits::run_positions::close | ( | ) |
Switch from any state to closed
state.
Referenced by tpie::merge_sorter< T, UseProgress, pred_t, store_t >::pull().
void tpie::bits::run_positions::evacuate | ( | ) |
Switch from any state to the corresponding evacuated state.
void tpie::bits::run_positions::final_level | ( | memory_size_type | fanout | ) |
Set this to be the final level in the merge heap - see class docstring.
stream_position tpie::bits::run_positions::get_position | ( | memory_size_type | mergeLevel, |
memory_size_type | runNumber | ||
) |
Fetch a stream position - see class docstring.
|
static |
Memory usage when open and not evacuated.
void tpie::bits::run_positions::next_level | ( | ) |
Go to next level in the merge heap - see class docstring.
void tpie::bits::run_positions::open | ( | ) |
Switch from closed
to open
state.
void tpie::bits::run_positions::set_position | ( | memory_size_type | mergeLevel, |
memory_size_type | runNumber, | ||
stream_position | pos | ||
) |
Store a stream position - see class docstring.
void tpie::bits::run_positions::unevacuate | ( | ) |
Switch from any state to the corresponding non-evacuated state.