 |
ITK
5.4.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;
208 explicit FixedArray(
const std::array<ValueType, VLength> & stdArray)
210 std::copy_n(stdArray.cbegin(), VLength, m_InternalArray);
214 template <
typename TFixedArrayValueType>
219 for (
auto & element : m_InternalArray)
221 element = static_cast<TValue>(*input++);
225 template <
typename TScalarValue>
228 std::copy_n(r, VLength, m_InternalArray);
237 template <
typename TFixedArrayValueType>
243 for (
auto & element : m_InternalArray)
245 element = static_cast<TValue>(*input++);
251 operator=(
const ValueType r[VLength]);
259 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(
FixedArray);
265 #if defined(__GNUC__)
267 # pragma GCC diagnostic push
268 # pragma GCC diagnostic ignored "-Warray-bounds"
273 #if defined(__GNUC__)
275 # pragma GCC diagnostic pop
284 m_InternalArray[index] = value;
289 return m_InternalArray[index];
297 return m_InternalArray;
303 return m_InternalArray;
309 return m_InternalArray;
315 return m_InternalArray;
335 itkLegacyMacro(ReverseIterator rBegin());
338 itkLegacyMacro(ConstReverseIterator rBegin()
const);
341 itkLegacyMacro(ReverseIterator rEnd());
344 itkLegacyMacro(ConstReverseIterator rEnd()
const);
346 constexpr const_iterator
349 return m_InternalArray;
355 return m_InternalArray;
358 constexpr const_iterator
361 return this->cbegin();
364 constexpr const_iterator
367 return m_InternalArray + VLength;
373 return m_InternalArray + VLength;
376 constexpr const_iterator
388 const_reverse_iterator
394 const_reverse_iterator
397 return this->crbegin();
406 const_reverse_iterator
412 const_reverse_iterator
415 return this->crend();
430 Fill(
const ValueType &);
447 return MakeFilled<FixedArray>(value);
452 template <
typename TValue,
unsigned int VLength>
454 operator<<(std::ostream & os,
const FixedArray<TValue, VLength> & arr);
457 template <
typename TValue,
unsigned int VLength>
466 #ifndef ITK_MANUAL_INSTANTIATION
467 # 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)