Tomographer  v1.0a
Tomographer C++ Framework Documentation
Tomographer::Tools::static_or_dynamic< T_, Value > Class Template Reference

A type which stores a value possibly known at compile-time. More...

#include <tomographer/tools/util.h>

+ Inheritance diagram for Tomographer::Tools::static_or_dynamic< T_, Value >:

Public Types

typedef T_ T
 Type of the value we are storing.
 

Public Member Functions

 static_or_dynamic ()
 Default Constructor. Only if the value is stored at compile-time.
 
 static_or_dynamic (T val)
 Constructor with an explicit value. More...
 
T value () const
 Get the value stored. More...
 
T operator() () const
 Get the value stored. More...
 

Static Public Attributes

static constexpr T ValueAtCTime = Value
 The value, if stored at compile-time, or Eigen::Dynamic.
 

Detailed Description

template<typename T_, int Value>
class Tomographer::Tools::static_or_dynamic< T_, Value >

A type which stores a value possibly known at compile-time.

This is an implementation inspired by Eigen's mechanism of compile-time known matrix/vector sizes.

This class declares a private member property which stores a dynamic value given to the constructor, except if a value was already given as template parameter in which case we take for granted that this value will always be the one we want at runtime.

Template Parameters
Tthe type of the value to store.
Valuethe (integer) value to store at compile-time. If this value is Eigen::Dynamic, then the value will be stored at runtime.

Definition at line 145 of file util.h.

Constructor & Destructor Documentation

template<typename T_, int Value>
Tomographer::Tools::static_or_dynamic< T_, Value >::static_or_dynamic ( T  val)
inlineexplicit

Constructor with an explicit value.

The value val must equal the compile-time fixed value, if any, or you'll get an assert failure.

Definition at line 160 of file util.h.

Member Function Documentation

template<typename T_, int Value>
T Tomographer::Tools::static_or_dynamic< T_, Value >::operator() ( ) const
inline

Get the value stored.

The same syntax works both for dynamic and compile-time storage.

Definition at line 175 of file util.h.

template<typename T_, int Value>
T Tomographer::Tools::static_or_dynamic< T_, Value >::value ( ) const
inline

Get the value stored.

The same syntax works both for dynamic and compile-time storage.

Definition at line 169 of file util.h.


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