#include <vector>
#include <cstdint>
#include <cstring>
#include "ft_array_iterator.h"
#include "ft_utility_macro.h"
Go to the source code of this file.
|
#define | ARRAY_VIEW_READ 0 |
|
#define | ARRAY_VIEW_WRITE 1 |
|
#define | VIEW_ACCESS_HELP_V(v_bu, v_st, a_bu, a_st, count_n, rw) |
| Access a subset between v_bu (view buffer) and a_bu (array buffer) More...
|
|
#define | VIEW_ACCESS_HELP_P(v_bu, v_st, a_bu, a_st, count_n, rw, type_size) |
|
|
template<class T > |
int | ArrayViewAccessV (std::vector< T > &view_v, std::vector< T > &array_v, std::vector< unsigned long long > &array_size, std::vector< unsigned long long > &start, std::vector< unsigned long long > &end, int read_write_code) |
| Access an view (subset) of an array. More...
|
|
template<class T > |
int | ArrayViewAccessP (T *view_v, T *array_v, std::vector< unsigned long long > array_size, std::vector< unsigned long long > start, std::vector< unsigned long long > end, int read_write_code) |
|
◆ ARRAY_VIEW_READ
#define ARRAY_VIEW_READ 0 |
◆ ARRAY_VIEW_WRITE
#define ARRAY_VIEW_WRITE 1 |
◆ VIEW_ACCESS_HELP_P
#define VIEW_ACCESS_HELP_P |
( |
|
v_bu, |
|
|
|
v_st, |
|
|
|
a_bu, |
|
|
|
a_st, |
|
|
|
count_n, |
|
|
|
rw, |
|
|
|
type_size |
|
) |
| |
Value: { \
{ \
std::memcpy(v_bu + v_st, a_bu + a_st, count_n * type_size); \
} \
else \
{ \
std::memcpy(a_bu + a_st, v_bu + v_st, count_n * type_size); \
} \
}
#define ARRAY_VIEW_READ
Definition: ft_array_view_access.h:89
◆ VIEW_ACCESS_HELP_V
#define VIEW_ACCESS_HELP_V |
( |
|
v_bu, |
|
|
|
v_st, |
|
|
|
a_bu, |
|
|
|
a_st, |
|
|
|
count_n, |
|
|
|
rw |
|
) |
| |
Value: { \
{ \
std::memcpy(); \
std::copy(a_bu.begin() + a_st, a_bu.begin() + a_st + count_n, v_bu.begin() + v_st); \
} \
else \
{ \
std::copy(v_bu.begin() + v_st, v_bu.begin() + v_st + count_n, a_bu.begin() + a_st); \
} \
}
Access a subset between v_bu (view buffer) and a_bu (array buffer)
- Parameters
-
v_bu | view buffer |
v_st | start of view buffer |
a_bu | array buffer |
a_st | start of array buffer |
count_n | element to access |
rm | flag to read or write, ARRAY_VIEW_READ and ARRAY_VIEW_WRITE |
◆ ArrayViewAccessP()
template<class T >
int ArrayViewAccessP |
( |
T * |
view_v, |
|
|
T * |
array_v, |
|
|
std::vector< unsigned long long > |
array_size, |
|
|
std::vector< unsigned long long > |
start, |
|
|
std::vector< unsigned long long > |
end, |
|
|
int |
read_write_code |
|
) |
| |
|
inline |
◆ ArrayViewAccessV()
template<class T >
int ArrayViewAccessV |
( |
std::vector< T > & |
view_v, |
|
|
std::vector< T > & |
array_v, |
|
|
std::vector< unsigned long long > & |
array_size, |
|
|
std::vector< unsigned long long > & |
start, |
|
|
std::vector< unsigned long long > & |
end, |
|
|
int |
read_write_code |
|
) |
| |
|
inline |
Access an view (subset) of an array.
- Parameters
-
view_buffer | : pointer to the buffer for the view |
array_buffer | : pointer to the buffer for the array |
array_size | : the size for the array |
start | : the start address of the view |
end | : the end address of the view |
read_write_code | : mode to read or write, e.g., ARRAY_VIEW_READ , ARRAY_VIEW_WRITE 1 |
element_size | : the size of each element data |
- Returns
- int : non zero if works, otherwise failed