#include <Position.h>
n-dimensional pixel position or image shape, i.e. set of integer coordinates.
| N | A non-negative dimension (0 is allowed), or -1 for variable dimension. |
The values are stored in a std::array<long, N> in general (N ≥ 0), or std::vector<long> for variable dimension (N = -1).
Memory and services are optimized when dimension is fixed at compile-time (N ≥ 0).
Anonymous brace-initialization is permitted, e.g.:
Classical positions are instantiated with named constructors, e.g.:
Static Public Attributes | |
| static constexpr long | Dim = N |
| The dimension template parameter. | |
Static Public Member Functions | |
| static Position< N > | zero () |
| Create position 0. | |
| static Position< N > | one () |
| Create a position full of 1's. | |
| static Position< N > | max () |
| Create max position (full of -1's). | |
Public Member Functions | |
| Position () | |
| Default constructor. More... | |
| Position (long dim) | |
| Create a position of given dimension. | |
| template<typename TIterator > | |
| Position (TIterator begin, TIterator end) | |
| Create a position by copying data from some container. | |
| Position (std::initializer_list< long > indices) | |
| Create a position from a brace-enclosed list of indices. | |
| bool | isZero () const |
| Check whether the position is zero. | |
| bool | isMax () const |
| Check whether the position is max. | |
| template<long M> | |
| Position< M > | slice () const |
| Create a position of lower dimension. More... | |
| template<long M> | |
| Position< M > | extend (const Position< M > &padding) const |
| Create a position of higher dimension. More... | |
Public Member Functions inherited from DataContainer< long, Indices< 2 >, Position< 2 > > | |
| long * | data () |
Inherit data holder's data(). | |
| const long * | data () const |
Inherit data holder's data(). | |
| const std::decay_t< Indices< 2 > > & | container () const |
| Access the container in read-only mode. | |
| std::vector< long > | vector () const |
Copy the container values into an std::vector. More... | |
| Indices< 2 > & | moveTo (Indices< 2 > &destination) |
| Move the container. More... | |
| std::size_t | size () const |
Inherit data holder's size(). | |
Public Member Functions inherited from ContiguousContainerMixin< T, TDerived > | |
| bool | emtpy () const |
| Check whether the container is empty. More... | |
| const T & | operator[] (size_type index) const |
| Access the element with given index. | |
| T & | operator[] (size_type index) |
| Access the element with given index. | |
| const_iterator | begin () const |
| Iterator to the first element. | |
| iterator | begin () |
| Iterator to the first element. | |
| const_iterator | cbegin () |
| Iterator to the first element. | |
| const_iterator | end () const |
| Iterator to one past the last element. | |
| iterator | end () |
| Iterator to one past the last element. | |
| const_iterator | cend () |
| Iterator to one past the last element. | |
| virtual bool | operator== (const TDerived &rhs) const |
| Check equality. | |
| bool | operator!= (const TDerived &rhs) const |
| Check inequality. | |
Public Member Functions inherited from VectorArithmeticMixin< T, TDerived, Incrementable > | |
| TDerived & | operator+= (const TDerived &rhs) |
| V += U and W = V + U. | |
| TDerived & | operator+= (const T &rhs) |
| V += a, V = U + a, V = a + U. | |
| TDerived & | operator-= (const TDerived &rhs) |
| V -= U and W = V - U. | |
| TDerived & | operator-= (const T &rhs) |
| V -= a, V = U - a, V = a - U. | |
| TDerived & | operator*= (const T &rhs) |
| V *= a, V = U * a, V = a * U. | |
| TDerived & | operator/= (const T &rhs) |
| V /= a, V = U / a. | |
| template<typename TFunc , typename... TContainers> | |
| TDerived & | generate (TFunc &&func, const TContainers &... args) |
| Generate values from a function with optional input containers. More... | |
| template<typename TFunc , typename... TContainers> | |
| TDerived & | apply (TFunc &&func, const TContainers &... args) |
| Apply a function with optional input containers. More... | |
| TDerived | operator+ () const |
| Copy. | |
| TDerived | operator- () const |
| Compute the opposite. | |
Related Functions | |
(Note that these are not member functions.) | |
| template<long N = 2> | |
| using | Indices = typename std::conditional<(N==-1), std::vector< long >, std::array< long,(std::size_t) N > >::type |
| The index container type. | |
| template<long N = 2> | |
| long | shapeSize (const Position< N > &shape) |
| Compute the number of pixels in a given shape. | |
Related Functions inherited from ContiguousContainerMixin< T, TDerived > | |
| template<typename T , typename TDerived > | |
| std::ostream & | operator<< (std::ostream &os, const ContiguousContainerMixin< T, TDerived > &container) |
Insert a ContiguousContainerMixin into an output stream. | |
Additional Inherited Members | |
Public Types inherited from DataContainer< long, Indices< 2 >, Position< 2 > > | |
| using | Holder = DataContainerHolder< long, Indices< 2 > > |
| The concrete data holder type. | |
Public Types inherited from ContiguousContainerMixin< T, TDerived > | |
| using | value_type = T |
| The value type. | |
| using | reference = T & |
| The value reference. | |
| using | const_reference = const T & |
| The constant value reference. | |
| using | iterator = T * |
| The value iterator. | |
| using | const_iterator = const T * |
| The constant value iterator. | |
| using | difference_type = std::ptrdiff_t |
| The iterator difference type. | |
| using | size_type = std::size_t |
| The underlying container size type. | |