ndn::signal::Connection Class Reference

Represents a connection to a signal. More...

#include <ndn-cxx/util/signal/connection.hpp>

+ Inheritance diagram for ndn::signal::Connection:
+ Collaboration diagram for ndn::signal::Connection:

Public Member Functions

constexpr Connection () noexcept=default
 
void disconnect ()
 Disconnects from the signal. More...
 
bool isConnected () const noexcept
 Check if connected to the signal. More...
 

Friends

bool operator== (const Connection &lhs, const Connection &rhs) noexcept
 Compare for equality. More...
 
template<typename Owner , typename... TArgs>
class Signal
 

Detailed Description

Represents a connection to a signal.

Note
This type is copyable. Any copy can be used to disconnect.

Definition at line 37 of file connection.hpp.

Constructor & Destructor Documentation

◆ Connection()

constexpr ndn::signal::Connection::Connection ( )
constexprdefaultnoexcept

Member Function Documentation

◆ disconnect()

void ndn::signal::Connection::disconnect ( )

Disconnects from the signal.

Note
If the connection is already disconnected, or if the Signal has been destructed, this operation has no effect.
Warning
During signal emission, attempting to disconnect a connection other than the executing handler's own connection results in undefined behavior.

Definition at line 32 of file connection.cpp.

◆ isConnected()

bool ndn::signal::Connection::isConnected ( ) const
inlinenoexcept

Check if connected to the signal.

Definition at line 57 of file connection.hpp.

Friends And Related Function Documentation

◆ operator==

bool operator== ( const Connection lhs,
const Connection rhs 
)
friend

Compare for equality.

Two connections are equal if they both refer to the same connection that isn't disconnected, or they are both disconnected.

Definition at line 81 of file connection.hpp.

◆ Signal

template<typename Owner , typename... TArgs>
friend class Signal
friend

Definition at line 67 of file connection.hpp.