Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Connectable Class Reference

Connection management for signal and slot objects

This class implements connection management for signal and slot objects. It makes sure that all connections where this object is involved are closed on destruction. Deriving classes can overload Connectable::opened and Connectable::closed to tune connection managenment.

#include <cxxtools/connectable.h>

Inheritance diagram for Connectable:

Application SelectorBase StreamBuffer Test EventLoopBase Application TestCase TestSuite EventLoop

List of all members.

Public Member Functions

 Connectable ()
 Default constructor.
virtual ~Connectable ()
 Closes all connections.
virtual void onConnectionOpen (const Connection &c)
 Registers a Connection with the Connectable.
virtual void onConnectionClose (const Connection &c)
 Unregisters a Connection from the Connectable.
size_t connectionCount () const

Protected Member Functions

 Connectable (const Connectable &c)
 Copy constructor.
Connectableoperator= (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.


Constructor & Destructor Documentation

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]


Member Function Documentation

virtual void onConnectionOpen ( 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.

Parameters:
c Connection being opened
Returns:
True if the Connection was accepted

virtual void onConnectionClose ( 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.

Parameters:
c Connection being opened

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.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6