ndn::util::signal::ScopedConnection Class Reference

disconnects a Connection automatically upon destruction More...

#include <scoped-connection.hpp>

+ Inheritance diagram for ndn::util::signal::ScopedConnection:
+ Collaboration diagram for ndn::util::signal::ScopedConnection:

Public Member Functions

 ScopedConnection ()
 
 ScopedConnection (const Connection &connection)
 implicit constructor from Connection More...
 
 ScopedConnection (ScopedConnection &&other) noexcept
 move constructor More...
 
 ~ScopedConnection () noexcept
 disconnects the connection More...
 
void disconnect ()
 disconnects the connection manually More...
 
bool isConnected () const
 check if the connection is connected to the signal More...
 
ScopedConnectionoperator= (const Connection &connection)
 assigns a connection More...
 
void release ()
 releases the connection so that it won't be disconnected when this ScopedConnection is destructed More...
 

Detailed Description

disconnects a Connection automatically upon destruction

Definition at line 33 of file scoped-connection.hpp.

Constructor & Destructor Documentation

ndn::util::signal::ScopedConnection::ScopedConnection ( )

Definition at line 33 of file scoped-connection.cpp.

ndn::util::signal::ScopedConnection::ScopedConnection ( const Connection connection)

implicit constructor from Connection

Parameters
connectionthe Connection to be disconnected upon destruction

Definition at line 37 of file scoped-connection.cpp.

ndn::util::signal::ScopedConnection::ScopedConnection ( ScopedConnection &&  other)
noexcept

move constructor

Definition at line 42 of file scoped-connection.cpp.

ndn::util::signal::ScopedConnection::~ScopedConnection ( )
noexcept

disconnects the connection

Definition at line 58 of file scoped-connection.cpp.

Member Function Documentation

void ndn::util::signal::ScopedConnection::disconnect ( )

disconnects the connection manually

Definition at line 64 of file scoped-connection.cpp.

bool ndn::util::signal::ScopedConnection::isConnected ( ) const

check if the connection is connected to the signal

Returns
false when a default-constructed connection is used, the connection is released, or the connection is disconnected

Definition at line 70 of file scoped-connection.cpp.

ScopedConnection & ndn::util::signal::ScopedConnection::operator= ( const Connection connection)

assigns a connection

If a different connection has been assigned to this instance previously, that connection will be disconnected immediately.

Definition at line 49 of file scoped-connection.cpp.

void ndn::util::signal::ScopedConnection::release ( )

releases the connection so that it won't be disconnected when this ScopedConnection is destructed

Definition at line 76 of file scoped-connection.cpp.