Tomographer  v5.2
Tomographer C++ Framework Documentation
Tomographer::MultiplexorValueCalculator< ValueType_, ValueCalculators > Class Template Reference

A ValueCalculator-instance which the choice of which ValueCalculator to use at run-time. More...

#include <tomographer/valuecalculator.h>

+ Inheritance diagram for Tomographer::MultiplexorValueCalculator< ValueType_, ValueCalculators >:
+ Collaboration diagram for Tomographer::MultiplexorValueCalculator< ValueType_, ValueCalculators >:

Public Types

typedef ValueType_ ValueType
 
typedef std::tuple< ValueCalculators... > ValueCalculatorsTupleType
 

Public Member Functions

template<typename... CreatorFns>
 MultiplexorValueCalculator (const int i, CreatorFns &&... creators)
 Constructor. More...
 
 ~MultiplexorValueCalculator ()
 Destructor. Frees resources.
 
 MultiplexorValueCalculator (const MultiplexorValueCalculator &other)
 Copy constructor. More...
 
template<int I>
const std::tuple_element< I, ValueCalculatorsTupleType >::type * getValueCalculator () const
 Get a particular value calculator [static index].
 
template<typename PointType >
ValueType getValue (PointType &&x) const
 The main method which computes the value according to the pre-chosen ValueCalculator. More...
 

Static Public Attributes

static constexpr int NumValueCalculators = sizeof...(ValueCalculators)
 
static constexpr int NumStaticallyOptimizedIfs = 6
 

Detailed Description

template<typename ValueType_, typename... ValueCalculators>
class Tomographer::MultiplexorValueCalculator< ValueType_, ValueCalculators >

A ValueCalculator-instance which the choice of which ValueCalculator to use at run-time.

Since
Changed in Tomographer 5.0: Design slightly different; not all value calculators are instantiated; Constructor now takes lambdas (or callables) which can create individual value calculators.

Definition at line 222 of file valuecalculator.h.

Constructor & Destructor Documentation

§ MultiplexorValueCalculator() [1/2]

template<typename ValueType_ , typename... ValueCalculators>
template<typename... CreatorFns>
Tomographer::MultiplexorValueCalculator< ValueType_, ValueCalculators >::MultiplexorValueCalculator ( const int  i,
CreatorFns &&...  creators 
)
inline

Constructor.

The first parameter, i, selects which value calculator is applied. (The whole idea is that this value can be selected at run-time.)

Specify as argument a list of callables, which are responsible for creating each value calculator. Each callable should take no arguments and create a ValueCalculator of the corresponding type using the new operator. Only the callable corresponding to the chosen i will be called. The created ValueCalculator will be automatically deleted.

Definition at line 307 of file valuecalculator.h.

§ MultiplexorValueCalculator() [2/2]

template<typename ValueType_ , typename... ValueCalculators>
Tomographer::MultiplexorValueCalculator< ValueType_, ValueCalculators >::MultiplexorValueCalculator ( const MultiplexorValueCalculator< ValueType_, ValueCalculators > &  other)
inline

Copy constructor.

Create the corresponding valcalc using its copy constructor

Definition at line 326 of file valuecalculator.h.

Member Function Documentation

§ getValue()

template<typename ValueType_ , typename... ValueCalculators>
template<typename PointType >
ValueType Tomographer::MultiplexorValueCalculator< ValueType_, ValueCalculators >::getValue ( PointType &&  x) const
inline

The main method which computes the value according to the pre-chosen ValueCalculator.

Calculates the value according to the ValueCalculator instance which was chosen at constructor-time (via the index i).

Definition at line 347 of file valuecalculator.h.


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