VTK  9.4.20241123
Public Member Functions | List of all members
vtkTuple< T, Size > Class Template Reference

templated base type for containers of constant size. More...

#include <vtkTuple.h>

Inheritance diagram for vtkTuple< T, Size >:
[legend]

Public Member Functions

 vtkTuple ()=default
 The default constructor does not initialize values.
 
 vtkTuple (const T &scalar)
 Initialize all of the tuple's elements with the supplied scalar.
 
 vtkTuple (const T *init)
 Initialize the tuple's elements with the elements of the supplied array.
 
 vtkTuple (const std::array< T, Size > &values)
 Initialize the tuple's elements using a std::array for matching type and size.
 
int GetSize () const
 Get the size of the tuple.
 
T * GetData ()
 Get a pointer to the underlying data of the tuple.
 
const T * GetData () const
 
T & operator[] (int i)
 Get a reference to the underlying data element of the tuple.
 
const T & operator[] (int i) const
 
operator() (int i) const
 Get the value of the tuple at the index specified.
 
bool Compare (const vtkTuple< T, Size > &other, const T &tol) const
 Equality operator with a tolerance to allow fuzzy comparisons.
 
template<typename TR >
vtkTuple< TR, Size > Cast () const
 Cast the tuple to the specified type, returning the result.
 

Protected Attributes

Data [Size]
 The only thing stored in memory!
 

Detailed Description

template<typename T, int Size>
class vtkTuple< T, Size >

templated base type for containers of constant size.

This class is a templated data type for storing and manipulating tuples.

Definition at line 26 of file vtkTuple.h.

Constructor & Destructor Documentation

◆ vtkTuple() [1/4]

template<typename T , int Size>
vtkTuple< T, Size >::vtkTuple ( )
default

The default constructor does not initialize values.

If initializtion is desired, this should be done explicitly using the constructors for scalar initialization, or other suitable constructors taking arguments.

◆ vtkTuple() [2/4]

template<typename T , int Size>
vtkTuple< T, Size >::vtkTuple ( const T &  scalar)
inlineexplicit

Initialize all of the tuple's elements with the supplied scalar.

Definition at line 39 of file vtkTuple.h.

◆ vtkTuple() [3/4]

template<typename T , int Size>
vtkTuple< T, Size >::vtkTuple ( const T *  init)
inlineexplicit

Initialize the tuple's elements with the elements of the supplied array.

Note that the supplied pointer must contain at least as many elements as the tuple, or it will result in access to out of bounds memory.

Definition at line 52 of file vtkTuple.h.

◆ vtkTuple() [4/4]

template<typename T , int Size>
vtkTuple< T, Size >::vtkTuple ( const std::array< T, Size > &  values)
inlineexplicit

Initialize the tuple's elements using a std::array for matching type and size.

Example usage: vtkTuple<double, 2 >({0.1, 0.2}).

Definition at line 64 of file vtkTuple.h.

Member Function Documentation

◆ GetSize()

template<typename T , int Size>
int vtkTuple< T, Size >::GetSize ( ) const
inline

Get the size of the tuple.

Definition at line 72 of file vtkTuple.h.

◆ GetData() [1/2]

template<typename T , int Size>
T * vtkTuple< T, Size >::GetData ( )
inline

Get a pointer to the underlying data of the tuple.

Definition at line 77 of file vtkTuple.h.

◆ GetData() [2/2]

template<typename T , int Size>
const T * vtkTuple< T, Size >::GetData ( ) const
inline

Definition at line 78 of file vtkTuple.h.

◆ operator[]() [1/2]

template<typename T , int Size>
T & vtkTuple< T, Size >::operator[] ( int  i)
inline

Get a reference to the underlying data element of the tuple.

This works similarly to the way C++ STL containers work. No bounds checking is performed.

Definition at line 85 of file vtkTuple.h.

◆ operator[]() [2/2]

template<typename T , int Size>
const T & vtkTuple< T, Size >::operator[] ( int  i) const
inline

Definition at line 86 of file vtkTuple.h.

◆ operator()()

template<typename T , int Size>
T vtkTuple< T, Size >::operator() ( int  i) const
inline

Get the value of the tuple at the index specified.

Does bounds checking, similar to the at(i) method of C++ STL containers, but only when the code is compiled in debug mode.

Definition at line 94 of file vtkTuple.h.

◆ Compare()

template<typename T , int Size>
bool vtkTuple< T, Size >::Compare ( const vtkTuple< T, Size > &  other,
const T &  tol 
) const
inline

Equality operator with a tolerance to allow fuzzy comparisons.

Definition at line 105 of file vtkTuple.h.

◆ Cast()

template<typename T , int Size>
template<typename TR >
vtkTuple< TR, Size > vtkTuple< T, Size >::Cast ( ) const
inline

Cast the tuple to the specified type, returning the result.

Definition at line 127 of file vtkTuple.h.

Member Data Documentation

◆ Data

template<typename T , int Size>
T vtkTuple< T, Size >::Data[Size]
protected

The only thing stored in memory!

Definition at line 143 of file vtkTuple.h.


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