STXXL
1.4-dev
|
External vector container.
Introduction to vector container: see STXXL Vector tutorial.
Design and Internals of vector container: see Vector.
For semantics of the methods see documentation of the STL std::vector
ValueType | type of contained objects (POD with no references to internal memory) |
PageSize | number of blocks in a page |
PagerType | pager type, random_pager<x> or lru_pager<x> , where x is the default number of pages, default is lru_pager<8> |
BlockSize | external block size in bytes, default is 2 MiB |
AllocStr | one of allocation strategies: striping , RC , SR , or FR default is RC |
Memory consumption: BlockSize*x*PageSize bytes
Classes | |
class | bid_vector |
Public Types | |
Extra Types | |
typedef vector_bufwriter < iterator > | bufwriter_type |
vector_bufwriter compatible with this vector More... | |
typedef vector_bufreader < const_iterator > | bufreader_type |
vector_bufreader compatible with this vector More... | |
typedef vector_bufreader_reverse < const_iterator > | bufreader_reverse_type |
vector_bufreader compatible with this vector More... | |
typedef bid_vector | bids_container_type |
typedef bids_container_type::iterator | bids_container_iterator |
typedef bids_container_type::const_iterator | const_bids_container_iterator |
typedef typed_block< BlockSize, ValueType > | block_type |
type of the block used in disk-memory transfers More... | |
typedef double_blocked_index < SizeType, PageSize, block_type::size > | blocked_index_type |
double-index type to reference individual elements in a block More... | |
Public Member Functions | |
Constructors/Destructors | |
vector (size_type n=0, unsigned_type npages=pager_type().size()) | |
Constructs external vector with n elements. More... | |
vector (file *from, size_type size=size_type(-1), unsigned_type npages=pager_type().size()) | |
Construct vector from a file. More... | |
vector (const vector &obj) | |
copy-constructor More... | |
~vector () | |
Modifier | |
void | swap (vector &obj) |
swap content More... | |
Miscellaneous | |
void | allocate_page_cache () const |
Allocate page cache, must be called to allow access to elements. More... | |
void | deallocate_page_cache () const |
allows to free the cache, but you may not access any element until call allocate_page_cache() again More... | |
void | export_files (std::string filename_prefix) |
Export data such that it is persistent on the file system. Resulting files will be numbered ascending. More... | |
file * | get_file () const |
Get the file associated with this vector, or NULL. More... | |
Size and Capacity | |
size_type | size () const |
return the size of the vector. More... | |
bool | empty () const |
true if the vector's size is zero. More... | |
size_type | capacity () const |
Return the number of elelemtsn for which external memory has been allocated. capacity() is always greator than or equal to size(). More... | |
size_type | raw_capacity () const |
Returns the number of bytes that the vector has allocated on disks. More... | |
void | reserve (size_type n) |
Reserves at least n elements in external memory. More... | |
void | resize (size_type n) |
Resize vector contents to n items. More... | |
void | resize (size_type n, bool shrink_capacity) |
Resize vector contents to n items, and allow the allocated external memory to shrink. Internal memory allocation remains unchanged. More... | |
Modifiers | |
void | clear () |
Erases all of the elements and deallocates all external memory that is occupied. More... | |
void | flush () const |
Flushes the cache pages to the external memory. More... | |
Front and Back Access | |
void | push_back (const_reference obj) |
Append a new element at the end. More... | |
void | pop_back () |
Removes the last element (without returning it, see back()). More... | |
Operators | |
reference | back () |
Returns a reference to the last element, see More Notes. More... | |
reference | front () |
Returns a reference to the first element, see More Notes. More... | |
const_reference | back () const |
Returns a constant reference to the last element, see More Notes. More... | |
const_reference | front () const |
Returns a constant reference to the first element, see More Notes. More... | |
vector & | operator= (const vector &obj) |
assignment operator More... | |
Iterator Construction | |
iterator | begin () |
returns an iterator pointing to the beginning of the vector, see More Notes. More... | |
const_iterator | begin () const |
returns a const_iterator pointing to the beginning of the vector, see More Notes. More... | |
const_iterator | cbegin () const |
returns a const_iterator pointing to the beginning of the vector, see More Notes. More... | |
iterator | end () |
returns an iterator pointing beyond the end of the vector, see More Notes. More... | |
const_iterator | end () const |
returns a const_iterator pointing beyond the end of the vector, see More Notes. More... | |
const_iterator | cend () const |
returns a const_iterator pointing beyond the end of the vector, see More Notes. More... | |
reverse_iterator | rbegin () |
returns a reverse_iterator pointing to the end of the vector. More... | |
const_reverse_iterator | rbegin () const |
returns a reverse_iterator pointing to the end of the vector. More... | |
const_reverse_iterator | crbegin () const |
returns a reverse_iterator pointing to the end of the vector. More... | |
reverse_iterator | rend () |
returns a reverse_iterator pointing beyond the beginning of the vector. More... | |
const_reverse_iterator | rend () const |
returns a reverse_iterator pointing beyond the beginning of the vector. More... | |
const_reverse_iterator | crend () const |
returns a reverse_iterator pointing beyond the beginning of the vector. More... | |
Direct Element Access | |
reference | operator[] (size_type offset) |
access the element at the given vector's offset More... | |
const_reference | operator[] (size_type offset) const |
access the element at the given vector's offset More... | |
reference | at (size_type offset) |
access the element at the given vector's offset More... | |
const_reference | at (size_type offset) const |
access the element at the given vector's offset More... | |
bool | is_element_cached (size_type offset) const |
return true if the given vector offset is in cache More... | |
Capacity | |
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. More... | |
unsigned_type | numpages () const |
Number of pages used by the pager. More... | |
Private Types | |
enum | { valid_on_disk = 0, uninitialized = 1, dirty = 2 } |
Private Attributes | |
alloc_strategy_type | m_alloc_strategy |
bids_container_type | m_bids |
block_manager * | m_bm |
simple_vector< block_type > * | m_cache |
bool | m_exported |
std::queue< int_type > | m_free_slots |
file * | m_from |
std::vector< unsigned char > | m_page_status |
status of each page (valid_on_disk, uninitialized or dirty) More... | |
std::vector< int_type > | m_page_to_slot |
pager_type | m_pager |
size_type | m_size |
simple_vector< int_type > | m_slot_to_page |
Standard Types | |
enum | constants { block_size = BlockSize, page_size = PageSize, on_disk = -1 } |
typedef ValueType | value_type |
The type of elements stored in the vector. More... | |
typedef value_type & | reference |
reference to value_type More... | |
typedef const value_type & | const_reference |
constant reference to value_type More... | |
typedef value_type * | pointer |
pointer to value_type More... | |
typedef const value_type * | const_pointer |
constant pointer to value_type More... | |
typedef SizeType | size_type |
an unsigned 64-bit integral type More... | |
typedef stxxl::int64 | difference_type |
typedef PagerType | 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 |
iterator used to iterate through a vector, see More Notes. More... | |
typedef const_vector_iterator < value_type, alloc_strategy_type, size_type, difference_type, block_size, pager_type, page_size > | const_iterator |
constant iterator used to iterate through a vector, see More Notes. More... | |
typedef std::reverse_iterator < iterator > | reverse_iterator |
typedef std::reverse_iterator < const_iterator > | const_reverse_iterator |
typedef AllocStr stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::alloc_strategy_type |
typedef bids_container_type::iterator stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::bids_container_iterator |
typedef bid_vector stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::bids_container_type |
typedef typed_block<BlockSize, ValueType> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::block_type |
typedef double_blocked_index<SizeType, PageSize, block_type::size> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::blocked_index_type |
typedef vector_bufreader_reverse<const_iterator> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::bufreader_reverse_type |
vector_bufreader compatible with this vector
typedef vector_bufreader<const_iterator> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::bufreader_type |
vector_bufreader compatible with this vector
typedef vector_bufwriter<iterator> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::bufwriter_type |
vector_bufwriter compatible with this vector
typedef bids_container_type::const_iterator stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::const_bids_container_iterator |
typedef const_vector_iterator<value_type, alloc_strategy_type, size_type, difference_type, block_size, pager_type, page_size> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::const_iterator |
constant iterator used to iterate through a vector, see More Notes.
typedef const value_type* stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::const_pointer |
typedef const value_type& stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::const_reference |
typedef std::reverse_iterator<const_iterator> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::const_reverse_iterator |
typedef stxxl::int64 stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::difference_type |
typedef vector_iterator<value_type, alloc_strategy_type, size_type, difference_type, block_size, pager_type, page_size> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::iterator |
iterator used to iterate through a vector, see More Notes.
typedef PagerType stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::pager_type |
typedef value_type* stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::pointer |
typedef value_type& stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::reference |
typedef std::reverse_iterator<iterator> stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::reverse_iterator |
typedef SizeType stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::size_type |
typedef ValueType stxxl::vector< ValueType, PageSize, PagerType, BlockSize, AllocStr, SizeType >::value_type |
|
private |
enum stxxl::vector::constants |
|
inline |
|
inline |
Construct vector from a file.
from | file to be constructed from |
size | Number of elements. |
npages | Number of cached pages. |
vector
can be assigned to a particular (physical) file. The block size of the vector must be a multiple of the element size sizeof(ValueType)
and the page size (4096).
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
Returns a reference to the last element, see More Notes.
|
inline |
Returns a constant reference to the last element, see More Notes.
|
inline |
returns an iterator pointing to the beginning of the vector, see More Notes.
|
inline |
returns a const_iterator pointing to the beginning of the vector, see More Notes.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
Return the number of elelemtsn for which external memory has been allocated. capacity() is always greator than or equal to size().
|
inline |
returns a const_iterator pointing to the beginning of the vector, see More Notes.
|
inline |
returns a const_iterator pointing beyond the end of the vector, see More Notes.
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
allows to free the cache, but you may not access any element until call allocate_page_cache() again
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
returns an iterator pointing beyond the end of the vector, see More Notes.
|
inline |
returns a const_iterator pointing beyond the end of the vector, see More Notes.
|
inline |
|
inlineprivate |
|
inline |
|
inline |
Returns a reference to the first element, see More Notes.
|
inline |
Returns a constant reference to the first element, see More Notes.
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
Append a new element at the end.
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
Reserves at least n elements in external memory.
If n is less than or equal to capacity(), this call has no effect. Otherwise, it is a request for allocation of additional external memory. If the request is successful, then capacity() is greater than or equal to n; otherwise capacity() is unchanged. In either case, size() is unchanged.
|
inline |
|
inline |
|
inline |
|
inline |
return the size of the vector.
Definition at line 1027 of file vector.h.
Referenced by stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::matrix_col_vector_multiply_and_add_swappable_block(), stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::matrix_from_vectors_swappable_block(), stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::matrix_row_vector_multiply_and_add_swappable_block(), stxxl::matrix< ValueType, BlockSideLength >::multiply_from_left(), stxxl::matrix< ValueType, BlockSideLength >::operator*(), stxxl::column_vector< ValueType >::operator+(), stxxl::row_vector< ValueType >::operator+(), stxxl::column_vector< ValueType >::operator+=(), stxxl::row_vector< ValueType >::operator+=(), stxxl::column_vector< ValueType >::operator-(), stxxl::row_vector< ValueType >::operator-(), stxxl::column_vector< ValueType >::operator-=(), and stxxl::row_vector< ValueType >::operator-=().
|
inlineprivate |
|
inline |
|
inlineprivate |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
mutableprivate |
|
private |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |
|
mutableprivate |