NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::util::signal::ScopedConnection Class Reference

Disconnects a Connection automatically upon destruction. More...

#include <scoped-connection.hpp>

Public Member Functions

constexpr ScopedConnection () noexcept=default
 
 ScopedConnection (const ScopedConnection &)=delete
 
ScopedConnectionoperator= (const ScopedConnection &)=delete
 
 ScopedConnection (ScopedConnection &&) noexcept
 Move constructor. More...
 
ScopedConnectionoperator= (ScopedConnection &&) noexcept
 Move assignment operator. More...
 
 ScopedConnection (Connection connection) noexcept
 Implicit constructor from Connection. More...
 
ScopedConnectionoperator= (Connection connection)
 Assign a connection. More...
 
 ~ScopedConnection ()
 Destructor, automatically disconnects the connection. More...
 
void disconnect ()
 Manually disconnect the connection. More...
 
bool isConnected () const noexcept
 Check if the connection is connected to the signal. More...
 
void release () noexcept
 Release 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

◆ ScopedConnection() [1/4]

constexpr ndn::util::signal::ScopedConnection::ScopedConnection ( )
defaultnoexcept

◆ ScopedConnection() [2/4]

ndn::util::signal::ScopedConnection::ScopedConnection ( const ScopedConnection )
delete

◆ ScopedConnection() [3/4]

ndn::util::signal::ScopedConnection::ScopedConnection ( ScopedConnection &&  )
inlinedefaultnoexcept

Move constructor.

◆ ScopedConnection() [4/4]

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

Implicit constructor from Connection.

Parameters
connectionthe Connection to be disconnected upon destruction

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

◆ ~ScopedConnection()

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

Destructor, automatically disconnects the connection.

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

References disconnect().

Member Function Documentation

◆ operator=() [1/3]

ScopedConnection& ndn::util::signal::ScopedConnection::operator= ( const ScopedConnection )
delete

◆ operator=() [2/3]

ScopedConnection & ndn::util::signal::ScopedConnection::operator= ( ScopedConnection &&  )
inlinedefaultnoexcept

Move assignment operator.

◆ operator=() [3/3]

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

Assign a connection.

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

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

References disconnect().

◆ disconnect()

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

Manually disconnect the connection.

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

References ndn::util::signal::Connection::disconnect().

Referenced by nfd::face::InternalClientTransport::connectToForwarder(), operator=(), and ~ScopedConnection().

◆ isConnected()

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

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 55 of file scoped-connection.cpp.

References ndn::util::signal::Connection::isConnected().

◆ release()

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

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

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


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