KDBindings API Documentation  1.0.95
Public Member Functions | Protected Member Functions | List of all members
KDBindings::ConnectionEvaluator Class Reference

Manages and evaluates deferred Signal connections. More...

#include <connection_evaluator.h>

Public Member Functions

 ConnectionEvaluator ()=default
 
 ConnectionEvaluator (ConnectionEvaluator &&other) noexcept=delete
 
 ConnectionEvaluator (const ConnectionEvaluator &) noexcept=delete
 
virtual ~ConnectionEvaluator ()=default
 
void evaluateDeferredConnections ()
 Evaluate the deferred connections. More...
 
ConnectionEvaluatoroperator= (ConnectionEvaluator &&other) noexcept=delete
 
ConnectionEvaluatoroperator= (const ConnectionEvaluator &) noexcept=delete
 

Protected Member Functions

virtual void onInvocationAdded ()
 Called when a new slot invocation is added. More...
 

Detailed Description

Manages and evaluates deferred Signal connections.

Warning
Deferred connections are experimental and may be removed or changed in the future.

The ConnectionEvaluator class is responsible for managing and evaluating connections to Signals. It provides mechanisms to delay and control the evaluation of connections. It therefore allows controlling when and on which thread slots connected to a Signal are executed.

See also
Signal::connectDeferred()

Definition at line 32 of file connection_evaluator.h.

Constructor & Destructor Documentation

◆ ConnectionEvaluator() [1/3]

KDBindings::ConnectionEvaluator::ConnectionEvaluator ( )
default

ConnectionEvaluators are default constructible

◆ ConnectionEvaluator() [2/3]

KDBindings::ConnectionEvaluator::ConnectionEvaluator ( const ConnectionEvaluator )
deletenoexcept

Connectionevaluators are not copyable

◆ ConnectionEvaluator() [3/3]

KDBindings::ConnectionEvaluator::ConnectionEvaluator ( ConnectionEvaluator &&  other)
deletenoexcept

ConnectionEvaluators are not moveable

◆ ~ConnectionEvaluator()

virtual KDBindings::ConnectionEvaluator::~ConnectionEvaluator ( )
virtualdefault

Member Function Documentation

◆ evaluateDeferredConnections()

void KDBindings::ConnectionEvaluator::evaluateDeferredConnections ( )
inline

Evaluate the deferred connections.

This function is responsible for evaluating and executing deferred connections. This function is thread safe.

Warning
Evaluating slots that throw an exception is currently undefined behavior.

Definition at line 64 of file connection_evaluator.h.

◆ onInvocationAdded()

virtual void KDBindings::ConnectionEvaluator::onInvocationAdded ( )
inlineprotectedvirtual

Called when a new slot invocation is added.

This function can be overwritten by subclasses to get notified whenever a new invocation is added to this evaluator. The default implementation does nothing and does not have to be called by subclasses when overriding.

⚠️ Note that this function will be executed on the thread that enqueued the slot invocation (i.e. the thread that called .emit() on the signal), which is usually not the thread that is responsible for evaluating the connections! Therefore it is usually not correct to call evaluateDeferredConnections() within this function! User code is responsible for ensuring that the threads are synchronized correctly.

For example, if you plan to evaluate (execute) the slot invocations in some "main" thread A and a signal is emitted in thread B, than this method will be called on thread B. It is a good place to "wake up" the event loop of thread A so that thread A can call evaluateDeferredConnections().

Definition at line 108 of file connection_evaluator.h.

◆ operator=() [1/2]

ConnectionEvaluator& KDBindings::ConnectionEvaluator::operator= ( ConnectionEvaluator &&  other)
deletenoexcept

◆ operator=() [2/2]

ConnectionEvaluator& KDBindings::ConnectionEvaluator::operator= ( const ConnectionEvaluator )
deletenoexcept

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

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDBindings
Reactive programming & data binding in C++
https://github.com/KDAB/KDBindings/
Generated by doxygen 1.9.1