yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis 2.0.2
BinUtils.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is part of YODA -- Yet more Objects for Data Analysis
4// Copyright (C) 2008-2024 The YODA collaboration (see AUTHORS for details)
5//
6#ifndef YODA_BinUtils_h
7#define YODA_BinUtils_h
8
10
11namespace YODA {
12
15
17 template <class Derived, typename EdgeT = double>
18 struct XBinMixin {
19
22
26 template<typename T = EdgeT>
27 enable_if_CAxisT<T> xMax() const noexcept {
28 return static_cast<const Derived*>(this)->template max<0>();
29 }
30
34 template<typename T = EdgeT>
35 enable_if_CAxisT<T> xMin() const noexcept {
36 return static_cast<const Derived*>(this)->template min<0>();
37 }
38
42 template<typename T = EdgeT>
43 enable_if_CAxisT<T> xMid() const noexcept {
44 return static_cast<const Derived*>(this)->template mid<0>();
45 }
46
50 template<typename T = EdgeT>
51 enable_if_CAxisT<T> xWidth() const noexcept {
52 return static_cast<const Derived*>(this)->template width<0>();
53 }
54
58 template<typename T = EdgeT>
59 enable_if_DAxisT<T> xEdge() const noexcept {
60 return static_cast<const Derived*>(this)->template edge<0>();
61 }
62
64
65 };
66
67
69 template <class Derived, typename EdgeT = double>
70 struct YBinMixin {
71
74
78 template<typename T = EdgeT>
79 enable_if_CAxisT<T> yMax() const noexcept {
80 return static_cast<const Derived*>(this)->template max<1>();
81 }
82
86 template<typename T = EdgeT>
87 enable_if_CAxisT<T> yMin() const noexcept {
88 return static_cast<const Derived*>(this)->template min<1>();
89 }
90
94 template<typename T = EdgeT>
95 enable_if_CAxisT<T> yMid() const noexcept {
96 return static_cast<const Derived*>(this)->template mid<1>();
97 }
98
102 template<typename T = EdgeT>
103 enable_if_CAxisT<T> yWidth() const noexcept {
104 return static_cast<const Derived*>(this)->template width<1>();
105 }
106
110 template<typename T = EdgeT>
111 enable_if_DAxisT<T> yEdge() const noexcept {
112 return static_cast<const Derived*>(this)->template edge<1>();
113 }
114
116
117 };
118
119
121 template <class Derived, typename EdgeT = double>
122 struct ZBinMixin {
123
126
128 template<typename T = EdgeT>
129 enable_if_CAxisT<T> zMax() const noexcept {
130 return static_cast<const Derived*>(this)->template max<2>();
131 }
132
136 template<typename T = EdgeT>
137 enable_if_CAxisT<T> zMin() const noexcept {
138 return static_cast<const Derived*>(this)->template min<2>();
139 }
140
144 template<typename T = EdgeT>
145 enable_if_CAxisT<T> zMid() const noexcept {
146 return static_cast<const Derived*>(this)->template mid<2>();
147 }
148
152 template<typename T = EdgeT>
153 enable_if_CAxisT<T> zWidth() const noexcept {
154 return static_cast<const Derived*>(this)->template width<2>();
155 }
156
160 template<typename T = EdgeT>
161 enable_if_DAxisT<T> zEdge() const noexcept {
162 return static_cast<const Derived*>(this)->template edge<2>();
163 }
164
166
167 };
168
170
171}
172
173#endif
Anonymous namespace to limit visibility.
std::enable_if_t<!std::is_floating_point< EdgeT >::value, EdgeT > enable_if_DAxisT
Checks if edge type is discrete and returns edge type.
std::enable_if_t< std::is_floating_point< EdgeT >::value, EdgeT > enable_if_CAxisT
Checks if edge type is continuous and returns edge type.
CRTP mixin introducing convenience aliases along X axis.
Definition BinUtils.h:18
enable_if_CAxisT< T > xMin() const noexcept
Lower bin edge along X axis.
Definition BinUtils.h:35
enable_if_CAxisT< T > xMax() const noexcept
Upper bin edge along X axis.
Definition BinUtils.h:27
enable_if_CAxisT< T > xMid() const noexcept
Bin centre along X axis.
Definition BinUtils.h:43
enable_if_DAxisT< T > xEdge() const noexcept
Bin edge along X axis.
Definition BinUtils.h:59
enable_if_CAxisT< T > xWidth() const noexcept
Bin width along X axis.
Definition BinUtils.h:51
CRTP mixin introducing convenience aliases along Y axis.
Definition BinUtils.h:70
enable_if_CAxisT< T > yWidth() const noexcept
Bin width along Y axis.
Definition BinUtils.h:103
enable_if_DAxisT< T > yEdge() const noexcept
Bin edge along Y axis.
Definition BinUtils.h:111
enable_if_CAxisT< T > yMax() const noexcept
Upper bin edge along Y axis.
Definition BinUtils.h:79
enable_if_CAxisT< T > yMid() const noexcept
Bin centre along Y axis.
Definition BinUtils.h:95
enable_if_CAxisT< T > yMin() const noexcept
Lower bin edge along Y axis.
Definition BinUtils.h:87
CRTP mixin introducing convenience aliases along Z axis.
Definition BinUtils.h:122
enable_if_CAxisT< T > zMax() const noexcept
Upper bin edge along Z axis.
Definition BinUtils.h:129
enable_if_CAxisT< T > zMid() const noexcept
Bin centre along Z axis.
Definition BinUtils.h:145
enable_if_CAxisT< T > zWidth() const noexcept
Bin width along Z axis.
Definition BinUtils.h:153
enable_if_CAxisT< T > zMin() const noexcept
Lower bin edge along Z axis.
Definition BinUtils.h:137
enable_if_DAxisT< T > zEdge() const noexcept
Bin edge along Z axis.
Definition BinUtils.h:161