#include <ConnectionManager.hpp>
Manages connections between ports. This class is used for input and output ports in order to manage their channels. TODO: use the mutex lock !!!
Definition at line 77 of file install/include/rtt/internal/ConnectionManager.hpp.
typedef boost::tuple<boost::shared_ptr<ConnID>, base::ChannelElementBase::shared_ptr, ConnPolicy> RTT::internal::ConnectionManager::ChannelDescriptor |
A Channel (= connection) is described by an opaque ConnID object, the first element of the channel and the policy of the channel. The policy is only given for read-only access, modifying it will not have any effect on the connection.
Definition at line 86 of file rtt/internal/ConnectionManager.hpp.
typedef boost::tuple<boost::shared_ptr<ConnID>, base::ChannelElementBase::shared_ptr, ConnPolicy> RTT::internal::ConnectionManager::ChannelDescriptor |
A Channel (= connection) is described by an opaque ConnID object, the first element of the channel and the policy of the channel. The policy is only given for read-only access, modifying it will not have any effect on the connection.
Definition at line 86 of file install/include/rtt/internal/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 61 of file ConnectionManager.cpp.
RTT::internal::ConnectionManager::~ConnectionManager | ( | ) |
Definition at line 66 of file ConnectionManager.cpp.
RTT::internal::ConnectionManager::ConnectionManager | ( | base::PortInterface * | port | ) |
Creates a connection manager to manage the connections of port.
port | The port whose connections to manage. |
RTT::internal::ConnectionManager::~ConnectionManager | ( | ) |
void RTT::internal::ConnectionManager::addConnection | ( | ConnID * | port_id, | |
base::ChannelElementBase::shared_ptr | channel_input, | |||
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.
void RTT::internal::ConnectionManager::addConnection | ( | ConnID * | port_id, | |
base::ChannelElementBase::shared_ptr | channel_input, | |||
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.
void RTT::internal::ConnectionManager::clear | ( | ) |
Clears (removes) all data in the manager's connections. After this call, all channels will return NoData, until new data is written.
void RTT::internal::ConnectionManager::clear | ( | ) |
Clears (removes) all data in the manager's connections. After this call, all channels will return NoData, until new data is written.
Definition at line 79 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::connected | ( | ) | const |
Returns true if there is at least one channel registered in this port's list of outputs
bool RTT::internal::ConnectionManager::connected | ( | ) | const |
Returns true if there is at least one channel registered in this port's list of outputs
Definition at line 125 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::delete_if | ( | Pred | pred | ) | [inline] |
Definition at line 119 of file rtt/internal/ConnectionManager.hpp.
bool RTT::internal::ConnectionManager::delete_if | ( | Pred | pred | ) | [inline] |
Definition at line 119 of file install/include/rtt/internal/ConnectionManager.hpp.
bool RTT::internal::ConnectionManager::disconnect | ( | base::PortInterface * | port | ) |
Removes the channel that connects this port to port
void RTT::internal::ConnectionManager::disconnect | ( | ) |
Disconnect all connections.
bool RTT::internal::ConnectionManager::disconnect | ( | base::PortInterface * | port | ) |
Removes the channel that connects this port to port
Definition at line 97 of file ConnectionManager.cpp.
void RTT::internal::ConnectionManager::disconnect | ( | ) |
Disconnect all connections.
Definition at line 114 of file ConnectionManager.cpp.
bool RTT::internal::ConnectionManager::eraseConnection | ( | ChannelDescriptor & | descriptor | ) | [protected] |
Helper method for disconnect()
Unconditionally removes the given connection and return true
bool RTT::internal::ConnectionManager::eraseConnection | ( | ConnectionManager::ChannelDescriptor & | descriptor | ) | [protected] |
Helper method for disconnect()
Unconditionally removes the given connection and return true
Definition at line 103 of file ConnectionManager.cpp.
std::pair<bool, ChannelDescriptor> RTT::internal::ConnectionManager::find_if | ( | Pred | pred | ) | [inline] |
Definition at line 159 of file rtt/internal/ConnectionManager.hpp.
std::pair<bool, ChannelDescriptor> RTT::internal::ConnectionManager::find_if | ( | Pred | pred | ) | [inline] |
Definition at line 159 of file install/include/rtt/internal/ConnectionManager.hpp.
bool RTT::internal::ConnectionManager::findMatchingPort | ( | ConnID const * | conn_id, | |
ChannelDescriptor const & | descriptor | |||
) | [protected] |
Helper method for disconnect(PortInterface*)
This method removes the channel listed in descriptor
from the list of output channels if port
has the same id that the one listed in descriptor
.
bool RTT::internal::ConnectionManager::findMatchingPort | ( | ConnID const * | conn_id, | |
ChannelDescriptor const & | descriptor | |||
) | [protected] |
Helper method for disconnect(PortInterface*)
This method removes the channel listed in descriptor
from the list of output channels if port
has the same id that the one listed in descriptor
.
Definition at line 84 of file ConnectionManager.cpp.
std::list<ChannelDescriptor> RTT::internal::ConnectionManager::getChannels | ( | ) | const [inline] |
Returns a list of all channels managed by this object.
Definition at line 196 of file rtt/internal/ConnectionManager.hpp.
std::list<ChannelDescriptor> RTT::internal::ConnectionManager::getChannels | ( | ) | const [inline] |
Returns a list of all channels managed by this object.
Definition at line 196 of file install/include/rtt/internal/ConnectionManager.hpp.
base::ChannelElementBase* RTT::internal::ConnectionManager::getCurrentChannel | ( | ) | const [inline] |
Returns the first added channel or if select_if was called, the selected channel.
Definition at line 189 of file rtt/internal/ConnectionManager.hpp.
base::ChannelElementBase* RTT::internal::ConnectionManager::getCurrentChannel | ( | ) | const [inline] |
Returns the first added channel or if select_if was called, the selected channel.
Definition at line 189 of file install/include/rtt/internal/ConnectionManager.hpp.
bool RTT::internal::ConnectionManager::isSingleConnection | ( | ) | const [inline] |
Returns true if this manager manages only one connection.
Definition at line 182 of file rtt/internal/ConnectionManager.hpp.
bool RTT::internal::ConnectionManager::isSingleConnection | ( | ) | const [inline] |
Returns true if this manager manages only one connection.
Definition at line 182 of file install/include/rtt/internal/ConnectionManager.hpp.
bool RTT::internal::ConnectionManager::removeConnection | ( | ConnID * | port_id | ) |
bool RTT::internal::ConnectionManager::removeConnection | ( | ConnID * | port_id | ) |
Definition at line 138 of file ConnectionManager.cpp.
void RTT::internal::ConnectionManager::select_reader_channel | ( | Pred | pred | ) | [inline] |
Selects a connection as the current channel if pred(connection) is true. It will first check the current channel ( getCurrentChannel() ), if that does not satisfy pred, iterate over all connections. If none satisfy pred, the current channel remains unchanged.
pred |
Definition at line 144 of file rtt/internal/ConnectionManager.hpp.
void RTT::internal::ConnectionManager::select_reader_channel | ( | Pred | pred | ) | [inline] |
Selects a connection as the current channel if pred(connection) is true. It will first check the current channel ( getCurrentChannel() ), if that does not satisfy pred, iterate over all connections. If none satisfy pred, the current channel remains unchanged.
pred |
Definition at line 144 of file install/include/rtt/internal/ConnectionManager.hpp.
void RTT::internal::ConnectionManager::updateCurrentChannel | ( | bool | reset_current | ) | [protected] |
void RTT::internal::ConnectionManager::updateCurrentChannel | ( | bool | reset_current | ) | [protected] |
Definition at line 89 of file ConnectionManager.cpp.
Lock that should be taken before the list of connections is accessed or modified
Definition at line 250 of file install/include/rtt/internal/ConnectionManager.hpp.
os::Mutex for when it is needed to resize the connections list
Definition at line 228 of file install/include/rtt/internal/ConnectionManager.hpp.
std::list< ChannelDescriptor > RTT::internal::ConnectionManager::connections [protected] |
A list of all our connections. Only non-null if two or more connections were added.
Definition at line 239 of file install/include/rtt/internal/ConnectionManager.hpp.
Optimisation in case only one channel is to be managed.
Definition at line 244 of file install/include/rtt/internal/ConnectionManager.hpp.
base::PortInterface * RTT::internal::ConnectionManager::mport [protected] |
The port for which we manage connections.
Definition at line 233 of file install/include/rtt/internal/ConnectionManager.hpp.