STXXL
1.4-dev
|
Forms sorted runs of elements passed in push() method.
A specialization of runs_creator
that allows to create sorted runs data structure usable for runs_merger
from elements passed in sorted push() method.
ValueType | type of values (parameter for use_push strategy) |
CompareType | type of comparison object used for sorting the runs |
BlockSize | size of blocks used to store the runs |
AllocStr | functor that defines allocation strategy for the runs |
Definition at line 414 of file sort_stream.h.
Public Types | |
typedef typed_block< BlockSize, value_type > | block_type |
typedef CompareType | cmp_type |
typedef element_iterator_traits < block_type, external_size_type > ::element_iterator | element_iterator |
typedef sorted_runs_type | result_type |
typedef sorted_runs < trigger_entry_type, cmp_type > | sorted_runs_data_type |
typedef counting_ptr < sorted_runs_data_type > | sorted_runs_type |
typedef sort_helper::trigger_entry < block_type > | trigger_entry_type |
typedef ValueType | value_type |
Public Member Functions | |
runs_creator (CompareType cmp, unsigned_type memory_to_use) | |
Creates the object. More... | |
~runs_creator () | |
void | allocate () |
Allocates input buffers and clears result. More... | |
void | clear () |
Clear current state and remove all items. More... | |
const cmp_type & | cmp () const |
return comparator object. More... | |
void | deallocate () |
Deallocates input buffers but not the current result. More... | |
unsigned_type | memory_used () const |
return memory size used (in bytes). More... | |
void | push (const value_type &val) |
Adds new element to the sorter. More... | |
sorted_runs_type & | result () |
Returns the sorted runs object. More... | |
external_size_type | size () const |
number of items currently inserted. More... | |
Protected Member Functions | |
void | compute_result () |
void | fill_with_max_value (block_type *blocks, unsigned_type num_blocks, unsigned_type first_idx) |
fill the rest of the block with max values More... | |
void | sort_run (block_type *run, unsigned_type elements) |
Sort a specific run, contained in a sequences of blocks. More... | |
Private Types | |
typedef sorted_runs_data_type::run_type | run_type |
Private Attributes | |
block_type * | m_blocks1 |
accumulation buffer of size m_m2 blocks, half the available memory size More... | |
block_type * | m_blocks2 |
accumulation buffer that is currently being written to disk More... | |
CompareType | m_cmp |
comparator object to sort runs More... | |
internal_size_type | m_cur_el |
current number of elements in the run m_blocks1 More... | |
const unsigned_type | m_el_in_run |
total number of elements in a run More... | |
const unsigned_type | m_m2 |
m_memsize / 2 More... | |
const unsigned_type | m_memory_to_use |
memory size in bytes to use More... | |
const unsigned_type | m_memsize |
memory size in numberr of blocks for internal use More... | |
sorted_runs_type | m_result |
stores the result (sorted runs) in a reference counted object More... | |
bool | m_result_computed |
true after the result() method was called for the first time More... | |
request_ptr * | m_write_reqs |
reference to write requests transporting the last accumulation buffer to disk More... | |
run_type | run |
run object containing block ids of the run being written to disk More... | |
Additional Inherited Members | |
![]() | |
noncopyable () | |
typedef typed_block<BlockSize, value_type> stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::block_type |
Definition at line 424 of file sort_stream.h.
typedef CompareType stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::cmp_type |
Definition at line 422 of file sort_stream.h.
typedef element_iterator_traits<block_type, external_size_type>::element_iterator stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::element_iterator |
Definition at line 430 of file sort_stream.h.
typedef sorted_runs_type stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::result_type |
Definition at line 428 of file sort_stream.h.
|
private |
Definition at line 436 of file sort_stream.h.
typedef sorted_runs<trigger_entry_type, cmp_type> stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::sorted_runs_data_type |
Definition at line 426 of file sort_stream.h.
typedef counting_ptr<sorted_runs_data_type> stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::sorted_runs_type |
Definition at line 427 of file sort_stream.h.
typedef sort_helper::trigger_entry<block_type> stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::trigger_entry_type |
Definition at line 425 of file sort_stream.h.
typedef ValueType stxxl::stream::runs_creator< use_push< ValueType >, CompareType, BlockSize, AllocStr >::value_type |
Definition at line 423 of file sort_stream.h.
|
inline |
Creates the object.
cmp | comparator object |
memory_to_use | memory amount that is allowed to used by the sorter in bytes |
Definition at line 545 of file sort_stream.h.
References stxxl::sort_memory_usage_factor(), and stxxl::sort_helper::verify_sentinel_strict_weak_ordering().
|
inline |
Definition at line 565 of file sort_stream.h.
|
inline |
Allocates input buffers and clears result.
Definition at line 590 of file sort_stream.h.
|
inline |
Clear current state and remove all items.
Definition at line 572 of file sort_stream.h.
References stxxl::stream::sorted_runs< TriggerEntryType, CompareType >::clear().
|
inline |
return comparator object.
Definition at line 682 of file sort_stream.h.
|
inlineprotected |
Definition at line 497 of file sort_stream.h.
References stxxl::div_ceil(), stxxl::make_bid_iterator(), stxxl::block_manager::new_blocks(), and STXXL_VERBOSE1.
|
inline |
Deallocates input buffers but not the current result.
Definition at line 604 of file sort_stream.h.
|
inlineprotected |
fill the rest of the block with max values
Definition at line 474 of file sort_stream.h.
References curr, and stxxl::make_element_iterator().
|
inline |
return memory size used (in bytes).
Definition at line 688 of file sort_stream.h.
|
inline |
Adds new element to the sorter.
val | value to be added |
Definition at line 620 of file sort_stream.h.
References stxxl::div_ceil(), LIKELY, stxxl::make_bid_iterator(), and stxxl::block_manager::new_blocks().
|
inline |
Returns the sorted runs object.
runs_merger
object as input Definition at line 662 of file sort_stream.h.
References STXXL_MSG.
|
inline |
number of items currently inserted.
Definition at line 676 of file sort_stream.h.
|
inlineprotected |
Sort a specific run, contained in a sequences of blocks.
Definition at line 489 of file sort_stream.h.
References stxxl::check_sort_settings(), stxxl::make_element_iterator(), and stxxl::sort().
|
private |
accumulation buffer of size m_m2 blocks, half the available memory size
Definition at line 460 of file sort_stream.h.
|
private |
accumulation buffer that is currently being written to disk
Definition at line 463 of file sort_stream.h.
|
private |
comparator object to sort runs
Definition at line 434 of file sort_stream.h.
|
private |
current number of elements in the run m_blocks1
Definition at line 457 of file sort_stream.h.
|
private |
total number of elements in a run
Definition at line 454 of file sort_stream.h.
|
private |
m_memsize / 2
Definition at line 448 of file sort_stream.h.
|
private |
memory size in bytes to use
Definition at line 442 of file sort_stream.h.
|
private |
memory size in numberr of blocks for internal use
Definition at line 445 of file sort_stream.h.
|
private |
stores the result (sorted runs) in a reference counted object
Definition at line 439 of file sort_stream.h.
|
private |
true after the result() method was called for the first time
Definition at line 451 of file sort_stream.h.
|
private |
reference to write requests transporting the last accumulation buffer to disk
Definition at line 467 of file sort_stream.h.
|
private |
run object containing block ids of the run being written to disk
Definition at line 470 of file sort_stream.h.