27#include <fmt/format.h>
53template <
typename Algorithm>
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;
134template <typename Algorithm,
135 concepts::formattable_iteration_parameter_value Value,
136 concepts::iteration_parameter_value<Algorithm, Value> ParameterValue>
146 : label_(
std::move(
label)), value_(
std::move(value)) {}
154 fmt::format_to(std::back_inserter(buffer),
"{0: >{1}}", label_, width_);
163 formatter_.format_with_alignment(value_.get(), width_, buffer);
172 buffer.append(label_);
173 buffer.push_back(
'=');
174 formatter_.format(value_.get(), buffer);
184 fmt::memory_buffer& buffer, Algorithm* algorithm)
const override {
185 formatter_.format_with_alignment(value_.get(algorithm), width_, buffer);
195 fmt::memory_buffer& buffer, Algorithm* algorithm)
const override {
196 buffer.append(label_);
197 buffer.push_back(
'=');
198 formatter_.format(value_.get(algorithm), buffer);
206 [[nodiscard]]
auto label() const noexcept -> const
std::
string&
override {
217 if (value <= 0) [[unlikely]] {
Class of exception on invalid arguments.
Base class of parameters in iterations.
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.
Class of parameters in iterations.
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.
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.
constexpr index_type iteration_parameter_default_width
Default width in .num_collect::logging::iterations::iteration_parameter.
Namespace of iteration logs.