|
Jet
v1.3.3
|
3-D array accessor class. More...
#include <jet/array_accessor3.h>
Public Member Functions | |
| ArrayAccessor () | |
| Constructs empty 3-D array accessor. More... | |
| ArrayAccessor (const Size3 &size, T *const data) | |
| ArrayAccessor (size_t width, size_t height, size_t depth, T *const data) | |
| ArrayAccessor (const ArrayAccessor &other) | |
| Copy constructor. More... | |
| void | set (const ArrayAccessor &other) |
Replaces the content with given other array accessor. More... | |
| void | reset (const Size3 &size, T *const data) |
| Resets the array. More... | |
| void | reset (size_t width, size_t height, size_t depth, T *const data) |
| Resets the array. More... | |
| T & | at (size_t i) |
| Returns the reference to the i-th element. More... | |
| const T & | at (size_t i) const |
| Returns the const reference to the i-th element. More... | |
| T & | at (const Point3UI &pt) |
| Returns the reference to the element at (pt.x, pt.y, pt.z). More... | |
| const T & | at (const Point3UI &pt) const |
| Returns the const reference to the element at (pt.x, pt.y, pt.z). More... | |
| T & | at (size_t i, size_t j, size_t k) |
| Returns the reference to the element at (i, j, k). More... | |
| const T & | at (size_t i, size_t j, size_t k) const |
| Returns the const reference to the element at (i, j, k). More... | |
| T *const | begin () const |
| Returns the begin iterator of the array. More... | |
| T *const | end () const |
| Returns the end iterator of the array. More... | |
| T * | begin () |
| Returns the begin iterator of the array. More... | |
| T * | end () |
| Returns the end iterator of the array. More... | |
| Size3 | size () const |
| Returns the size of the array. More... | |
| size_t | width () const |
| Returns the width of the array. More... | |
| size_t | height () const |
| Returns the height of the array. More... | |
| size_t | depth () const |
| Returns the depth of the array. More... | |
| T *const | data () const |
| Returns the raw pointer to the array data. More... | |
| void | swap (ArrayAccessor &other) |
Swaps the content of with other array accessor. More... | |
| template<typename Callback > | |
| void | forEach (Callback func) const |
Iterates the array and invoke given func for each index. More... | |
| template<typename Callback > | |
| void | forEachIndex (Callback func) const |
Iterates the array and invoke given func for each index. More... | |
| template<typename Callback > | |
| void | parallelForEach (Callback func) |
Iterates the array and invoke given func for each index in parallel. More... | |
| template<typename Callback > | |
| void | parallelForEachIndex (Callback func) const |
Iterates the array and invoke given func for each index in parallel using multi-threading. More... | |
| size_t | index (const Point3UI &pt) const |
| Returns the linear index of the given 3-D coordinate (pt.x, pt.y, pt.z). More... | |
| size_t | index (size_t i, size_t j, size_t k) const |
| Returns the linear index of the given =3-D coordinate (i, j, k). More... | |
| T & | operator[] (size_t i) |
| Returns the reference to the i-th element. More... | |
| const T & | operator[] (size_t i) const |
| Returns the const reference to the i-th element. More... | |
| T & | operator() (const Point3UI &pt) |
| Returns the reference to the element at (pt.x, pt.y, pt.z). More... | |
| const T & | operator() (const Point3UI &pt) const |
| Returns the const reference to the element at (pt.x, pt.y, pt.z). More... | |
| T & | operator() (size_t i, size_t j, size_t k) |
| Returns the reference to the element at (i, j, k). More... | |
| const T & | operator() (size_t i, size_t j, size_t k) const |
| Returns the const reference to the element at (i, j, k). More... | |
| ArrayAccessor & | operator= (const ArrayAccessor &other) |
Copies given array other to this array. More... | |
| operator ConstArrayAccessor< T, 3 > () const | |
| Casts type to ConstArrayAccessor. More... | |
3-D array accessor class.
This class represents 3-D array accessor. Array accessor provides array-like data read/write functions, but does not handle memory management. Thus, it is more like a random access iterator, but with multi-dimension support. Similar to Array<T, 3>, this class interprets a linear array as a 3-D array using i-major indexing.
| T | - Array value type. |
| jet::ArrayAccessor< T, 3 >::ArrayAccessor | ( | ) |
Constructs empty 3-D array accessor.
| jet::ArrayAccessor< T, 3 >::ArrayAccessor | ( | const Size3 & | size, |
| T *const | data | ||
| ) |
Constructs an array accessor that wraps given array.
| size | Size of the 3-D array. |
| data | Raw array pointer. |
| jet::ArrayAccessor< T, 3 >::ArrayAccessor | ( | size_t | width, |
| size_t | height, | ||
| size_t | depth, | ||
| T *const | data | ||
| ) |
Constructs an array accessor that wraps given array.
| width | Width of the 3-D array. |
| height | Height of the 3-D array. |
| depth | Depth of the 3-D array. |
| data | Raw array pointer. |
| jet::ArrayAccessor< T, 3 >::ArrayAccessor | ( | const ArrayAccessor< T, 3 > & | other | ) |
Copy constructor.
| T& jet::ArrayAccessor< T, 3 >::at | ( | const Point3UI & | pt | ) |
Returns the reference to the element at (pt.x, pt.y, pt.z).
| const T& jet::ArrayAccessor< T, 3 >::at | ( | const Point3UI & | pt | ) | const |
Returns the const reference to the element at (pt.x, pt.y, pt.z).
| T& jet::ArrayAccessor< T, 3 >::at | ( | size_t | i | ) |
Returns the reference to the i-th element.
| const T& jet::ArrayAccessor< T, 3 >::at | ( | size_t | i | ) | const |
Returns the const reference to the i-th element.
| T& jet::ArrayAccessor< T, 3 >::at | ( | size_t | i, |
| size_t | j, | ||
| size_t | k | ||
| ) |
Returns the reference to the element at (i, j, k).
| const T& jet::ArrayAccessor< T, 3 >::at | ( | size_t | i, |
| size_t | j, | ||
| size_t | k | ||
| ) | const |
Returns the const reference to the element at (i, j, k).
| T* jet::ArrayAccessor< T, 3 >::begin | ( | ) |
Returns the begin iterator of the array.
| T* const jet::ArrayAccessor< T, 3 >::begin | ( | ) | const |
Returns the begin iterator of the array.
| T* const jet::ArrayAccessor< T, 3 >::data | ( | ) | const |
Returns the raw pointer to the array data.
| size_t jet::ArrayAccessor< T, 3 >::depth | ( | ) | const |
Returns the depth of the array.
| T* jet::ArrayAccessor< T, 3 >::end | ( | ) |
Returns the end iterator of the array.
| T* const jet::ArrayAccessor< T, 3 >::end | ( | ) | const |
Returns the end iterator of the array.
| void jet::ArrayAccessor< T, 3 >::forEach | ( | Callback | func | ) | const |
Iterates the array and invoke given func for each index.
This function iterates the array elements and invoke the callback function func. The callback function takes array's element as its input. The order of execution will be the same as the nested for-loop below:
Below is the sample usage:
| void jet::ArrayAccessor< T, 3 >::forEachIndex | ( | Callback | func | ) | const |
Iterates the array and invoke given func for each index.
This function iterates the array elements and invoke the callback function func. The callback function takes three parameters which are the (i, j, j) indices of the array. The order of execution will be the same as the nested for-loop below:
Below is the sample usage:
| size_t jet::ArrayAccessor< T, 3 >::height | ( | ) | const |
Returns the height of the array.
| size_t jet::ArrayAccessor< T, 3 >::index | ( | const Point3UI & | pt | ) | const |
Returns the linear index of the given 3-D coordinate (pt.x, pt.y, pt.z).
| size_t jet::ArrayAccessor< T, 3 >::index | ( | size_t | i, |
| size_t | j, | ||
| size_t | k | ||
| ) | const |
Returns the linear index of the given =3-D coordinate (i, j, k).
| jet::ArrayAccessor< T, 3 >::operator ConstArrayAccessor< T, 3 > | ( | ) | const |
Casts type to ConstArrayAccessor.
| T& jet::ArrayAccessor< T, 3 >::operator() | ( | const Point3UI & | pt | ) |
Returns the reference to the element at (pt.x, pt.y, pt.z).
| const T& jet::ArrayAccessor< T, 3 >::operator() | ( | const Point3UI & | pt | ) | const |
Returns the const reference to the element at (pt.x, pt.y, pt.z).
| T& jet::ArrayAccessor< T, 3 >::operator() | ( | size_t | i, |
| size_t | j, | ||
| size_t | k | ||
| ) |
Returns the reference to the element at (i, j, k).
| const T& jet::ArrayAccessor< T, 3 >::operator() | ( | size_t | i, |
| size_t | j, | ||
| size_t | k | ||
| ) | const |
Returns the const reference to the element at (i, j, k).
| ArrayAccessor& jet::ArrayAccessor< T, 3 >::operator= | ( | const ArrayAccessor< T, 3 > & | other | ) |
Copies given array other to this array.
| T& jet::ArrayAccessor< T, 3 >::operator[] | ( | size_t | i | ) |
Returns the reference to the i-th element.
| const T& jet::ArrayAccessor< T, 3 >::operator[] | ( | size_t | i | ) | const |
Returns the const reference to the i-th element.
| void jet::ArrayAccessor< T, 3 >::parallelForEach | ( | Callback | func | ) |
Iterates the array and invoke given func for each index in parallel.
This function iterates the array elements and invoke the callback function func. The callback function takes array's element as its input. The order of execution will be non-deterministic since it runs in parallel. Below is the sample usage:
The parameter type of the callback function doesn't have to be T&, but const T& or T can be used as well.
| void jet::ArrayAccessor< T, 3 >::parallelForEachIndex | ( | Callback | func | ) | const |
Iterates the array and invoke given func for each index in parallel using multi-threading.
This function iterates the array elements and invoke the callback function func in parallel using multi-threading. The callback function takes two parameters which are the (i, j, k) indices of the array. The order of execution will be non-deterministic since it runs in parallel. Below is the sample usage:
| void jet::ArrayAccessor< T, 3 >::reset | ( | const Size3 & | size, |
| T *const | data | ||
| ) |
Resets the array.
| void jet::ArrayAccessor< T, 3 >::reset | ( | size_t | width, |
| size_t | height, | ||
| size_t | depth, | ||
| T *const | data | ||
| ) |
Resets the array.
| void jet::ArrayAccessor< T, 3 >::set | ( | const ArrayAccessor< T, 3 > & | other | ) |
Replaces the content with given other array accessor.
| Size3 jet::ArrayAccessor< T, 3 >::size | ( | ) | const |
Returns the size of the array.
| void jet::ArrayAccessor< T, 3 >::swap | ( | ArrayAccessor< T, 3 > & | other | ) |
Swaps the content of with other array accessor.
| size_t jet::ArrayAccessor< T, 3 >::width | ( | ) | const |
Returns the width of the array.
1.8.18