EleFits
4.0.0
A modern C++ API on top of CFitsIO
|
#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
).
Public Types | |
using | Indices = typename std::conditional<(n==-1), std::vector< long >, std::array< long,(std::size_t) n > >::type |
Storage class for the indices. | |
using | value_type = long |
Standad-like alias to the value type for compatibility, e.g. with Boost. | |
using | iterator = typename Indices::iterator |
Standad-like alias to the iterator type for compatibility, e.g. with Boost. | |
using | const_iterator = typename Indices::const_iterator |
Standad-like alias to the const iterator type for compatibility, e.g. with Boost. | |
Public Member Functions | |
Position () | |
Default constructor. More... | |
Position (long dim) | |
Create a position of given dimension. | |
Position (std::initializer_list< long > posIndices) | |
Create a position from a brace-enclosed list of indices. | |
template<typename TIterator > | |
Position (TIterator begin, TIterator end) | |
Create a position by copying data from some container. | |
bool | isZero () const |
Check whether the position is zero. | |
bool | isMax () const |
Check whether the position is max. | |
long | size () const |
The number of indices. | |
const long * | data () const |
Access the underlying array. | |
long * | data () |
long & | operator[] (long i) |
Access the i -th element. | |
const long & | operator[] (long i) const |
Access the i -th element. More... | |
iterator | begin () |
Iterator to the first element. | |
const_iterator | begin () const |
Iterator to the first element. More... | |
iterator | end () |
Iterator to the past-the-last element. | |
const_iterator | end () const |
Iterator to the past-the-last element. More... | |
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... | |
Static Public Member Functions | |
static Position< n > | zero () |
Create position 0. | |
static Position< n > | max () |
Create max position (full of -1's). | |
Public Attributes | |
Indices | indices |
The indices. | |