| 1 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 2 |
// Author: Kristian Lytje |
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <constants/Constants.h> |
| 7 |
#include <settings/Flags.h> |
| 8 |
|
| 9 |
namespace ausaxs::hist::detail { |
| 10 |
struct ConstantWidth { |
| 11 |
static consteval float get() {return 1./ausaxs::constants::axes::d_axis.width();} |
| 12 |
}; |
| 13 |
|
| 14 |
struct VariableWidth { |
| 15 |
static float get() {return settings::flags::inv_bin_width;} |
| 16 |
}; |
| 17 |
|
| 18 |
template<bool variable_bin_width> |
| 19 |
struct WidthController { |
| 20 |
constexpr static float get_inv_width() { |
| 21 |
if constexpr (variable_bin_width) { |
| 22 |
return VariableWidth::get(); |
| 23 |
} else { |
| 24 |
return ConstantWidth::get(); |
| 25 |
} |
| 26 |
} |
| 27 |
}; |
| 28 |
} |