Implementation of 1-D std::vector like structure. More...
Implementation of 1-D std::vector like structure.
this implementation is just a wrapper for the std::vector in the case of data where the members cannot be parsed see openFPM_data wiki for more information
T | base type |
Definition at line 25 of file map_vector.hpp.
#include <map_vector.hpp>
Data Structures | |
struct | pack_cond |
struct | pack_cond< true, T1, Memory1, prp...> |
struct | packMem_cond |
struct | packMem_cond< true, T1, prp...> |
struct | packRequest_cond |
struct | packRequest_cond< true, T1, prp...> |
struct | unpack_cond |
struct | unpack_cond< true, T1, Memory1, prp...> |
Public Types | |
typedef int | yes_i_am_vector |
it define that it is a vector | |
typedef vector_key_iterator | iterator_key |
iterator for the vector | |
typedef T | value_type |
Type of the value the vector is storing. | |
Public Member Functions | |
template<int... prp> | |
void | pack (ExtPreAlloc< HeapMemory > &mem, Pack_stat &sts) |
template<int... prp> | |
void | packRequest (std::vector< size_t > &v) |
Insert an allocation request into the vector. More... | |
template<unsigned int... prp> | |
void | unpack (ExtPreAlloc< HeapMemory > &mem, Unpack_stat &ps) |
unpack a vector More... | |
bool | save (std::string file) |
Save this object into file. More... | |
bool | load (std::string file) |
Load this object from file. More... | |
size_t | size () const |
return the size of the vector | |
void | resize (size_t slot) |
void | clear () |
Remove all the element from the vector. More... | |
void | add (const T &v) |
It insert a new object on the vector, eventually it reallocate the grid. More... | |
void | add (T &&v) |
It insert a new object on the vector, eventually it reallocate the grid. More... | |
void | add () |
Add an empty object (it call the default constructor () ) at the end of the vector. More... | |
void | erase (typename std::vector< T >::iterator start, typename std::vector< T >::iterator end) |
Erase the elements from start to end. More... | |
void | remove (size_t key) |
Remove one entry from the vector. More... | |
auto | begin () -> decltype(base.begin()) |
Return an std compatible iterator to the first element. More... | |
auto | end () -> decltype(base.begin()) |
Return an std compatible iterator to the last element. More... | |
T & | last () |
Get the last element. More... | |
const T & | last () const |
Get the last element. More... | |
std::vector< T > | duplicate () |
Duplicate the vector. More... | |
void | swap (std::vector< T > &&v) |
swap the memory between the two vector More... | |
void | unique () |
It eliminate double entries. More... | |
void | sort () |
It sort the vector. More... | |
template<unsigned int p> | |
T & | get (size_t id) |
Get an element of the vector. More... | |
template<unsigned int p> | |
const T & | get (size_t id) const |
Get an element of the vector. More... | |
T & | get (size_t id) |
Get an element of the vector. More... | |
const T & | get (size_t id) const |
Get an element of the vector. More... | |
void | fill (unsigned char fl) |
it fill all the memory of fl patterns More... | |
void | reserve (size_t ns) |
reserve a memory space in advance to avoid reallocation More... | |
vector () noexcept | |
Constructor, vector of size 0. | |
vector (size_t sz) noexcept | |
Constructor, vector of size sz. | |
vector (const vector< T, HeapMemory, grow_policy_double, STD_VECTOR > &v) noexcept | |
Constructor from another vector. | |
vector (const std::initializer_list< T > &v) | |
Initializer from constructor. More... | |
vector (vector< T, HeapMemory, grow_policy_double, STD_VECTOR > &&v) noexcept | |
Constructor from another vector. | |
~vector () noexcept | |
destructor | |
void | swap (openfpm::vector< T, HeapMemory, grow_policy_double, STD_VECTOR > &v) |
vector< T, HeapMemory, grow_policy_double, STD_VECTOR > & | operator= (const vector< T, HeapMemory, grow_policy_double, STD_VECTOR > &v) |
Operator= copy the vector into another. More... | |
vector< T, HeapMemory, grow_policy_double, STD_VECTOR > & | operator= (vector< T, HeapMemory, grow_policy_double, STD_VECTOR > &&v) |
Operator= copy the vector into another. More... | |
bool | operator!= (const vector< T, HeapMemory, grow_policy_double, STD_VECTOR > &v) const |
Check that two vectors are equal. More... | |
bool | operator== (const vector< T, HeapMemory, grow_policy_double, STD_VECTOR > &v) const |
Check that two vectors are not equal. More... | |
vector_key_iterator | getIterator () const |
Get iterator. More... | |
template<int... prp> | |
size_t | packMem (size_t n, size_t e) |
Calculate the memory size required to allocate n elements. More... | |
void * | getPointer () |
Return the pointer to the chunk of memory. More... | |
const void * | getPointer () const |
Return the pointer to the chunk of memory. More... | |
size_t | getLastError () |
Return the last error. More... | |
void | vector_overflow (size_t v1) const |
check that the id does not overflow the buffer More... | |
long int | who () |
Static Public Member Functions | |
static bool | pack () |
pack a vector selecting the properties to pack More... | |
static bool | packRequest () |
static bool | packMem () |
static size_t | calculateMemDummy (size_t n, size_t e) |
Calculate the memory size required to allocate n elements. More... | |
static size_t | calculateNMem (size_t n) |
How many allocation are required to create n-elements. More... | |
static bool | noPointers () |
This class has pointer inside. More... | |
Private Attributes | |
size_t | v_size |
std::vector< T > | base |
1-D static grid | |
size_t | err_code |
Error code. | |
|
inline |
Initializer from constructor.
v | Initializer list |
Definition at line 420 of file map_vector.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the grid.
v | element to add |
vector_isel<T>::value
Definition at line 96 of file map_vector.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the grid.
v | element to add |
vector_isel<T>::value
Definition at line 113 of file map_vector.hpp.
|
inline |
Add an empty object (it call the default constructor () ) at the end of the vector.
Definition at line 125 of file map_vector.hpp.
|
inline |
Return an std compatible iterator to the first element.
Definition at line 168 of file map_vector.hpp.
|
inlinestatic |
Calculate the memory size required to allocate n elements.
Calculate the total size required to store n-elements in a vector
n | number of elements |
e | unused |
Definition at line 552 of file map_vector.hpp.
|
inlinestatic |
How many allocation are required to create n-elements.
n | number of elements |
Definition at line 564 of file map_vector.hpp.
|
inline |
Remove all the element from the vector.
Definition at line 79 of file map_vector.hpp.
|
inline |
|
inline |
Return an std compatible iterator to the last element.
Definition at line 178 of file map_vector.hpp.
|
inline |
Erase the elements from start to end.
start | element |
end | element |
Definition at line 139 of file map_vector.hpp.
|
inline |
it fill all the memory of fl patterns
WARNING does not assign a value to each element but it fill the memory Useful to fast set the memory to zero
fl | byte to fill |
Definition at line 364 of file map_vector.hpp.
|
inline |
Get an element of the vector.
p | must be 0 |
id | element to get |
Definition at line 279 of file map_vector.hpp.
|
inline |
Get an element of the vector.
p | must be 0 |
id | element to get |
Definition at line 303 of file map_vector.hpp.
|
inline |
Get an element of the vector.
id | element to get |
Definition at line 325 of file map_vector.hpp.
|
inline |
Get an element of the vector.
id | element to get |
Definition at line 344 of file map_vector.hpp.
|
inline |
|
inline |
Return the last error.
Definition at line 606 of file map_vector.hpp.
|
inline |
Return the pointer to the chunk of memory.
Definition at line 575 of file map_vector.hpp.
|
inline |
Return the pointer to the chunk of memory.
Definition at line 588 of file map_vector.hpp.
|
inline |
Get the last element.
Definition at line 188 of file map_vector.hpp.
|
inline |
Get the last element.
Definition at line 205 of file map_vector.hpp.
|
inline |
Load this object from file.
file | filename |
Definition at line 271 of file map_vector.hpp.
|
inlinestatic |
|
inline |
Check that two vectors are equal.
vector | to compare |
Definition at line 491 of file map_vector.hpp.
|
inline |
Operator= copy the vector into another.
Definition at line 461 of file map_vector.hpp.
|
inline |
Operator= copy the vector into another.
Definition at line 476 of file map_vector.hpp.
|
inline |
Check that two vectors are not equal.
vector | to compare |
Definition at line 501 of file map_vector.hpp.
|
inlinestatic |
pack a vector selecting the properties to pack
mem | preallocated memory where to pack the vector |
obj | object to pack |
sts | pack-stat info |
Definition at line 171 of file map_vector.hpp.
|
inline |
Calculate the memory size required to allocate n elements.
Calculate the total size required to store n-elements in a vector
n | number of elements |
e | unused |
Definition at line 529 of file map_vector.hpp.
|
inline |
Insert an allocation request into the vector.
obj | vector object to pack |
requests | vector |
Definition at line 203 of file map_vector.hpp.
|
inline |
Remove one entry from the vector.
key | element to remove |
Definition at line 152 of file map_vector.hpp.
|
inline |
reserve a memory space in advance to avoid reallocation
ns | number of element the memory has to store |
Definition at line 378 of file map_vector.hpp.
|
inline |
\ brief Resize the vector to contain n elements
slot | number of elements |
Definition at line 66 of file map_vector.hpp.
|
inline |
Save this object into file.
file | filename |
Definition at line 236 of file map_vector.hpp.
|
inline |
It sort the vector.
Definition at line 262 of file map_vector.hpp.
|
inline |
swap the memory between the two vector
v | vector to swap |
Definition at line 235 of file map_vector.hpp.
|
inline |
swap the content of the vector
v | vector to be swapped with |
Definition at line 448 of file map_vector.hpp.
|
inline |
It eliminate double entries.
Definition at line 248 of file map_vector.hpp.
|
inline |
unpack a vector
ext | preallocated memory from where to unpack the vector |
obj | object where to unpack |
Definition at line 219 of file map_vector.hpp.
|
inline |
check that the id does not overflow the buffer
id | to check |
Definition at line 619 of file map_vector.hpp.
|
private |
Actual size of the vector, warning: it is not the space allocated in grid grid size increase by a fixed amount every time we need a vector bigger than the actually allocated space
Definition at line 30 of file map_vector.hpp.