Simple-Log  alpha-v0.7
sl::log::ProjectionFilter< TProjection, TUnaryPredicate > Class Template Reference

Combines a projection on Record type with a predicate into an invokable object. More...

#include <Filters.hpp>

Public Types

using Projection_t = std::remove_cvref_t< TProjection >
 
using UnaryPredicate_t = std::remove_cvref_t< TUnaryPredicate >
 

Public Member Functions

constexpr ProjectionFilter (TProjection projection, TUnaryPredicate predicate) noexcept(std::is_nothrow_move_constructible_v< Projection_t > &&std::is_nothrow_move_constructible_v< UnaryPredicate_t >)
 Constructor. More...
 
template<Record TRecord>
constexpr bool operator() (const TRecord &rec)
 Call-operator. More...
 

Detailed Description

template<class TProjection, class TUnaryPredicate>
class sl::log::ProjectionFilter< TProjection, TUnaryPredicate >

Combines a projection on Record type with a predicate into an invokable object.

Template Parameters
TProjectionA Projection type, which has to accept an object of the used Record type and must return something
TUnaryPredicateA predicate type, which accepts objects returned by TProjection

Instances of this class are invokable with any types, which follow the Record concept. Due to possible custom implementations or adjustments ProjectionFilter can't rely on the libraries BaseRecord type and therefore is not able to pre-check the provided Projection and Predicate via concept.

Member Typedef Documentation

◆ Projection_t

template<class TProjection , class TUnaryPredicate >
using sl::log::ProjectionFilter< TProjection, TUnaryPredicate >::Projection_t = std::remove_cvref_t<TProjection>

◆ UnaryPredicate_t

template<class TProjection , class TUnaryPredicate >
using sl::log::ProjectionFilter< TProjection, TUnaryPredicate >::UnaryPredicate_t = std::remove_cvref_t<TUnaryPredicate>

Constructor & Destructor Documentation

◆ ProjectionFilter()

template<class TProjection , class TUnaryPredicate >
constexpr sl::log::ProjectionFilter< TProjection, TUnaryPredicate >::ProjectionFilter ( TProjection  projection,
TUnaryPredicate  predicate 
)
inlineconstexprnoexcept

Constructor.

Parameters
projectionInvokable object
predicatePredicate object

Member Function Documentation

◆ operator()()

template<class TProjection , class TUnaryPredicate >
template<Record TRecord>
constexpr bool sl::log::ProjectionFilter< TProjection, TUnaryPredicate >::operator() ( const TRecord &  rec)
inlineconstexpr

Call-operator.

Template Parameters
TRecordConcrete type of the used Record object
Parameters
recRecord object
Returns
Returns true, if the Record should be handled. False if skipped.

The documentation for this class was generated from the following file: