Public Types | Public Member Functions

vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ > Class Template Reference
[Internals]

External vector container. More...

#include <vector.h>

Collaboration diagram for vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  constants { block_size = BlkSize_, page_size = PgSz_, n_pages = pager_type::n_pages, 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)
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))
 Construct vector from a file.
 vector (const vector &obj)
vectoroperator= (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
void export_files (std::string filename_prefix)
 Export data such that it is persistent on the file system. Resulting files will be numbered ascending.
fileget_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.

Detailed Description

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 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 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

Constructor & Destructor Documentation

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>
vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >::vector ( file from,
size_type  size = size_type(-1) 
) [inline]

Construct vector from a file.

Parameters:
from file to be constructed from
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).

References typed_block< RawSize_, T_, NRef_, InfoType_ >::has_only_data, and file::set_size().


Member Function Documentation

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 vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >::export_files ( std::string  filename_prefix  )  [inline]

Export data such that it is persistent on the file system. Resulting files will be numbered ascending.

References typed_block< RawSize_, T_, NRef_, InfoType_ >::size.

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>
file* vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >::get_file (  )  const [inline]

Get the file associated with this vector, or NULL.

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>
size_type vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >::raw_capacity (  )  const [inline]

Returns the number of bytes that the vector has allocated on disks.

References typed_block< RawSize_, T_, NRef_, InfoType_ >::raw_size.

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 >
void vector< Tp_, PgSz_, PgTp_, BlkSize_, AllocStr_, SzTp_ >::set_content ( const ForwardIterator &  bid_begin,
const ForwardIterator &  bid_end,
size_type  n 
) [inline]

Set the blocks and the size of this container explicitly. The vector must be completely empty before.

References typed_block< RawSize_, T_, NRef_, InfoType_ >::size.


The documentation for this class was generated from the following file: