Public Types |
| enum | constants { block_size = BlkSize_,
page_size = PgSz_,
on_disk = -1
} |
| typedef Tp_ | value_type |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef value_type * | pointer |
| typedef SzTp_ | size_type |
| typedef stxxl::int64 | difference_type |
| typedef const value_type * | const_pointer |
| typedef PgTp_ | pager_type |
| typedef AllocStr_ | alloc_strategy_type |
typedef vector_iterator
< value_type,
alloc_strategy_type, size_type,
difference_type, block_size,
pager_type, page_size > | iterator |
typedef const_vector_iterator
< value_type,
alloc_strategy_type, size_type,
difference_type, block_size,
pager_type, page_size > | const_iterator |
typedef std::reverse_iterator
< iterator > | reverse_iterator |
typedef std::reverse_iterator
< const_iterator > | const_reverse_iterator |
| typedef bid_vector< block_size > | bids_container_type |
typedef
bids_container_type::iterator | bids_container_iterator |
typedef
bids_container_type::const_iterator | const_bids_container_iterator |
typedef typed_block< BlkSize_,
Tp_ > | block_type |
typedef double_blocked_index
< SzTp_, PgSz_,
block_type::size > | blocked_index_type |
Public Member Functions |
| | vector (size_type n=0, unsigned_type npages=pager_type().size()) |
| | Constructs external vector.
|
| void | swap (vector &obj) |
| void | allocate_page_cache () const |
| void | deallocate_page_cache () const |
| size_type | capacity () const |
| size_type | raw_capacity () const |
| | Returns the number of bytes that the vector has allocated on disks.
|
| void | reserve (size_type n) |
| void | resize (size_type n) |
| void | resize (size_type n, bool shrink_capacity) |
| void | clear () |
| void | push_back (const_reference obj) |
| void | pop_back () |
| reference | back () |
| reference | front () |
| const_reference | back () const |
| const_reference | front () const |
| | vector (file *from, size_type size=size_type(-1), size_type npages=pager_type().size()) |
| | Construct vector from a file.
|
| | vector (const vector &obj) |
| vector & | operator= (const vector &obj) |
| size_type | size () const |
| bool | empty () const |
| iterator | begin () |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| iterator | end () |
| const_iterator | end () const |
| const_iterator | cend () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | crbegin () const |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
| const_reverse_iterator | crend () const |
| reference | operator[] (size_type offset) |
| const_reference | operator[] (size_type offset) const |
| bool | is_element_cached (size_type offset) const |
| void | flush () const |
| | ~vector () |
| void | export_files (std::string filename_prefix) |
| | Export data such that it is persistent on the file system. Resulting files will be numbered ascending.
|
| file * | get_file () const |
| | Get the file associated with this vector, or NULL.
|
| template<typename ForwardIterator > |
| void | set_content (const ForwardIterator &bid_begin, const ForwardIterator &bid_end, size_type n) |
| | Set the blocks and the size of this container explicitly. The vector must be completely empty before.
|
| int_type | numpages () const |
| | Number of pages used by the pager.
|
Private Types |
| enum | { valid_on_disk = 0,
uninitialized = 1,
dirty = 2
} |
Private Member Functions |
| size_type | size_from_file_length (stxxl::uint64 file_length) const |
| stxxl::uint64 | file_length () const |
| void | _resize (size_type n) |
| void | _resize_shrink_capacity (size_type n) |
| bids_container_iterator | bid (const size_type &offset) |
| bids_container_iterator | bid (const blocked_index_type &offset) |
| const_bids_container_iterator | bid (const size_type &offset) const |
| const_bids_container_iterator | bid (const blocked_index_type &offset) const |
| void | read_page (int_type page_no, int_type cache_slot) const |
| void | write_page (int_type page_no, int_type cache_slot) const |
| reference | element (size_type offset) |
| reference | element (const blocked_index_type &offset) |
| void | page_externally_updated (unsigned_type page_no) const |
| void | block_externally_updated (size_type offset) const |
| void | block_externally_updated (const blocked_index_type &offset) const |
Private Attributes |
| alloc_strategy_type | alloc_strategy |
| size_type | _size |
| bids_container_type | _bids |
| pager_type | pager |
| std::vector< unsigned char > | _page_status |
| std::vector< int_type > | _page_to_slot |
| simple_vector< int_type > | _slot_to_page |
| std::queue< int_type > | _free_slots |
| simple_vector< block_type > * | _cache |
| file * | _from |
| block_manager * | bm |
| config * | cfg |
| bool | exported |
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
class stxxl::vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >
External vector container.
For semantics of the methods see documentation of the STL std::vector
- Template Parameters:
-
| Tp_ | type of contained objects (POD with no references to internal memory) |
| PgSz_ | number of blocks in a page |
| PgTp_ | pager type, random_pager<x> or lru_pager<x>, where x is the default number of pages, default is lru_pager<8> |
| BlkSize_ | external block size in bytes, default is 2 MiB |
| AllocStr_ | one of allocation strategies: striping , RC , SR , or FR default is RC |
Memory consumption: BlkSize_*x*PgSz_ bytes
- Warning:
- Do not store references to the elements of an external vector. Such references might be invalidated during any following access to elements of the vector
- Examples:
- algo/copy_and_sort_file.cpp, algo/sort_file.cpp, algo/test_bad_cmp.cpp, algo/test_ksort.cpp, algo/test_parallel_sort.cpp, algo/test_random_shuffle.cpp, algo/test_scan.cpp, algo/test_sort.cpp, algo/test_stable_ksort.cpp, containers/test_vector.cpp, containers/test_vector_export.cpp, stream/test_naive_transpose.cpp, stream/test_push_sort.cpp, stream/test_sorted_runs.cpp, and stream/test_stream.cpp.
Definition at line 735 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
- Enumerator:
| valid_on_disk |
|
| uninitialized |
|
| dirty |
|
Definition at line 777 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
Constructs external vector.
- Parameters:
-
| n | Number of elements. |
| npages | Number of cached pages. |
Definition at line 814 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
Construct vector from a file.
- Parameters:
-
| from | file to be constructed from |
| size | Number of elements. |
| npages | Number of cached pages. |
- Warning:
- Only one
vector can be assigned to a particular (physical) file. The block size of the vector must be a multiple of the element size sizeof(Tp_) and the page size (4096).
Definition at line 1027 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
Get the file associated with this vector, or NULL.
Definition at line 1275 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
Number of pages used by the pager.
Definition at line 1295 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
Returns the number of bytes that the vector has allocated on disks.
Definition at line 878 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
template<typename ForwardIterator >
Set the blocks and the size of this container explicitly. The vector must be completely empty before.
Definition at line 1283 of file vector.h.
template<typename Tp_, unsigned PgSz_ = 4, typename PgTp_ = lru_pager<8>, unsigned BlkSize_ = STXXL_DEFAULT_BLOCK_SIZE(Tp_), typename AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY, typename SzTp_ = stxxl::uint64>
| void stxxl::vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >::swap |
( |
vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ > & |
obj | ) |
[inline] |