Tomographer
v5.4
Tomographer C++ Framework Documentation
|
A ValueCalculator implementation which the choice of which ValueCalculator to use at run-time. More...
#include <tomographer/valuecalculator.h>
Public Types | |
typedef ValueType_ | ValueType |
Value type returned by getValue() (see ValueCalculator Interface) | |
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] (const) More... | |
template<int I> | |
std::tuple_element< I, ValueCalculatorsTupleType >::type * | getValueCalculator () |
Get a particular value calculator [static index] (non-const) More... | |
template<typename PointType > | |
ValueType | getValue (PointType &&x) const |
The main method which computes the value according to the pre-chosen ValueCalculator (const version) More... | |
template<typename PointType > | |
ValueType | getValue (PointType &&x) |
The main method which computes the value according to the pre-chosen ValueCalculator (non-const version) More... | |
Static Public Attributes | |
static constexpr int | NumValueCalculators = sizeof...(ValueCalculators) |
Number of ValueCalculators given as template parameters. | |
static constexpr int | NumStaticallyOptimizedIfs = 6 |
Internal implementation detail, don't use. | |
A ValueCalculator implementation which the choice of which ValueCalculator to use at run-time.
A MultiplexorValueCalculator is a proxy ValueCalculator (which you can use, e.g., in ValueHistogramMHRWStatsCollector), which allows you to choose one among several ValueCalculator types to use at runtime. The possible choices of ValueCalculator s has to be defined at compile-time as template parameters. The constructor of the MultiplexorValueCalculator takes as many "creator functions" as defined ValueCalculator types, and calls only the one which we'd like to use.
The choice of the ValueCalculator is fixed upon instantiation of the MultiplexorValueCalculator. I.e., once decided, the choice of which ValueCalculator to use cannot be changed.
ValueType | the ValueType returned by the MultiplexorValueCalculator's getValue(). All ValueCalculator s must have ValueTypes which can be implicitily converted to this type. (See ValueCalculator Interface) |
ValueCalculators... | The list of ValueCalculator types among which to choose at runtime. |
For example, if you woule like to leave open at compile-time whether to use a TrDistToRefCalculator or a FidelityToRefCalculator, you could write something along the lines of:
Definition at line 276 of file valuecalculator.h.
|
inline |
Constructor.
The first parameter i selects which value calculator is applied, given as an index in the list of possible ValueCalculators (starting at zero, of course).
The creators... are a list of callables which are responsible for instantiating the required 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 379 of file valuecalculator.h.
|
inline |
Copy constructor.
Create the corresponding valcalc using its copy constructor
Definition at line 398 of file valuecalculator.h.
|
inline |
The main method which computes the value according to the pre-chosen ValueCalculator (const version)
Calculates the value according to the ValueCalculator instance which was chosen at constructor-time (via the index i).
Definition at line 438 of file valuecalculator.h.
|
inline |
The main method which computes the value according to the pre-chosen ValueCalculator (non-const version)
Calculates the value according to the ValueCalculator instance which was chosen at constructor-time (via the index i).
Definition at line 452 of file valuecalculator.h.
|
inline |
Get a particular value calculator [static index] (const)
Definition at line 409 of file valuecalculator.h.
|
inline |
Get a particular value calculator [static index] (non-const)
Definition at line 423 of file valuecalculator.h.