Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSignalCompressorWithParam< T > Class Template Reference

#include <kis_signal_compressor_with_param.h>

Public Types

using CallbackFunction = std::function<void (T)>
 

Public Member Functions

bool isActive () const
 
 KisSignalCompressorWithParam (int delay, CallbackFunction function, KisSignalCompressor::Mode mode=KisSignalCompressor::FIRST_ACTIVE)
 
void setDelay (int value)
 
void start (T param)
 
void stop ()
 
 ~KisSignalCompressorWithParam ()
 

Private Member Functions

void fakeSlotTimeout ()
 

Private Attributes

KisSignalCompressor m_compressor
 
m_currentParamValue
 
CallbackFunction m_function
 
QScopedPointer< SignalToFunctionProxym_signalProxy
 

Detailed Description

template<typename T>
class KisSignalCompressorWithParam< T >

A special class for deferring and compressing events with one parameter of type T. This works like KisSignalCompressor but can handle events with one parameter. Due to limitation of the Qt this doesn't allow signal/slots, so it uses std::function instead.

In the end (after a timeout) the latest param value is returned to the callback.

   Usage:

   \code{.cpp}

   using namespace std::placeholders; // For _1 placeholder

   // prepare the callback function
   std::function<void (qreal)> callback(
       std::bind(&LutDockerDock::setCurrentExposureImpl, this, _1));

   // Create the compressor object
   KisSignalCompressorWithParam<qreal> compressor(40, callback);

   // When event comes:
   compressor.start(0.123456);

   \endcode

Definition at line 111 of file kis_signal_compressor_with_param.h.

Member Typedef Documentation

◆ CallbackFunction

template<typename T >
using KisSignalCompressorWithParam< T >::CallbackFunction = std::function<void (T)>

Definition at line 114 of file kis_signal_compressor_with_param.h.

Constructor & Destructor Documentation

◆ KisSignalCompressorWithParam()

◆ ~KisSignalCompressorWithParam()

template<typename T >
KisSignalCompressorWithParam< T >::~KisSignalCompressorWithParam ( )
inline

Definition at line 128 of file kis_signal_compressor_with_param.h.

129 {
130 }

Member Function Documentation

◆ fakeSlotTimeout()

◆ isActive()

template<typename T >
bool KisSignalCompressorWithParam< T >::isActive ( ) const
inline

◆ setDelay()

template<typename T >
void KisSignalCompressorWithParam< T >::setDelay ( int value)
inline

Definition at line 145 of file kis_signal_compressor_with_param.h.

145 {
147 }
float value(const T *src, size_t ch)
void setDelay(std::function< bool()> idleCallback, int idleDelay, int timeout)

References KisSignalCompressorWithParam< T >::m_compressor, KisSignalCompressor::setDelay(), and value().

◆ start()

◆ stop()

Member Data Documentation

◆ m_compressor

template<typename T >
KisSignalCompressor KisSignalCompressorWithParam< T >::m_compressor
private

Definition at line 155 of file kis_signal_compressor_with_param.h.

◆ m_currentParamValue

template<typename T >
T KisSignalCompressorWithParam< T >::m_currentParamValue
private

Definition at line 158 of file kis_signal_compressor_with_param.h.

◆ m_function

template<typename T >
CallbackFunction KisSignalCompressorWithParam< T >::m_function
private

Definition at line 156 of file kis_signal_compressor_with_param.h.

◆ m_signalProxy

template<typename T >
QScopedPointer<SignalToFunctionProxy> KisSignalCompressorWithParam< T >::m_signalProxy
private

Definition at line 157 of file kis_signal_compressor_with_param.h.


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