|
| FlushPolicy (TPredicate predicate=Predicate_t{}, TProjection projection=Projection_t{}, TInvocationRule invocation=InvocationRule_t{}) noexcept(std::is_nothrow_move_constructible_v< TPredicate > &&std::is_nothrow_move_constructible_v< TProjection > &&std::is_nothrow_move_constructible_v< TInvocationRule >) |
| Constructor. More...
|
|
template<class... TArgs> |
requires std::constructible_from< Predicate_t, TArgs... > | FlushPolicy (std::in_place_t _, TArgs &&... args) noexcept(std::is_nothrow_constructible_v< TPredicate, TArgs... > &&std::is_nothrow_constructible_v< TProjection > &&std::is_nothrow_constructible_v< TInvocationRule >) |
| Constructor overload for in_place predicate initializing. More...
|
|
template<Record TRecord> |
bool | operator() (const TRecord &record, std::size_t messageByteSize) |
| Invoke operator. More...
|
|
constexpr void | flushed () const noexcept |
| NoOp. More...
|
|
template<class TPredicate, class TProjection = std::identity, class TInvocationRule = detail::PredProjInvocation>
class sl::log::FlushPolicy< TPredicate, TProjection, TInvocationRule >
A customizable FlushPolicy class.
- Template Parameters
-
TPredicate | The predicate must be invokable with the result of TProjection and must boolean-comparable results. |
TProjection | The projection must be invokable with the used Record type and must return something non-void. |
TInvocationRule | This type is used for internal determination how to chain the invocations. |
This is a customizable class when a Flush-Policy does not carrie any internal state which has to be reset after flushing happened. In other words, users can pass any type of predicate, which fulfills the requirements, but will never receive the flushed() signal. If you need to act on that signal, users can simply write their own FlushPolicy class. There is no base class FlushPolicies must inherit from. Additionally it is possible to use a projection, which will be invoked before the actual predicate. This projection must accept an object of the used Record type as single parameter.