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 100 of file map_vector.hpp.
#include <map_vector.hpp>
Data Structures | |
struct | pack_cond |
Structures that do a nested packing, depending on the existence of 'pack' function inside of the object. More... | |
struct | pack_cond< true, T1, Memory1, prp...> |
Structures that do a nested packing, depending on the existence of 'pack' function inside of the object. More... | |
struct | packMem_cond |
Structures that calculate memory for an object, depending on the existence of 'packMem' function inside the object. More... | |
struct | packMem_cond< true, T1, prp...> |
Structures that calculate memory for an object, depending on the existence of 'packMem' function inside the object. More... | |
struct | packRequest_cond |
Structures that do a pack request, depending on the existence of 'packRequest' function inside of the object. More... | |
struct | packRequest_cond< true, T1, prp...> |
Structures that do a pack request, depending on the existence of 'packRequest' function inside of the object. More... | |
struct | unpack_cond |
Structures that do a nested unpacking, depending on the existence of 'pack' function inside the object. More... | |
struct | unpack_cond< true, T1, Memory1, prp...> |
Structures that do a nested unpacking, depending on the existence of 'pack' function inside the object. More... | |
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. | |
typedef void | base_to_copy |
Public Member Functions | |
template<int... prp> | |
void | pack (ExtPreAlloc< HeapMemory > &mem, Pack_stat &sts) const |
pack a vector More... | |
template<int... prp> | |
void | packRequest (size_t &req) const |
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 (const std::string &file) const |
Save this object into file. More... | |
bool | load (const 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... | |
template<typename Mem , typename l , template< typename > class lb, typename gp > | |
void | add (const openfpm::vector< T, Mem, l, lb, gp > &eles) |
add elements to the vector More... | |
template<typename S > | |
void | add (const S &v) |
It insert a new object on the vector, eventually it reallocate the grid. More... | |
template<typename S > | |
void | add (const S &&v) |
It insert a new object on the vector, eventually it reallocate the grid. More... | |
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int... args> | |
void | add_prp (const vector< S, M, typename layout_base< S >::type, layout_base, gp, impl > &v) |
It add the element of a source vector to this vector. More... | |
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int... args> | |
void | add_prp (const T &v) |
It add the element it is equivalent to add. 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... | |
auto | begin () const -> const decltype(base.begin()) |
Return an std compatible iterator to the first element. More... | |
auto | end () const -> const 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... | |
openfpm::vector< T > | duplicate () const |
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, layout, memory_traits_lin, 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, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) noexcept | |
Constructor from another vector. | |
~vector () noexcept | |
destructor | |
void | swap (openfpm::vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) |
void | swap (openfpm::vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) |
vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (const vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) |
Operator= copy the vector into another. More... | |
template<typename Mem , typename gp > | |
vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (const vector< T, Mem, layout, memory_traits_lin, gp, STD_VECTOR > &v) |
Operator= copy the vector into another. More... | |
vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) |
Operator= copy the vector into another. More... | |
template<typename Mem , typename gp > | |
vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (vector< T, Mem, layout, memory_traits_lin, gp, STD_VECTOR > &&v) |
Operator= copy the vector into another. More... | |
bool | operator!= (const vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const |
Check that two vectors are equal. More... | |
bool | operator== (const vector< T, HeapMemory, layout, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const |
Check that two vectors are not equal. More... | |
vector_key_iterator | getIterator () const |
Get an iterator over all the elements of the vector. More... | |
vector_key_iterator | getIteratorTo (size_t k) const |
Get iterator until a specified element. More... | |
template<int... prp> | |
size_t | packMem (size_t n, size_t e) const |
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 () |
Indicate that the vector has a packer function. | |
static bool | packRequest () |
Indicate that the vector has the function packRequest. | |
static bool | packMem () |
Indicate that the vector has the function pack Memory. | |
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 Types | |
typedef memory_traits_lin< T > ::type | layout |
Private Attributes | |
std::vector< T > | base |
1-D static grid | |
size_t | err_code = 0 |
Error code. | |
|
inline |
Initializer from constructor.
v | Initializer list |
Definition at line 716 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 183 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 212 of file map_vector.hpp.
|
inline |
Add an empty object (it call the default constructor () ) at the end of the vector.
Definition at line 235 of file map_vector.hpp.
|
inline |
add elements to the vector
eles | elements to add |
Definition at line 260 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 294 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 323 of file map_vector.hpp.
|
inline |
It add the element of a source vector to this vector.
The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required
S | Base object of the source vector |
M | memory type of the source vector |
gp | Grow policy of the source vector |
args | one or more number that define which property to set-up |
v | source vector |
Definition at line 363 of file map_vector.hpp.
|
inline |
It add the element it is equivalent to add.
exist to respect a general interface template parameters are unused the explanation refer to the interface specification, but is unused in this case
S | Base object of the source vector |
M | memory type of the source vector |
gp | Grow policy of the source vector |
args | one or more number that define which property to set-up |
v | source vector |
Definition at line 391 of file map_vector.hpp.
|
inline |
Return an std compatible iterator to the first element.
Definition at line 435 of file map_vector.hpp.
|
inline |
Return an std compatible iterator to the first element.
Definition at line 455 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 946 of file map_vector.hpp.
|
inlinestatic |
How many allocation are required to create n-elements.
n | number of elements |
Definition at line 958 of file map_vector.hpp.
|
inline |
Remove all the element from the vector.
Definition at line 166 of file map_vector.hpp.
|
inline |
|
inline |
Return an std compatible iterator to the last element.
Definition at line 445 of file map_vector.hpp.
|
inline |
Return an std compatible iterator to the last element.
Definition at line 465 of file map_vector.hpp.
|
inline |
Erase the elements from start to end.
start | element |
end | element |
Definition at line 405 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 649 of file map_vector.hpp.
|
inline |
Get an element of the vector.
p | must be 0 |
id | element to get |
Definition at line 566 of file map_vector.hpp.
|
inline |
Get an element of the vector.
p | must be 0 |
id | element to get |
Definition at line 590 of file map_vector.hpp.
|
inline |
Get an element of the vector.
id | element to get |
Definition at line 612 of file map_vector.hpp.
|
inline |
Get an element of the vector.
id | element to get |
Definition at line 630 of file map_vector.hpp.
|
inline |
Get an iterator over all the elements of the vector.
Definition at line 892 of file map_vector.hpp.
|
inline |
Get iterator until a specified element.
k | key |
Definition at line 907 of file map_vector.hpp.
|
inline |
|
inline |
Return the pointer to the chunk of memory.
Definition at line 969 of file map_vector.hpp.
|
inline |
Return the pointer to the chunk of memory.
Definition at line 982 of file map_vector.hpp.
|
inline |
Get the last element.
Definition at line 475 of file map_vector.hpp.
|
inline |
Get the last element.
Definition at line 492 of file map_vector.hpp.
|
inline |
Load this object from file.
file | filename |
Definition at line 248 of file map_vector.hpp.
|
inlinestatic |
|
inline |
Check that two vectors are equal.
v | vector to compare |
Definition at line 870 of file map_vector.hpp.
|
inline |
Operator= copy the vector into another.
v | vector to copy |
Definition at line 778 of file map_vector.hpp.
|
inline |
Operator= copy the vector into another.
Definition at line 805 of file map_vector.hpp.
|
inline |
Operator= copy the vector into another.
v | vector to copy |
Definition at line 836 of file map_vector.hpp.
|
inline |
Operator= copy the vector into another.
v | vector to copy |
Definition at line 853 of file map_vector.hpp.
|
inline |
Check that two vectors are not equal.
v | vector to compare |
Definition at line 882 of file map_vector.hpp.
|
inline |
pack a vector
mem | preallocated memory where to pack the vector |
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 925 of file map_vector.hpp.
|
inline |
Insert an allocation request into the vector.
prp | properties to pack |
req | counter with the byte required to pack the vector |
Definition at line 186 of file map_vector.hpp.
|
inline |
Remove one entry from the vector.
key | element to remove |
Definition at line 419 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 662 of file map_vector.hpp.
|
inline |
\ brief Resize the vector to contain n elements
slot | number of elements |
Definition at line 143 of file map_vector.hpp.
|
inline |
Save this object into file.
file | filename |
Definition at line 216 of file map_vector.hpp.
|
inline |
It sort the vector.
Definition at line 549 of file map_vector.hpp.
|
inline |
swap the memory between the two vector
v | vector to swap |
Definition at line 522 of file map_vector.hpp.
|
inline |
swap the content of the vector
v | vector to be swapped with |
Definition at line 750 of file map_vector.hpp.
|
inline |
swap the content of the vector
v | vector to be swapped with |
Definition at line 763 of file map_vector.hpp.
|
inline |
It eliminate double entries.
Definition at line 535 of file map_vector.hpp.
|
inline |
unpack a vector
mem | preallocated memory from where to unpack the vector |
ps | unpack info |
Definition at line 202 of file map_vector.hpp.
|
inline |
check that the id does not overflow the buffer
v1 | id to check |
Definition at line 1015 of file map_vector.hpp.