Container with a vector-of-vectors structure. More...
#include <block_vector.h>
Public Types | |
| using | value_type = value_type_ |
| using | difference_type = typename std::vector< value_type >::difference_type |
| using | const_reference = const value_type & |
| using | const_pointer = const value_type * |
| using | iterator = bv_iterator< value_type_, value_type_ &, value_type_ * > |
| using | const_iterator = bv_iterator< value_type_, const value_type_ &, const value_type_ * > |
| using | reverse_iterator = std::reverse_iterator< iterator > |
| using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
| using | size_type = size_t |
Public Member Functions | |
| BlockVector () | |
| Creates an empty BlockVector. | |
| BlockVector (size_t) | |
| Creates a BlockVector containing a number of elements. | |
| BlockVector (const BlockVector< value_type_ > &) | |
| BlockVector copy constructor. | |
| virtual | ~BlockVector () |
| value_type_ & | operator[] (const size_t pos) |
| Subscript access to the data contained in the BlockVector. | |
| const value_type_ & | operator[] (const size_t pos) const |
| Subscript access to the data contained in the BlockVector. | |
| iterator | begin () |
| Returns a read/write iterator that points to the first element in the BlockVector. | |
| const_iterator | begin () const |
| Returns a read-only (constant) iterator that points to the first element in the BlockVector. | |
| iterator | end () |
| Returns a read/write iterator that points one past the last element in the BlockVector. | |
| const_iterator | end () const |
| Returns a read-only (constant) iterator that points one past the last element in the BlockVector. | |
| void | push_back (const value_type_ &value) |
| Add data to the end of the BlockVector. | |
| void | push_back (value_type_ &&value) |
| Move data to the end of the BlockVector. | |
| void | clear () |
| Erases all the elements. | |
| size_t | size () const |
| Returns the number of elements in the BlockVector. | |
| iterator | erase (const_iterator, const_iterator) |
| Remove a range of elements. | |
| void | print_blocks () const |
| Writes the contents of the BlockVector, separated into blocks, to cerr. | |
| int | get_max_block_size () const |
| Returns the block-size. | |
| size_type | max_size () const |
| Returns the size() of the largest possible BlockVector. | |
| reverse_iterator | rbegin () |
| Returns a read/write reverse iterator that points to the last element in the BlockVector. | |
| reverse_iterator | rbegin () const |
| Returns a read-only (constant) reverse iterator that points to the last element in the BlockVector. | |
| reverse_iterator | rend () |
| Returns a read/write reverse iterator that points to one before the first element in the BlockVector. | |
| reverse_iterator | rend () const |
| Returns a read-only (constant) reverse iterator that points to one before the first element in the BlockVector. | |
Private Attributes | |
| std::vector< std::vector< value_type_ > > | blockmap_ |
| Vector holding blocks containing data. | |
| iterator | finish_ |
| Iterator pointing to one past the last element. | |
Friends | |
| template<typename cv_value_type_ , typename ref_ , typename ptr_ > | |
| class | bv_iterator |
Container with a vector-of-vectors structure.
| value_type_ | Type of element. |
Elements are stored in blocks held in a blockmap. Each block is of fixed size, with elements default-initialised on creation of the block. A new block is automatically created when a block is filled. The size of each block is a power of two, which allows use of bitwise operators to efficiently map an index to the right block and the right position in that block.
| using BlockVector< value_type_ >::const_iterator = bv_iterator< value_type_, const value_type_&, const value_type_* > |
| using BlockVector< value_type_ >::const_pointer = const value_type* |
| using BlockVector< value_type_ >::const_reference = const value_type& |
| using BlockVector< value_type_ >::const_reverse_iterator = std::reverse_iterator< const_iterator > |
| using BlockVector< value_type_ >::difference_type = typename std::vector< value_type >::difference_type |
| using BlockVector< value_type_ >::iterator = bv_iterator< value_type_, value_type_&, value_type_* > |
| using BlockVector< value_type_ >::reverse_iterator = std::reverse_iterator< iterator > |
| using BlockVector< value_type_ >::size_type = size_t |
| using BlockVector< value_type_ >::value_type = value_type_ |
| BlockVector< value_type_ >::BlockVector | ( | ) |
Creates an empty BlockVector.
|
explicit |
Creates a BlockVector containing a number of elements.
| n | Number of elements. |
References BlockVector< value_type_ >::begin(), BlockVector< value_type_ >::blockmap_, BlockVector< value_type_ >::finish_, and max_block_size.
|
inline |
BlockVector copy constructor.
| other | BlockVector to copy. |
|
inlinevirtualdefault |
|
inline |
Returns a read/write iterator that points to the first element in the BlockVector.
Iteration is done in ordinary element order.
Referenced by BlockVector< value_type_ >::BlockVector(), nest::SourceTable::clean(), nest::Connector< ConnectionT >::remove_disabled_connections(), nest::SourceTable::remove_disabled_sources(), and nest::sort().
|
inline |
Returns a read-only (constant) iterator that points to the first element in the BlockVector.
Iteration is done in ordinary element order.
| void BlockVector< value_type_ >::clear | ( | ) |
Erases all the elements.
References max_block_size.
Referenced by nest::SourceTable::clean(), and nest::Connector< ConnectionT >::~Connector().
|
inline |
Returns a read/write iterator that points one past the last element in the BlockVector.
Iteration is done in ordinary element order.
Referenced by nest::SourceTable::clean(), nest::SourceTable::clear(), nest::Connector< ConnectionT >::remove_disabled_connections(), nest::SourceTable::remove_disabled_sources(), nest::SourceTable::reset_processed_flags(), and nest::sort().
|
inline |
Returns a read-only (constant) iterator that points one past the last element in the BlockVector.
Iteration is done in ordinary element order.
| BlockVector< value_type_ >::iterator BlockVector< value_type_ >::erase | ( | const_iterator | first, |
| const_iterator | last | ||
| ) |
Remove a range of elements.
| first | Iterator pointing to the first element to be erased. |
| last | Iterator pointing one past the last element to be erased. |
This function will erase the elements in the range [first, last) and shorten the BlockVector accordingly.
References bv_iterator< value_type_, ref_, ptr_ >::block_vector_, bv_iterator< value_type_, ref_, ptr_ >::const_cast_(), and max_block_size.
Referenced by nest::SourceTable::clean(), nest::Connector< ConnectionT >::remove_disabled_connections(), and nest::SourceTable::remove_disabled_sources().
|
inline |
Returns the block-size.
References max_block_size.
|
inline |
Returns the size() of the largest possible BlockVector.
|
inline |
Subscript access to the data contained in the BlockVector.
| pos | The index of the element for which data should be accessed. |
Note that data access with this operator is unchecked.
References block_size_shift, and max_block_size_sub_1.
|
inline |
Subscript access to the data contained in the BlockVector.
| pos | The index of the element for which data should be accessed. |
Note that data access with this operator is unchecked.
References block_size_shift, and max_block_size_sub_1.
| void BlockVector< value_type_ >::print_blocks | ( | ) | const |
Writes the contents of the BlockVector, separated into blocks, to cerr.
References bv_iterator< value_type_, ref_, ptr_ >::block_vector_.
| void BlockVector< value_type_ >::push_back | ( | const value_type_ & | value | ) |
Add data to the end of the BlockVector.
| value | Data to be added. |
Assigns given data to the element at the end of the BlockVector.
References bv_iterator< value_type_, ref_, ptr_ >::block_vector_, bv_iterator< value_type_, ref_, ptr_ >::block_vector_it_, and max_block_size.
Referenced by nest::Connector< ConnectionT >::get_connection(), nest::Connector< ConnectionT >::get_connection_with_specified_targets(), nest::Connector< ConnectionT >::get_source_lcids(), nest::Connector< ConnectionT >::push_back(), and nest::Connector< ConnectionT >::push_back().
| void BlockVector< value_type_ >::push_back | ( | value_type_ && | value | ) |
Move data to the end of the BlockVector.
| value | Data to be moved to end of BlockVector. |
Moves given data to the element at the end of the BlockVector.
References max_block_size.
|
inline |
Returns a read/write reverse iterator that points to the last element in the BlockVector.
Iteration is done in reverse element order.
|
inline |
Returns a read-only (constant) reverse iterator that points to the last element in the BlockVector.
Iteration is done in reverse element order.
|
inline |
Returns a read/write reverse iterator that points to one before the first element in the BlockVector.
Iteration is done in reverse element order.
|
inline |
Returns a read-only (constant) reverse iterator that points to one before the first element in the BlockVector.
Iteration is done in reverse element order.
|
inline |
Returns the number of elements in the BlockVector.
References max_block_size.
Referenced by nest::SourceTable::clean(), nest::Connector< ConnectionT >::find_enabled_connection(), nest::Connector< ConnectionT >::get_all_connections(), nest::Connector< ConnectionT >::get_source_lcids(), nest::Connector< ConnectionT >::get_synapse_status(), nest::quicksort3way(), nest::SourceTable::remove_disabled_sources(), nest::Connector< ConnectionT >::send(), nest::Connector< ConnectionT >::send_to_all(), nest::Connector< ConnectionT >::set_synapse_status(), nest::Connector< ConnectionT >::size(), nest::sort(), and nest::Connector< ConnectionT >::trigger_update_weight().
|
friend |
|
private |
Vector holding blocks containing data.
Referenced by BlockVector< value_type_ >::BlockVector().
|
private |
Iterator pointing to one past the last element.
Referenced by BlockVector< value_type_ >::BlockVector().