Signals Library
sig::Connection Class Reference

Represents the connection made when a Slot is connected to a Signal. More...

#include <connection.hpp>

Public Member Functions

 Connection ()=default
 Default constructors a connection that refers to no real connection.
 
 Connection (std::weak_ptr< Connection_impl_base > wp_cib)
 Constructor used by the Signal::connect() function. More...
 
void disconnect () const
 Disconnects the connection. More...
 
auto connected () const -> bool
 Query whether the connection is connected or not. More...
 
auto blocked () const -> bool
 Query whether the connection is currently blocked or not. More...
 
auto operator== (Connection const &x) const -> bool
 Return true if both parameters refer to the same Signal/Slot connection.
 
auto operator< (Connection const &x) const -> bool
 Does pointer less than comparison of underlying implementation.
 

Friends

class Shared_connection_block
 

Detailed Description

Represents the connection made when a Slot is connected to a Signal.

Can be queried to check if the Slot is still connected to the Signal. The Connection can be blocked by constructing a Shared_connection_block.

Constructor & Destructor Documentation

◆ Connection()

sig::Connection::Connection ( std::weak_ptr< Connection_impl_base wp_cib)
inlineexplicit

Constructor used by the Signal::connect() function.

Signal uses this constructor to build Connection objects. Each Signal owns the Connection_impl, and each Connection_impl owns the connected Slot.

Parameters
wp_cibImplementation object that holds Connection's state.
See also
Signal Slot

Member Function Documentation

◆ blocked()

auto sig::Connection::blocked ( ) const -> bool
inline

Query whether the connection is currently blocked or not.

Blocking can happen from initializing a Shared_connection_block with *this.

Returns
True if the connection is blocked, false otherwise.

◆ connected()

auto sig::Connection::connected ( ) const -> bool
inline

Query whether the connection is connected or not.

Returns
True if *this is connected, false otherwise.

◆ disconnect()

void sig::Connection::disconnect ( ) const
inline

Disconnects the connection.

The Slot associated with this connection will no longer be called by the associated Signal. If connection is already disconnected, this is a no-op.


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