Belle II Software  release-08-01-10
ContinuousValue.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <array>
11 
12 namespace Belle2 {
17  namespace TrackFindingCDC {
18 
20  template<class T, class ATag = T>
22  public:
25 
27  ContinuousValue() = default;
28 
30  explicit ContinuousValue(const T& value) : m_value(value) {};
31 
33  operator const T& () const {return m_value; }
34 
36  using Array = std::array<T, 2>;
37 
39  static
40  std::array<This, 2> getRange(const Array& bounds)
41  { return {{ This(bounds.front()), This(bounds.back()) }}; }
42 
43  private:
46  };
47 
48  }
50 }
Type to have values not based on discrete positions from an array.
ContinuousValue< T, ATag > This
Shortcut for the class itself.
std::array< T, 2 > Array
Mock array type to be a drop in replacement for the discrete values.
ContinuousValue()=default
Allow default construction.
ContinuousValue(const T &value)
Constructor from the underlying type.
static std::array< This, 2 > getRange(const Array &bounds)
Extract the range from an array providing the discrete values.
T m_value
Memory for the underlying value.
Abstract base class for different kinds of events.