ITK  5.1.0
Insight Toolkit
Classes | Public Types | Static Public Attributes | List of all members
itk::FixedArray< TValue, VLength > Class Template Reference

#include <itkFixedArray.h>

+ Inheritance diagram for itk::FixedArray< TValue, VLength >:
+ Collaboration diagram for itk::FixedArray< TValue, VLength >:

Classes

class  ConstReverseIterator
 
class  ReverseIterator
 

Public Types

using CArray = ValueType[VLength]
 
using const_iterator = const ValueType *
 
using const_pointer = const ValueType *
 
using const_reference = const ValueType &
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using ConstIterator = const ValueType *
 
using Iterator = ValueType *
 
using iterator = ValueType *
 
using pointer = ValueType *
 
using reference = ValueType &
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using SizeType = unsigned int
 
using ValueType = TValue
 

Static Public Attributes

static constexpr unsigned int Dimension = VLength
 
static constexpr unsigned int Length = VLength
 
CArray m_InternalArray
 
 FixedArray ()=default
 
 FixedArray (const FixedArray &)=default
 
FixedArrayoperator= (const FixedArray &)=default
 
 FixedArray (FixedArray &&)=default
 
FixedArrayoperator= (FixedArray &&)=default
 
 ~FixedArray ()=default
 
 FixedArray (const ValueType r[VLength])
 
 FixedArray (const ValueType &)
 
 FixedArray (const std::array< ValueType, VLength > &stdArray)
 
template<typename TFixedArrayValueType >
 FixedArray (const FixedArray< TFixedArrayValueType, VLength > &r)
 
template<typename TScalarValue >
 FixedArray (const TScalarValue *r)
 
template<typename TFixedArrayValueType >
FixedArrayoperator= (const FixedArray< TFixedArrayValueType, VLength > &r)
 
FixedArrayoperator= (const ValueType r[VLength])
 
bool operator== (const FixedArray &r) const
 
bool operator!= (const FixedArray &r) const
 
reference operator[] (short index)
 
const_reference operator[] (short index) const
 
reference operator[] (unsigned short index)
 
const_reference operator[] (unsigned short index) const
 
reference operator[] (int index)
 
const_reference operator[] (int index) const
 
reference operator[] (unsigned int index)
 
const_reference operator[] (unsigned int index) const
 
reference operator[] (long index)
 
const_reference operator[] (long index) const
 
reference operator[] (unsigned long index)
 
const_reference operator[] (unsigned long index) const
 
reference operator[] (long long index)
 
const_reference operator[] (long long index) const
 
reference operator[] (unsigned long long index)
 
const_reference operator[] (unsigned long long index) const
 
void SetElement (unsigned int index, const_reference value)
 
const_reference GetElement (unsigned int index) const
 
ValueTypeGetDataPointer ()
 
const ValueTypeGetDataPointer () const
 
Iterator Begin ()
 
ConstIterator Begin () const
 
Iterator End ()
 
ConstIterator End () const
 
 itkLegacyMacro (ReverseIterator rBegin())
 
 itkLegacyMacro (ConstReverseIterator rBegin() const)
 
 itkLegacyMacro (ReverseIterator rEnd())
 
 itkLegacyMacro (ConstReverseIterator rEnd() const)
 
const_iterator cbegin () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cend () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
reverse_iterator rbegin ()
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator crend () const
 
const_reverse_iterator rend () const
 
SizeType Size () const
 
void Fill (const ValueType &)
 
void swap (FixedArray &other)
 
static FixedArray Filled (const ValueType &)
 

Detailed Description

template<typename TValue, unsigned int VLength = 3>
class itk::FixedArray< TValue, VLength >

Simulate a standard C array with copy semantics.

Simulates a standard C array, except that copy semantics are used instead of reference semantics. Also, arrays of different sizes cannot be assigned to one another, and size information is known for function returns.

Template Parameters
TValueElement type stored at each location in the array.
VLength= Length of the array.

The length of the array is fixed at compile time. If you wish to specify the length of the array at run-time, use the class itk::Array. If you wish to change to change the length of the array at run-time, you're best off using std::vector<>.

ITK Sphinx Examples:
\li All ITK Sphinx Examples
Examples
Examples/Statistics/ImageToListSampleAdaptor.cxx, Examples/Statistics/PointSetToAdaptor.cxx, Examples/Statistics/ScalarImageMarkovRandomField1.cxx, SphinxExamples/src/Core/Common/CreateAFixedArray/Code.cxx, SphinxExamples/src/Core/Transform/ScaleAnImage/Code.cxx, SphinxExamples/src/Filtering/ImageGrid/Create3DVolume/Code.cxx, SphinxExamples/src/Filtering/ImageGrid/Stack2DImagesInto3DImage/Code.cxx, SphinxExamples/src/Filtering/ImageGrid/TileImagesSideBySide/Code.cxx, and SphinxExamples/src/Numerics/Statistics/CreateListOfSamplesFromImageWithoutDuplication/Code.cxx.

Definition at line 52 of file itkFixedArray.h.

Member Typedef Documentation

◆ CArray

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::CArray = ValueType[VLength]

A type representing the C-array version of this FixedArray.

Definition at line 65 of file itkFixedArray.h.

◆ const_iterator

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::const_iterator = const ValueType *

The return type of cbegin() and cend(), and the const overloads of begin() and end().

Definition at line 187 of file itkFixedArray.h.

◆ const_pointer

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::const_pointer = const ValueType *

A const pointer to the ValueType.

Definition at line 175 of file itkFixedArray.h.

◆ const_reference

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::const_reference = const ValueType &

A const reference to the ValueType.

Definition at line 181 of file itkFixedArray.h.

◆ const_reverse_iterator

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 191 of file itkFixedArray.h.

◆ ConstIterator

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::ConstIterator = const ValueType *

A const iterator through the array.

Definition at line 71 of file itkFixedArray.h.

◆ Iterator

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::Iterator = ValueType *

An iterator through the array.

Definition at line 68 of file itkFixedArray.h.

◆ iterator

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::iterator = ValueType *

The return type of the non-const overloads of begin() and end().

Definition at line 184 of file itkFixedArray.h.

◆ pointer

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::pointer = ValueType *

A pointer to the ValueType.

Definition at line 172 of file itkFixedArray.h.

◆ reference

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::reference = ValueType &

A reference to the ValueType.

Definition at line 178 of file itkFixedArray.h.

◆ reverse_iterator

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 189 of file itkFixedArray.h.

◆ SizeType

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::SizeType = unsigned int

Definition at line 193 of file itkFixedArray.h.

◆ ValueType

template<typename TValue, unsigned int VLength = 3>
using itk::FixedArray< TValue, VLength >::ValueType = TValue

The element type stored at each location in the FixedArray.

Definition at line 62 of file itkFixedArray.h.

Constructor & Destructor Documentation

◆ FixedArray() [1/8]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::FixedArray ( )
default

Constructors

◆ FixedArray() [2/8]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::FixedArray ( const FixedArray< TValue, VLength > &  )
default

Internal C array representation.

◆ FixedArray() [3/8]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::FixedArray ( FixedArray< TValue, VLength > &&  )
default

Internal C array representation.

◆ ~FixedArray()

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::~FixedArray ( )
default

Internal C array representation.

◆ FixedArray() [4/8]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::FixedArray ( const ValueType  r[VLength])

Conversion constructors

◆ FixedArray() [5/8]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::FixedArray ( const ValueType )

Internal C array representation.

◆ FixedArray() [6/8]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::FixedArray ( const std::array< ValueType, VLength > &  stdArray)
inlineexplicit

Explicit constructor for std::array.

Definition at line 213 of file itkFixedArray.h.

◆ FixedArray() [7/8]

template<typename TValue, unsigned int VLength = 3>
template<typename TFixedArrayValueType >
itk::FixedArray< TValue, VLength >::FixedArray ( const FixedArray< TFixedArrayValueType, VLength > &  r)
inline

Constructor to initialize a fixed array from another of any data type

Definition at line 220 of file itkFixedArray.h.

◆ FixedArray() [8/8]

template<typename TValue, unsigned int VLength = 3>
template<typename TScalarValue >
itk::FixedArray< TValue, VLength >::FixedArray ( const TScalarValue *  r)
inline

Internal C array representation.

Definition at line 231 of file itkFixedArray.h.

Member Function Documentation

◆ Begin() [1/2]

template<typename TValue, unsigned int VLength = 3>
Iterator itk::FixedArray< TValue, VLength >::Begin ( )

Get various iterators to the array.

Referenced by itk::CopyMeshToMeshPoints().

◆ Begin() [2/2]

template<typename TValue, unsigned int VLength = 3>
ConstIterator itk::FixedArray< TValue, VLength >::Begin ( ) const

Internal C array representation.

◆ begin() [1/2]

template<typename TValue, unsigned int VLength = 3>
const_iterator itk::FixedArray< TValue, VLength >::begin ( ) const
inlinenoexcept

Internal C array representation.

Definition at line 358 of file itkFixedArray.h.

◆ begin() [2/2]

template<typename TValue, unsigned int VLength = 3>
iterator itk::FixedArray< TValue, VLength >::begin ( )
inlinenoexcept

Internal C array representation.

Definition at line 352 of file itkFixedArray.h.

◆ cbegin()

template<typename TValue, unsigned int VLength = 3>
const_iterator itk::FixedArray< TValue, VLength >::cbegin ( ) const
inlinenoexcept

◆ cend()

template<typename TValue, unsigned int VLength = 3>
const_iterator itk::FixedArray< TValue, VLength >::cend ( ) const
inlinenoexcept

Internal C array representation.

Definition at line 364 of file itkFixedArray.h.

◆ crbegin()

template<typename TValue, unsigned int VLength = 3>
const_reverse_iterator itk::FixedArray< TValue, VLength >::crbegin ( ) const
inline

Internal C array representation.

Definition at line 388 of file itkFixedArray.h.

◆ crend()

template<typename TValue, unsigned int VLength = 3>
const_reverse_iterator itk::FixedArray< TValue, VLength >::crend ( ) const
inline

Internal C array representation.

Definition at line 406 of file itkFixedArray.h.

◆ End() [1/2]

template<typename TValue, unsigned int VLength = 3>
Iterator itk::FixedArray< TValue, VLength >::End ( )

Internal C array representation.

◆ End() [2/2]

template<typename TValue, unsigned int VLength = 3>
ConstIterator itk::FixedArray< TValue, VLength >::End ( ) const

Internal C array representation.

◆ end() [1/2]

template<typename TValue, unsigned int VLength = 3>
const_iterator itk::FixedArray< TValue, VLength >::end ( ) const
inlinenoexcept

Internal C array representation.

Definition at line 376 of file itkFixedArray.h.

◆ end() [2/2]

template<typename TValue, unsigned int VLength = 3>
iterator itk::FixedArray< TValue, VLength >::end ( )
inlinenoexcept

Internal C array representation.

Definition at line 370 of file itkFixedArray.h.

◆ Fill()

template<typename TValue, unsigned int VLength = 3>
void itk::FixedArray< TValue, VLength >::Fill ( const ValueType )

◆ Filled()

template<typename TValue, unsigned int VLength = 3>
static FixedArray itk::FixedArray< TValue, VLength >::Filled ( const ValueType )
static

Internal C array representation.

◆ GetDataPointer() [1/2]

template<typename TValue, unsigned int VLength = 3>
ValueType* itk::FixedArray< TValue, VLength >::GetDataPointer ( )
inline

◆ GetDataPointer() [2/2]

template<typename TValue, unsigned int VLength = 3>
const ValueType* itk::FixedArray< TValue, VLength >::GetDataPointer ( ) const
inline

Internal C array representation.

Definition at line 319 of file itkFixedArray.h.

◆ GetElement()

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::GetElement ( unsigned int  index) const
inline

Internal C array representation.

Definition at line 305 of file itkFixedArray.h.

◆ itkLegacyMacro() [1/4]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::itkLegacyMacro ( ConstReverseIterator rBegin() const  )

Internal C array representation.

◆ itkLegacyMacro() [2/4]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::itkLegacyMacro ( ConstReverseIterator rEnd() const  )

Internal C array representation.

◆ itkLegacyMacro() [3/4]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::itkLegacyMacro ( ReverseIterator   rBegin())

Internal C array representation.

◆ itkLegacyMacro() [4/4]

template<typename TValue, unsigned int VLength = 3>
itk::FixedArray< TValue, VLength >::itkLegacyMacro ( ReverseIterator   rEnd())

Internal C array representation.

◆ operator!=()

template<typename TValue, unsigned int VLength = 3>
bool itk::FixedArray< TValue, VLength >::operator!= ( const FixedArray< TValue, VLength > &  r) const
inline

Internal C array representation.

Definition at line 260 of file itkFixedArray.h.

◆ operator=() [1/4]

template<typename TValue, unsigned int VLength = 3>
FixedArray& itk::FixedArray< TValue, VLength >::operator= ( const FixedArray< TValue, VLength > &  )
default

Internal C array representation.

◆ operator=() [2/4]

template<typename TValue, unsigned int VLength = 3>
template<typename TFixedArrayValueType >
FixedArray& itk::FixedArray< TValue, VLength >::operator= ( const FixedArray< TFixedArrayValueType, VLength > &  r)
inline

Operator= defined for a variety of types.

Definition at line 239 of file itkFixedArray.h.

◆ operator=() [3/4]

template<typename TValue, unsigned int VLength = 3>
FixedArray& itk::FixedArray< TValue, VLength >::operator= ( const ValueType  r[VLength])

Internal C array representation.

◆ operator=() [4/4]

template<typename TValue, unsigned int VLength = 3>
FixedArray& itk::FixedArray< TValue, VLength >::operator= ( FixedArray< TValue, VLength > &&  )
default

Internal C array representation.

◆ operator==()

template<typename TValue, unsigned int VLength = 3>
bool itk::FixedArray< TValue, VLength >::operator== ( const FixedArray< TValue, VLength > &  r) const

Operators == and != are used to compare whether two arrays are equal. Note that arrays are equal when the number of components (size) is the same, and each component value is equal.

◆ operator[]() [1/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( int  index)
inline

Internal C array representation.

Definition at line 272 of file itkFixedArray.h.

◆ operator[]() [2/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( int  index) const
inline

Internal C array representation.

Definition at line 273 of file itkFixedArray.h.

◆ operator[]() [3/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( long  index)
inline

Internal C array representation.

Definition at line 288 of file itkFixedArray.h.

◆ operator[]() [4/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( long  index) const
inline

Internal C array representation.

Definition at line 289 of file itkFixedArray.h.

◆ operator[]() [5/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( long long  index)
inline

Internal C array representation.

Definition at line 292 of file itkFixedArray.h.

◆ operator[]() [6/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( long long  index) const
inline

Internal C array representation.

Definition at line 293 of file itkFixedArray.h.

◆ operator[]() [7/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( short  index)
inline

Allow the FixedArray to be indexed normally. No bounds checking is done. The separate versions are a work-around for an integer conversion bug in Visual C++.

Definition at line 268 of file itkFixedArray.h.

◆ operator[]() [8/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( short  index) const
inline

Internal C array representation.

Definition at line 269 of file itkFixedArray.h.

◆ operator[]() [9/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned int  index)
inline

Internal C array representation.

Definition at line 281 of file itkFixedArray.h.

◆ operator[]() [10/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned int  index) const
inline

Internal C array representation.

Definition at line 282 of file itkFixedArray.h.

◆ operator[]() [11/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned long  index)
inline

Internal C array representation.

Definition at line 290 of file itkFixedArray.h.

◆ operator[]() [12/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned long  index) const
inline

Internal C array representation.

Definition at line 291 of file itkFixedArray.h.

◆ operator[]() [13/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned long long  index)
inline

Internal C array representation.

Definition at line 294 of file itkFixedArray.h.

◆ operator[]() [14/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned long long  index) const
inline

Internal C array representation.

Definition at line 295 of file itkFixedArray.h.

◆ operator[]() [15/16]

template<typename TValue, unsigned int VLength = 3>
reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned short  index)
inline

Internal C array representation.

Definition at line 270 of file itkFixedArray.h.

◆ operator[]() [16/16]

template<typename TValue, unsigned int VLength = 3>
const_reference itk::FixedArray< TValue, VLength >::operator[] ( unsigned short  index) const
inline

Internal C array representation.

Definition at line 271 of file itkFixedArray.h.

◆ rbegin() [1/2]

template<typename TValue, unsigned int VLength = 3>
reverse_iterator itk::FixedArray< TValue, VLength >::rbegin ( )
inline

Internal C array representation.

Definition at line 382 of file itkFixedArray.h.

◆ rbegin() [2/2]

template<typename TValue, unsigned int VLength = 3>
const_reverse_iterator itk::FixedArray< TValue, VLength >::rbegin ( ) const
inline

Internal C array representation.

Definition at line 394 of file itkFixedArray.h.

◆ rend() [1/2]

template<typename TValue, unsigned int VLength = 3>
reverse_iterator itk::FixedArray< TValue, VLength >::rend ( )
inline

Internal C array representation.

Definition at line 400 of file itkFixedArray.h.

◆ rend() [2/2]

template<typename TValue, unsigned int VLength = 3>
const_reverse_iterator itk::FixedArray< TValue, VLength >::rend ( ) const
inline

Internal C array representation.

Definition at line 412 of file itkFixedArray.h.

◆ SetElement()

template<typename TValue, unsigned int VLength = 3>
void itk::FixedArray< TValue, VLength >::SetElement ( unsigned int  index,
const_reference  value 
)
inline

Set/Get element methods are more convenient in wrapping languages

Definition at line 300 of file itkFixedArray.h.

◆ Size()

template<typename TValue, unsigned int VLength = 3>
SizeType itk::FixedArray< TValue, VLength >::Size ( ) const

Internal C array representation.

◆ swap()

template<typename TValue, unsigned int VLength = 3>
void itk::FixedArray< TValue, VLength >::swap ( FixedArray< TValue, VLength > &  other)
inline

Internal C array representation.

Definition at line 424 of file itkFixedArray.h.

Referenced by itk::swap().

Member Data Documentation

◆ Dimension

template<typename TValue, unsigned int VLength = 3>
constexpr unsigned int itk::FixedArray< TValue, VLength >::Dimension = VLength
staticconstexpr

Dimension constant

Definition at line 59 of file itkFixedArray.h.

◆ Length

template<typename TValue, unsigned int VLength = 3>
constexpr unsigned int itk::FixedArray< TValue, VLength >::Length = VLength
staticconstexpr

◆ m_InternalArray

template<typename TValue, unsigned int VLength = 3>
CArray itk::FixedArray< TValue, VLength >::m_InternalArray
private

Internal C array representation.

Definition at line 431 of file itkFixedArray.h.

Referenced by itk::FixedArray< float, Self::ImageDimension >::swap().


The documentation for this class was generated from the following file: