...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::signals::connection — Query/disconnect a signal-slot connection.
// In header: <boost/signals/connection.hpp> class connection { public: // construct/copy/destruct connection(); connection(const connection&); connection& operator=(const connection&); // connection management void disconnect() const; bool connected() const; // blocking void block(bool = true); void unblock(); bool blocked() const; // modifiers void swap(const connection&); // comparisons bool operator==(const connection&) const; bool operator<(const connection&) const; }; // specialized algorithms void swap(connection&, connection&);
The connection class represents a connection between a Signal and a Slot. It is a lightweight object that has the ability to query whether the signal and slot are currently connected, and to disconnect the signal and slot. It is always safe to query or disconnect a connection.
connection
public
construct/copy/destructconnection();
Effects: |
Sets the currently represented connection to the NULL connection. |
Postconditions: |
|
Throws: |
Will not throw. |
connection(const connection& other);
Effects: |
|
Throws: |
Will not throw. |
connection& operator=(const connection& other);
Effects: |
|
Throws: |
Will not throw. |
connection
blockingvoid block(bool should_block = true);
Requires: |
connected() |
Postconditions: |
blocked() == should_block |
Throws: |
Will not throw. |
void unblock();
Requires: |
connected() |
Postconditions: |
!blocked() |
Throws: |
Will not throw. |
bool blocked() const;
Returns: |
true if the associated slot is either disconnected or blocked, false otherwise. |
Throws: |
Will not throw. |
connection
modifiersvoid swap(const connection& other);
Effects: |
Swaps the connections referenced in
|
Throws: |
Will not throw. |
connection
comparisonsbool operator==(const connection& other) const;
Returns: |
|
Throws: |
Will not throw. |
bool operator<(const connection& other) const;
Returns: |
|
Throws: |
Will not throw. |
connection
specialized algorithmsvoid swap(connection& x, connection& y);
Effects: |
|
Throws: |
Will not throw. |