#include <Pt/Connectable.h>

Public Member Functions | |
| Connectable () | |
| Default constructor. | |
| virtual | ~Connectable () |
| Closes all connections. | |
| virtual bool | opened (const Connection &c) |
| Registers a Connection with the Connectable. | |
| virtual void | closed (const Connection &c) |
| Unregisters a Connection from the Connectable. | |
| std::size_t | connectionCount () const |
Protected Member Functions | |
| Connectable (const Connectable &c) | |
| Copy constructor. | |
| Connectable & | operator= (const Connectable &rhs) |
| Assignment operator. | |
| const std::list< Connection > & | connections () const |
| Returns a list of all current connections. | |
| std::list< Connection > & | connections () |
| Returns a list of all current connections. | |
| void | clear () |
Protected Attributes | |
| std::list< Connection > | _connections |
| A list of all current connections. | |
| Connectable | ( | ) |
Creates an empty Connectable.
| virtual ~Connectable | ( | ) | [virtual] |
When a Connectable object is destroyed, it closes all its connections automatically.
| Connectable | ( | const Connectable & | c | ) | [protected] |
| virtual bool opened | ( | const Connection & | c | ) | [virtual] |
This function is called when a new Connection involving this object is opened. The default implementation adds the connection to a list, so the destructor can close it.
| c | Connection being opened |
Reimplemented in EventLoop, and EventSource.
| virtual void closed | ( | const Connection & | c | ) | [virtual] |
This function is called when a new Connection involving this object is closed. The default implementation removes the connection from its list of connections.
| c | Connection being opened |
Reimplemented in EventLoop, and EventSource.
| Connectable& operator= | ( | const Connectable & | rhs | ) | [protected] |
Connectables can be copy constructed if the derived class provides a public copy constructor. Copying a Connectable will not change its connections.