numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class to write logs of iterations. More...
#include <num_collect/logging/iterations/iteration_logger.h>
Public Member Functions | |
iteration_logger (logger &logger) | |
Constructor. | |
void | append (std::shared_ptr< iteration_parameter_base< Algorithm > > parameter) |
Append a parameter. | |
template<concepts::formattable_iteration_parameter_value Value> | |
auto | append (std::string label, const Value &value) -> iteration_parameter< Algorithm, Value, variable_iteration_parameter_value< Algorithm, Value > > * |
Append a parameter specified by variables. | |
template<concepts::formattable_iteration_parameter_value Value> | |
auto | append (std::string label, const Value Algorithm::*ptr) -> iteration_parameter< Algorithm, Value, member_variable_iteration_parameter_value< Algorithm, Value > > * |
Append a parameter specified by member variables. | |
template<concepts::formattable_iteration_parameter_value Value, concepts::getter_of< Value > Function> | |
auto | append (std::string label, Function &&function) -> iteration_parameter< Algorithm, Value, function_iteration_parameter_value< Algorithm, Value, std::decay_t< Function > > > * |
Append a parameter specified by functions. | |
template<concepts::formattable_iteration_parameter_value Value, concepts::member_getter_of< Value, Algorithm > Function> | |
auto | append (std::string label, Function &&function) -> iteration_parameter< Algorithm, Value, member_function_iteration_parameter_value< Algorithm, Value, std::decay_t< Function > > > * |
Append a parameter specified by member functions. | |
template<concepts::formattable_iteration_parameter_value Value, concepts::iteration_parameter_value< Algorithm, Value > ParameterValue> | |
auto | append (std::string label, ParameterValue value) -> iteration_parameter< Algorithm, Value, ParameterValue > * |
Append a parameter. | |
void | start (logger &logger) |
Start iterations. | |
void | write_iteration (Algorithm *algorithm, util::source_info_view source=util::source_info_view()) |
Write an iteration to the logger. | |
void | write_iteration (util::source_info_view source=util::source_info_view()) |
Write an iteration to the logger. | |
void | write_summary (Algorithm *algorithm, util::source_info_view source=util::source_info_view()) |
Write a summary to a logger. | |
void | write_summary (util::source_info_view source=util::source_info_view()) |
Write a summary to a logger. | |
Private Member Functions | |
void | format_labels_to (fmt::memory_buffer &buffer) const |
Format a line of labels. | |
void | format_summary_to (fmt::memory_buffer &buffer) const |
Format a line of summary. | |
void | format_summary_to (fmt::memory_buffer &buffer, Algorithm *algorithm) const |
Format a line of summary. | |
void | format_values_to (fmt::memory_buffer &buffer) const |
Format a line of values. | |
void | format_values_to (fmt::memory_buffer &buffer, Algorithm *algorithm) const |
Format a line of values. | |
auto | should_write_iteration () -> bool |
Determine whether to write an iteration to the logger. | |
void | write_label_if_needed (util::source_info_view source) |
Write labels if needed. | |
Private Attributes | |
fmt::memory_buffer | buffer_ {} |
Buffer of logging data. | |
util::iteration_period_checker | iteration_label_period_checker_ |
Checker of periods to write labels of iteration logs. | |
util::iteration_period_checker | iteration_output_period_checker_ |
Checker of periods to write iteration logs. | |
std::vector< std::shared_ptr< iteration_parameter_base< Algorithm > > > | parameters_ {} |
Parameters. | |
sinks::log_sink | sink_ |
Log sink. | |
log_tag_view | tag_ |
Log tag. | |
bool | write_iterations_ {false} |
Whether to write iteration logs. | |
bool | write_summaries_ {false} |
Whether to write summary logs. | |
Class to write logs of iterations.
Algorithm | Type of the algorithm. If the pointer of an algorithm is not used, this template parameter can be any type as the default type. |
Definition at line 59 of file iteration_logger.h.
|
inlineexplicit |
|
inline |
Append a parameter.
[in] | parameter | Parameter. |
Definition at line 93 of file iteration_logger.h.
|
inline |
Append a parameter specified by variables.
Value | Type of values. |
[in] | label | Label. |
[in] | value | Parameter value. |
Definition at line 129 of file iteration_logger.h.
|
inline |
Append a parameter specified by member variables.
Value | Type of values. |
[in] | label | Label. |
[in] | ptr | Pointer to the member variable. |
Definition at line 165 of file iteration_logger.h.
|
inline |
Append a parameter specified by functions.
Value | Type of values. |
Function | Type of the function. |
[in] | label | Label. |
[in] | function | Function to get values. |
Definition at line 147 of file iteration_logger.h.
|
inline |
Append a parameter specified by member functions.
Value | Type of values. |
Function | Type of the function. |
[in] | label | Label. |
[in] | function | Pointer to the member function. |
Definition at line 183 of file iteration_logger.h.
|
inline |
Append a parameter.
Value | Type of values. |
ParameterValue | Class of parameters values in iterations specified by variables. |
[in] | label | Label. |
[in] | value | Parameter value. |
Definition at line 110 of file iteration_logger.h.
|
inlineprivate |
Format a line of labels.
[out] | buffer | Buffer to format to. |
Definition at line 314 of file iteration_logger.h.
|
inlineprivate |
Format a line of summary.
[out] | buffer | Buffer to format to. |
Definition at line 352 of file iteration_logger.h.
|
inlineprivate |
Format a line of summary.
[out] | buffer | Buffer to format to. |
[in] | algorithm | Algorithm. |
Definition at line 372 of file iteration_logger.h.
|
inlineprivate |
Format a line of values.
[out] | buffer | Buffer to format to. |
Definition at line 326 of file iteration_logger.h.
|
inlineprivate |
Format a line of values.
[out] | buffer | Buffer to format to. |
[in] | algorithm | Algorithm. |
Definition at line 339 of file iteration_logger.h.
|
inlinenodiscardprivate |
Determine whether to write an iteration to the logger.
Definition at line 280 of file iteration_logger.h.
|
inline |
|
inline |
Write an iteration to the logger.
[in] | algorithm | Algorithm. |
[in] | source | Information of the source code. |
Definition at line 223 of file iteration_logger.h.
|
inline |
Write an iteration to the logger.
[in] | source | Information of the source code. |
Definition at line 199 of file iteration_logger.h.
|
inlineprivate |
Write labels if needed.
[in] | source | Information of the source code. |
Definition at line 298 of file iteration_logger.h.
|
inline |
Write a summary to a logger.
[in] | algorithm | Algorithm. |
[in] | source | Information of the source code. |
Definition at line 262 of file iteration_logger.h.
|
inline |
Write a summary to a logger.
[in] | source | Information of the source code. |
Definition at line 244 of file iteration_logger.h.
|
private |
Buffer of logging data.
Definition at line 410 of file iteration_logger.h.
|
private |
Checker of periods to write labels of iteration logs.
Definition at line 403 of file iteration_logger.h.
|
private |
Checker of periods to write iteration logs.
Definition at line 400 of file iteration_logger.h.
|
private |
Parameters.
Definition at line 407 of file iteration_logger.h.
|
private |
Log sink.
Definition at line 397 of file iteration_logger.h.
|
private |
Log tag.
Definition at line 388 of file iteration_logger.h.
|
private |
Whether to write iteration logs.
Definition at line 391 of file iteration_logger.h.
|
private |
Whether to write summary logs.
Definition at line 394 of file iteration_logger.h.