Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
RTT::internal::ConnectionManager Class Reference

#include <ConnectionManager.hpp>

List of all members.

Public Types

typedef boost::tuple
< boost::shared_ptr< ConnID >
, base::ChannelElementBase::shared_ptr,

Public Member Functions

void addConnection (ConnID *port_id, base::ChannelElementBase::shared_ptr channel_input, ConnPolicy policy)
void clear ()
bool connected () const
 ConnectionManager (base::PortInterface *port)
template<typename Pred >
bool delete_if (Pred pred)
void disconnect ()
bool disconnect (base::PortInterface *port)
template<typename Pred >
std::pair< bool,
find_if (Pred pred, bool copy_old_data)
std::list< ChannelDescriptorgetChannels () const
base::ChannelElementBasegetCurrentChannel () const
bool isSingleConnection () const
bool removeConnection (ConnID *port_id)
template<typename Pred >
void select_reader_channel (Pred pred, bool copy_old_data)
 ~ConnectionManager ()

Protected Member Functions

bool eraseConnection (ChannelDescriptor &descriptor)
bool findMatchingPort (ConnID const *conn_id, ChannelDescriptor const &descriptor)
void updateCurrentChannel (bool reset_current)

Protected Attributes

RTT::os::Mutex connection_lock
os::Mutex connection_resize_mtx
std::list< ChannelDescriptorconnections
ChannelDescriptor cur_channel

Detailed Description

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 ConnectionManager.hpp.

Member Typedef Documentation

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 ConnectionManager.hpp.

Constructor & Destructor Documentation

Creates a connection manager to manage the connections of port.

portThe port whose connections to manage.

Definition at line 61 of file ConnectionManager.cpp.

Definition at line 66 of file ConnectionManager.cpp.

Member Function Documentation

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.

false if the connection failed to work, true otherwise.

Definition at line 129 of file ConnectionManager.cpp.

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.

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.

template<typename Pred >
bool RTT::internal::ConnectionManager::delete_if ( Pred  pred) [inline]

Definition at line 119 of file ConnectionManager.hpp.

Disconnect all connections.

Definition at line 114 of file ConnectionManager.cpp.

Removes the channel that connects this port to port

Definition at line 97 of file ConnectionManager.cpp.

Helper method for disconnect()

Unconditionally removes the given connection and return true

Definition at line 103 of file ConnectionManager.cpp.

template<typename Pred >
std::pair<bool, ChannelDescriptor> RTT::internal::ConnectionManager::find_if ( Pred  pred,
bool  copy_old_data 
) [inline]

Definition at line 158 of file 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.

true if the descriptor matches, false otherwise

Definition at line 84 of file ConnectionManager.cpp.

Returns a list of all channels managed by this object.

Definition at line 192 of file ConnectionManager.hpp.

Returns the first added channel or if select_if was called, the selected channel.

See also:
select_if to change the current channel.

Definition at line 185 of file ConnectionManager.hpp.

Returns true if this manager manages only one connection.


Definition at line 178 of file ConnectionManager.hpp.

Definition at line 138 of file ConnectionManager.cpp.

template<typename Pred >
void RTT::internal::ConnectionManager::select_reader_channel ( Pred  pred,
bool  copy_old_data 
) [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.


Definition at line 144 of file ConnectionManager.hpp.

void RTT::internal::ConnectionManager::updateCurrentChannel ( bool  reset_current) [protected]

Definition at line 89 of file ConnectionManager.cpp.

Member Data Documentation

Lock that should be taken before the list of connections is accessed or modified

Definition at line 246 of file ConnectionManager.hpp.

os::Mutex for when it is needed to resize the connections list

Definition at line 224 of file ConnectionManager.hpp.

A list of all our connections. Only non-null if two or more connections were added.

Definition at line 235 of file ConnectionManager.hpp.

Optimisation in case only one channel is to be managed.

Definition at line 240 of file ConnectionManager.hpp.

The port for which we manage connections.

Definition at line 229 of file ConnectionManager.hpp.

The documentation for this class was generated from the following files:

Author(s): RTT Developers
autogenerated on Wed Aug 26 2015 16:16:24