27#include <fmt/format.h>
53template <
typename Algorithm>
54class iteration_parameter_base {
84 fmt::memory_buffer& buffer, Algorithm* algorithm)
const = 0;
93 fmt::memory_buffer& buffer, Algorithm* algorithm)
const = 0;
100 [[nodiscard]]
virtual auto label() const noexcept -> const
std::
string& = 0;
102 iteration_parameter_base(const iteration_parameter_base&) = delete;
103 iteration_parameter_base(iteration_parameter_base&&) = delete;
104 auto operator=(const iteration_parameter_base&)
105 -> iteration_parameter_base& = delete;
106 auto operator=(iteration_parameter_base&&)
107 -> iteration_parameter_base& = delete;
112 virtual ~iteration_parameter_base() noexcept = default;
118 iteration_parameter_base() noexcept = default;
134template <typename Algorithm,
135 concepts::formattable_iteration_parameter_value Value,
136 concepts::iteration_parameter_value<Algorithm, Value> ParameterValue>
154 fmt::format_to(std::back_inserter(buffer),
"{0: >{1}}",
label_,
width_);
173 buffer.push_back(
'=');
184 fmt::memory_buffer& buffer, Algorithm* algorithm)
const override {
195 fmt::memory_buffer& buffer, Algorithm* algorithm)
const override {
197 buffer.push_back(
'=');
206 [[nodiscard]]
auto label() const noexcept -> const
std::
string&
override {
217 if (value <= 0) [[unlikely]] {
Class of exception on invalid arguments.
virtual void format_summary_to(fmt::memory_buffer &buffer) const =0
Format the summary.
virtual auto label() const noexcept -> const std::string &=0
Get the label of this parameter.
virtual void format_label_to(fmt::memory_buffer &buffer) const =0
Format the label with alignment.
virtual void format_value_to(fmt::memory_buffer &buffer) const =0
Format the value with alignment.
virtual void format_summary_to(fmt::memory_buffer &buffer, Algorithm *algorithm) const =0
Format the summary.
virtual void format_value_to(fmt::memory_buffer &buffer, Algorithm *algorithm) const =0
Format the value with alignment.
void format_label_to(fmt::memory_buffer &buffer) const override
Format the label with alignment.
iteration_parameter(std::string label, ParameterValue value)
Constructor.
void format_summary_to(fmt::memory_buffer &buffer) const override
Format the summary.
auto label() const noexcept -> const std::string &override
Get the label of this parameter.
ParameterValue value_
Parameter value.
void format_summary_to(fmt::memory_buffer &buffer, Algorithm *algorithm) const override
Format the summary.
iteration_parameter_formatter< Value > formatter_
Formatter.
void format_value_to(fmt::memory_buffer &buffer, Algorithm *algorithm) const override
Format the value with alignment.
void format_value_to(fmt::memory_buffer &buffer) const override
Format the value with alignment.
auto formatter() -> iteration_parameter_formatter< Value > &
Access the formatter.
auto width(index_type value) -> iteration_parameter *
Set width.
auto width() const -> index_type
Get width.
Definition of exceptions.
Definition of index_type type.
Definition of iteration_parameter_value concept.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of C++ concepts.
Namespace of internal implementations.
constexpr index_type iteration_parameter_default_width
Default width in .num_collect::logging::iterations::iteration_parameter.
Namespace of iteration logs.