Signals Library
sig::Shared_connection_block Class Reference

Blocks a Signal/Slot Connection. More...

#include <shared_connection_block.hpp>

Public Member Functions

 Shared_connection_block (Connection const &conn=Connection{}, bool initially_block=true)
 Create a Shared_connection_block from a Connection and a boolean. More...
 
 Shared_connection_block (Shared_connection_block const &x)
 Creates a copy of x, increasing the block count on the. More...
 
auto operator= (Shared_connection_block const &x) -> Shared_connection_block &
 Reset *this' Connection to point to x's Connection. More...
 
 ~Shared_connection_block ()
 Releases this block from the Connection. More...
 
void unblock ()
 Releases the Connection block. No-op if not currently blocking.
 
void block ()
 Reasserts a block on a Connection. No-op if currently blocking.
 
auto blocking () const -> bool
 
auto connection () const -> Connection
 

Detailed Description

Blocks a Signal/Slot Connection.

Any number of Shared_connection_blocks can be built on a single connection, when the last block goes out of scope, the connection is unblocked.

Constructor & Destructor Documentation

◆ Shared_connection_block() [1/2]

sig::Shared_connection_block::Shared_connection_block ( Connection const &  conn = Connection{},
bool  initially_block = true 
)
inlineexplicit

Create a Shared_connection_block from a Connection and a boolean.

Default constructs to blocking an empty Connection.

Parameters
connThe Connection to be blocked by *this.
initially_blockIf true, *this blocks the Connection, otherwise *this only holds a reference to the Connection and can block the Connection at some other time by calling block().

◆ Shared_connection_block() [2/2]

sig::Shared_connection_block::Shared_connection_block ( Shared_connection_block const &  x)
inline

Creates a copy of x, increasing the block count on the.

Connection if x is blocking.

◆ ~Shared_connection_block()

sig::Shared_connection_block::~Shared_connection_block ( )
inline

Releases this block from the Connection.

Connection may be blocked by other Shared_connection_block objects.

Member Function Documentation

◆ blocking()

auto sig::Shared_connection_block::blocking ( ) const -> bool
inline
Returns
True if *this is currently blocking a Connection, else false.

◆ connection()

auto sig::Shared_connection_block::connection ( ) const -> Connection
inline
Returns
The Connection object associated with *this.

◆ operator=()

auto sig::Shared_connection_block::operator= ( Shared_connection_block const &  x) -> Shared_connection_block&
inline

Reset *this' Connection to point to x's Connection.

If *this was blocking, then the block count is decremented on the original Connection. If x is blocking, then x's Connection gets an additional block.


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