#include <ConnectionManager.hpp>
Public Types | |
typedef boost::tuple< boost::shared_ptr< ConnID >, base::ChannelElementBase::shared_ptr, ConnPolicy > | ChannelDescriptor |
typedef std::list< ChannelDescriptor > | Connections |
Public Member Functions | |
bool | addConnection (ConnID *port_id, base::ChannelElementBase::shared_ptr channel, ConnPolicy policy) |
bool | connected () const |
bool | connectedTo (base::PortInterface *port) |
ConnectionManager (base::PortInterface *port) | |
void | disconnect () |
bool | disconnect (base::PortInterface *port) |
Connections | getConnections () const |
internal::SharedConnectionBase::shared_ptr | getSharedConnection () const |
bool | isSingleConnection () const |
bool | removeConnection (ConnID *port_id, bool disconnect=true) |
bool | removeConnection (base::ChannelElementBase *channel, bool disconnect=true) |
~ConnectionManager () | |
Protected Member Functions | |
Connections::iterator | eraseConnection (const Connections::iterator &descriptor, bool disconnect) |
Protected Attributes | |
std::list< ChannelDescriptor > | connections |
base::PortInterface * | mport |
internal::SharedConnectionBase::shared_ptr | shared_connection |
Manages connections between ports. This class is used for input and output ports in order to manage their connections. TODO: use the mutex lock !!!
Definition at line 78 of file ConnectionManager.hpp.
typedef boost::tuple<boost::shared_ptr<ConnID>, base::ChannelElementBase::shared_ptr, ConnPolicy> RTT::internal::ConnectionManager::ChannelDescriptor |
A connection is described by an opaque ConnID object, the first element of the connection and the policy of the connection. The policy is only given for read-only access, modifying it will not have any effect on the connection.
Definition at line 87 of file ConnectionManager.hpp.
typedef std::list<ChannelDescriptor> RTT::internal::ConnectionManager::Connections |
Definition at line 89 of file ConnectionManager.hpp.
RTT::internal::ConnectionManager::ConnectionManager | ( | base::PortInterface * | port | ) |
Creates a connection manager to manage the connections of port.
port | The port whose connections to manage. |
Definition at line 63 of file ConnectionManager.cpp.
RTT::internal::ConnectionManager::~ConnectionManager | ( | ) |
Definition at line 68 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::addConnection | ( | ConnID * | port_id, |
base::ChannelElementBase::shared_ptr | channel, | ||
ConnPolicy | policy | ||
) |
Helper method for port-to-port connection establishment. This is the last step in adding a connection to an output port and also validates if the connection is sound.
Definition at line 126 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::connected | ( | ) | const |
Returns true if there is at least one connection registered in this port's list of outputs
Definition at line 110 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::connectedTo | ( | base::PortInterface * | port | ) |
Returns true if there exists a connection to the given port
Definition at line 116 of file ConnectionManager.cpp.
void RTT::internal::ConnectionManager::disconnect | ( | ) |
Disconnect all connections.
Definition at line 102 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::disconnect | ( | base::PortInterface * | port | ) |
Removes the connection that connects this port to port
Definition at line 73 of file ConnectionManager.cpp.
|
protected |
Locks the mutex protecting the channel element list. Unlocks the mutex protecting the channel element list. Helper method for disconnect()
Unconditionally removes the given connection and returns the next connection in the list or connections.end()
Definition at line 79 of file ConnectionManager.cpp.
|
inline |
Returns a list of all connections managed by this object.
Definition at line 136 of file ConnectionManager.hpp.
|
inline |
Returns a pointer to the shared connection element this port may be connected to.
Definition at line 143 of file ConnectionManager.hpp.
|
inline |
Returns true if this manager manages only one connection.
Definition at line 131 of file ConnectionManager.hpp.
bool RTT::internal::ConnectionManager::removeConnection | ( | ConnID * | port_id, |
bool | disconnect = true |
||
) |
Definition at line 144 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::removeConnection | ( | base::ChannelElementBase * | channel, |
bool | disconnect = true |
||
) |
Definition at line 159 of file ConnectionManager.cpp.
|
protected |
A list of all our connections. Only non-null if two or more connections were added.
Definition at line 178 of file ConnectionManager.hpp.
|
protected |
The port for which we manage connections.
Definition at line 172 of file ConnectionManager.hpp.
|
protected |
A pointer to the shared connection this port may be connected to.
Definition at line 183 of file ConnectionManager.hpp.