|
ITK
5.3.0
Insight Toolkit
|
Go to the documentation of this file.
18 #ifndef itkFixedArray_h
19 #define itkFixedArray_h
52 template <
typename TValue,
unsigned int VLength = 3>
57 static constexpr
unsigned int Length = VLength;
63 using ValueType = TValue;
74 class ConstReverseIterator;
203 explicit FixedArray(
const std::array<ValueType, VLength> & stdArray)
205 std::copy_n(stdArray.cbegin(), VLength, m_InternalArray);
209 template <
typename TFixedArrayValueType>
214 for (
auto & element : m_InternalArray)
216 element = static_cast<TValue>(*input++);
220 template <
typename TScalarValue>
223 std::copy_n(r, VLength, m_InternalArray);
227 template <
typename TFixedArrayValueType>
233 for (
auto & element : m_InternalArray)
235 element = static_cast<TValue>(*input++);
241 operator=(
const ValueType r[VLength]);
249 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(
FixedArray);
255 #if defined(__GNUC__)
257 # pragma GCC diagnostic push
258 # pragma GCC diagnostic ignored "-Warray-bounds"
263 #if defined(__GNUC__)
265 # pragma GCC diagnostic pop
274 m_InternalArray[index] = value;
279 return m_InternalArray[index];
287 return m_InternalArray;
293 return m_InternalArray;
299 return m_InternalArray;
305 return m_InternalArray;
321 itkLegacyMacro(ReverseIterator rBegin());
323 itkLegacyMacro(ConstReverseIterator rBegin()
const);
325 itkLegacyMacro(ReverseIterator rEnd());
327 itkLegacyMacro(ConstReverseIterator rEnd()
const);
329 constexpr const_iterator
332 return m_InternalArray;
338 return m_InternalArray;
341 constexpr const_iterator
344 return this->cbegin();
347 constexpr const_iterator
350 return m_InternalArray + VLength;
356 return m_InternalArray + VLength;
359 constexpr const_iterator
371 const_reverse_iterator
377 const_reverse_iterator
380 return this->crbegin();
389 const_reverse_iterator
395 const_reverse_iterator
398 return this->crend();
413 Fill(
const ValueType &);
430 return MakeFilled<FixedArray>(value);
435 template <
typename TValue,
unsigned int VLength>
437 operator<<(std::ostream & os,
const FixedArray<TValue, VLength> & arr);
440 template <
typename TValue,
unsigned int VLength>
449 #ifndef ITK_MANUAL_INSTANTIATION
450 # include "itkFixedArray.hxx"
const_reverse_iterator rend() const
constexpr const_iterator cbegin() const noexcept
FixedArray(const TScalarValue *r)
Represent a n-dimensional size (bounds) of a n-dimensional image.
ValueType[VLength] CArray
const ValueType * data() const
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
ReverseIterator operator--(int)
constexpr SizeType size() const
const ValueType & const_reference
constexpr const_iterator begin() const noexcept
A const reverse iterator through an array.
FixedArray(const FixedArray< TFixedArrayValueType, VLength > &r)
ConstReverseIterator operator++(int)
A reverse iterator through an array.
void swap(Array< T > &a, Array< T > &b)
ImageBaseType::SizeType SizeType
ConstReverseIterator(const ReverseIterator &rit)
const_reference GetElement(unsigned int index) const
constexpr iterator end() noexcept
FixedArray & operator=(const FixedArray< TFixedArrayValueType, VLength > &r)
constexpr const_reference operator[](unsigned int index) const
ValueType * GetDataPointer()
ReverseIterator(Iterator i)
const ValueType * ConstIterator
ConstReverseIterator operator--(int)
ConstReverseIterator(ConstIterator i)
constexpr reference operator[](unsigned int index)
const ValueType * GetDataPointer() const
ReverseIterator operator--()
ConstIterator operator->() const
ReverseIterator operator++(int)
const ValueType * const_pointer
constexpr const_iterator cend() const noexcept
ReverseIterator operator++()
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
ConstReverseIterator operator--()
Simulate a standard C array with copy semantics.
ValueType & operator*() const
std::reverse_iterator< iterator > reverse_iterator
void swap(FixedArray< TValue, VLength > &a, FixedArray< TValue, VLength > &b)
constexpr const_iterator end() const noexcept
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
const_reverse_iterator crbegin() const
ConstReverseIterator operator++()
reverse_iterator rbegin()
Iterator operator->() const
constexpr iterator begin() noexcept
void swap(FixedArray &other)
const ValueType & operator*() const
static constexpr FixedArray Filled(const ValueType &value)
bool operator==(const ReverseIterator &rit) const
bool operator==(const ConstReverseIterator &rit) const
const ValueType * const_iterator
constexpr unsigned int Dimension
const_reverse_iterator crend() const
const_reverse_iterator rbegin() const
void SetElement(unsigned int index, const_reference value)
std::reverse_iterator< const_iterator > const_reverse_iterator
FixedArray(const std::array< ValueType, VLength > &stdArray)