47 #include <boost/bind.hpp> 48 #include <boost/scoped_ptr.hpp> 49 #include "../base/PortInterface.hpp" 50 #include "../os/MutexLock.hpp" 51 #include "../base/InputPortInterface.hpp" 56 using namespace detail;
77 descriptor.get<1>()->
clear();
87 return ( descriptor.get<0>() && conn_id->
isSameID(*descriptor.get<0>()));
94 else if (reset_current)
100 boost::scoped_ptr<ConnID> conn_id( port->
getPortID() );
107 bool is_forward =
true;
108 if ( dynamic_cast<InputPortInterface*>(
mport) )
111 descriptor.get<1>()->
disconnect( is_forward );
117 std::list<ChannelDescriptor> all_connections;
119 all_connections.splice(all_connections.end(),
connections);
122 std::for_each(all_connections.begin(), all_connections.end(),
143 std::list<ChannelDescriptor>::iterator conn_it =
147 descriptor = *conn_it;
156 bool is_forward =
true;
157 if ( dynamic_cast<InputPortInterface*>(
mport) )
166 return conn_id->
isSameID( *channel.get<0>() );
virtual bool isSameID(ConnID const &id) const =0
void addConnection(ConnID *port_id, base::ChannelElementBase::shared_ptr channel_input, ConnPolicy policy)
Helper method for port-to-port connection establishment.
void disconnect()
Disconnect all connections.
bool removeConnection(ConnID *port_id)
void clear()
Clears (removes) all data in the manager's connections.
ChannelDescriptor * cur_channel
Optimisation in case only one channel is to be managed.
A connection policy object describes how a given connection should behave.
void lock() const
Locks the mutex protecting the channel element list.
bool findMatchingPort(ConnID const *conn_id, ChannelDescriptor const &descriptor)
Helper method for disconnect(PortInterface*)
ConnectionManager(base::PortInterface *port)
Creates a connection manager to manage the connections of port.
base::PortInterface * mport
The port for which we manage connections.
bool is_same_id(ConnID *conn_id, ConnectionManager::ChannelDescriptor const &channel)
void updateCurrentChannel(bool reset_current)
boost::tuple< boost::shared_ptr< ConnID >, base::ChannelElementBase::shared_ptr, ConnPolicy > ChannelDescriptor
A Channel (= connection) is described by an opaque ConnID object, the first element of the channel an...
void clearChannel(ConnectionManager::ChannelDescriptor &descriptor)
Helper function to clear a connection.
boost::intrusive_ptr< ChannelElementBase > shared_ptr
RTT::os::Mutex connection_lock
Lock that should be taken before the list of connections is accessed or modified. ...
virtual internal::ConnID * getPortID() const
Returns the identity of this port in a ConnID object.
This class is used in places where a permanent representation of a reference to a connection is neede...
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
std::list< ChannelDescriptor > connections
A list of all our connections.
The base class of every data flow port.
bool eraseConnection(ChannelDescriptor &descriptor)
Helper method for disconnect()
bool connected() const
Returns true if there is at least one channel registered in this port's list of outputs.
MutexLock is a scope based Monitor, protecting critical sections with a Mutex object through locking ...