VTK  9.4.20241117
Public Member Functions | Public Attributes | List of all members
vtkConstantImplicitBackend< ValueType > Struct Template Referencefinal

A utility structure serving as a backend for constant implicit arrays. More...

#include <vtkConstantImplicitBackend.h>

Public Member Functions

 vtkConstantImplicitBackend (ValueType val)
 A non-trivially contructible constructor.
 
ValueType operator() (vtkIdType vtkNotUsed(index)) const
 The main call method for the backend.
 

Public Attributes

const ValueType Value
 The constant value stored in the backend.
 

Detailed Description

template<typename ValueType>
struct vtkConstantImplicitBackend< ValueType >

A utility structure serving as a backend for constant implicit arrays.

This structure can be classified as a closure and can be called using syntax similar to a function.

At construction it takes one parameter which is the constant value that it returns from its main function call regardless of index.

An example of potential usage in a vtkImplicitArray

double constant = some_number;
constArray->SetBackend(std::make_shared<vtkConstantImplicitBackend<double>>(constant));
constArray->SetNumberOfTuples(however_many_you_want);
constArray->SetNumberOfComponents(whatever_youd_like);
double value = constArray->GetTypedComponent(index_in_tuple_range, index_in_component_range);
CHECK(constant == value); // always true
Allocate and hold a VTK object.
Definition vtkNew.h:167
A utility structure serving as a backend for constant implicit arrays.

Definition at line 35 of file vtkConstantImplicitBackend.h.

Constructor & Destructor Documentation

◆ vtkConstantImplicitBackend()

template<typename ValueType >
vtkConstantImplicitBackend< ValueType >::vtkConstantImplicitBackend ( ValueType  val)
inline

A non-trivially contructible constructor.

Parameters
valthe constant value to return for all indices

Definition at line 42 of file vtkConstantImplicitBackend.h.

Member Function Documentation

◆ operator()()

template<typename ValueType >
ValueType vtkConstantImplicitBackend< ValueType >::operator() ( vtkIdType   vtkNotUsedindex) const
inline

The main call method for the backend.

Returns
the constant value

Definition at line 52 of file vtkConstantImplicitBackend.h.

Member Data Documentation

◆ Value

template<typename ValueType >
const ValueType vtkConstantImplicitBackend< ValueType >::Value

The constant value stored in the backend.

Definition at line 57 of file vtkConstantImplicitBackend.h.


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