template<template< class... > class Writer, class... Loggers>
class mio::History< Writer, Loggers >
History class that handles writers and loggers.
History provides a function "log" to add a new record and a function "get_log" to access all records.
The History class uses Loggers to retrieve data from a given input, and a Writer to record this data. A Logger is a struct with a type Type and functions Type log(const T&) and bool should_log(const T&). All Loggers must be unique types and default construcible/destructible. Their member "should_log" indicates whether to log, while "Type" and "log" determine what is logged. The input for "should_log" and "log" is the same input of type T that is given to "History::log". (Note: T does not have to be a template for a Logger implementation.) The Writer defines the type Data to store all records (i.e. the return values of Logger::log), and the function template <class Logger> static void add_record(const Logger::Type&, Data&) to add a new record. "add_record" is used whenever "History::log" was called and "Logger::should_log" is true.
- Template Parameters
-
| Writer | The writer that is used to handle the data, e.g. store it into an array. |
| Loggers | The loggers that are used to log data. |
template<template< class... > class Writer, class... Loggers>
template<class T , class Logger >
| void mio::History< Writer, Loggers >::log_impl |
( |
const T & |
t, |
|
|
Logger & |
logger |
|
) |
| |
|
inlineprivate |
Checks if the given logger should log.
If so, adds a record of the log to m_data.
- Parameters
-
| [in] | t | The argument given to History::log. Passed to Logger::should_log and Logger::log. |
| [in] | logger | A Logger instance. |
- Template Parameters
-
| Logger | A logger from the list Loggers. |