Simple-Log  alpha-v0.7
sl::log::ScopedSinkDisabling< TRecord, TSink > Class Template Reference

Wrapper class which disables Sinks on construction and enables them on destruction. More...

#include <ISink.hpp>

Public Member Functions

 ScopedSinkDisabling (TSink &sink) noexcept
 Constructor which disables passed sink. More...
 
 ~ScopedSinkDisabling () noexcept
 Constructor which enables passed sink. More...
 
 ScopedSinkDisabling (const ScopedSinkDisabling &)=delete
 Deleted copy constructor. More...
 
ScopedSinkDisablingoperator= (const ScopedSinkDisabling &)=delete
 Deleted copy-assign operator. More...
 
 ScopedSinkDisabling (ScopedSinkDisabling &&other) noexcept
 Move constructor. More...
 
ScopedSinkDisablingoperator= (ScopedSinkDisabling &&other) noexcept
 Move-assign operator. More...
 
TSink & operator* () const noexcept
 Dereferencing operator. More...
 
TSink * operator-> () const noexcept
 Dereferencing operator. More...
 
TSink * get () const noexcept
 Returns a pointer to the Sink instance. More...
 

Detailed Description

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
class sl::log::ScopedSinkDisabling< TRecord, TSink >

Wrapper class which disables Sinks on construction and enables them on destruction.

Template Parameters
TRecordRecord type
TSinkSink type

This helper class is useful when you want to get sure, that your Sinks will be finally setup before they are going to handle any records. Instances of this class are movable but not copyable.

Constructor & Destructor Documentation

◆ ScopedSinkDisabling() [1/3]

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
sl::log::ScopedSinkDisabling< TRecord, TSink >::ScopedSinkDisabling ( TSink &  sink)
inlineexplicitnoexcept

Constructor which disables passed sink.

Parameters
sink

◆ ~ScopedSinkDisabling()

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
sl::log::ScopedSinkDisabling< TRecord, TSink >::~ScopedSinkDisabling ( )
inlinenoexcept

Constructor which enables passed sink.

◆ ScopedSinkDisabling() [2/3]

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
sl::log::ScopedSinkDisabling< TRecord, TSink >::ScopedSinkDisabling ( const ScopedSinkDisabling< TRecord, TSink > &  )
delete

Deleted copy constructor.

◆ ScopedSinkDisabling() [3/3]

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
sl::log::ScopedSinkDisabling< TRecord, TSink >::ScopedSinkDisabling ( ScopedSinkDisabling< TRecord, TSink > &&  other)
inlinenoexcept

Move constructor.

Member Function Documentation

◆ get()

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
TSink* sl::log::ScopedSinkDisabling< TRecord, TSink >::get ( ) const
inlinenoexcept

Returns a pointer to the Sink instance.

Returns
Pointer to the wrapped Sink instance.

◆ operator*()

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
TSink& sl::log::ScopedSinkDisabling< TRecord, TSink >::operator* ( ) const
inlinenoexcept

Dereferencing operator.

Returns
Reference to the wrapped Sink instance.

◆ operator->()

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
TSink* sl::log::ScopedSinkDisabling< TRecord, TSink >::operator-> ( ) const
inlinenoexcept

Dereferencing operator.

Returns
Pointer to the wrapped Sink instance.

◆ operator=() [1/2]

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
ScopedSinkDisabling& sl::log::ScopedSinkDisabling< TRecord, TSink >::operator= ( const ScopedSinkDisabling< TRecord, TSink > &  )
delete

Deleted copy-assign operator.

◆ operator=() [2/2]

template<Record TRecord, std::derived_from< ISink< TRecord >> TSink>
ScopedSinkDisabling& sl::log::ScopedSinkDisabling< TRecord, TSink >::operator= ( ScopedSinkDisabling< TRecord, TSink > &&  other)
inlinenoexcept

Move-assign operator.


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