Orocos Real-Time Toolkit
2.5.0
|
The base class of every data flow port. More...
#include <rtt/base/PortInterface.hpp>
Public Member Functions | |
virtual internal::ConnID * | getPortID () const |
Returns the identity of this port in a ConnID object. | |
const std::string & | getName () const |
Get the name of this Port. | |
bool | setName (const std::string &name) |
Change the name of this unconnected Port. | |
const std::string & | getDescription () const |
Get the documentation of this port. | |
PortInterface & | doc (const std::string &desc) |
Set the documentation of this port. | |
virtual bool | connected () const =0 |
Returns true if this port is connected. | |
virtual const types::TypeInfo * | getTypeInfo () const =0 |
Returns the types::TypeInfo object for the port's type. | |
virtual void | disconnect ()=0 |
Removes any connection that either go to or come from this port. | |
virtual bool | disconnect (PortInterface *port)=0 |
Removes the connection that links this port and the given port. | |
virtual internal::ConnFactory * | getConnFactory () |
The ChannelFactory object that allows to build the ChannelElement chain needed to build connections to or from this port. | |
virtual bool | isLocal () const |
Returns true if this port is located on this process, and false otherwise. | |
virtual int | serverProtocol () const |
Returns the protocol over which this port can be accessed. | |
virtual PortInterface * | clone () const =0 |
Create a local clone of this port with the same name. | |
virtual PortInterface * | antiClone () const =0 |
Create a local clone of this port with the same name. | |
virtual Service * | createPortObject () |
Create accessor Object for this Port, for addition to a TaskContext Object interface. | |
virtual bool | connectTo (PortInterface *other, ConnPolicy const &policy)=0 |
Connects this port with other, using the given policy. | |
virtual bool | connectTo (PortInterface *other)=0 |
Connects this port with other, using the default policy of the input. | |
virtual bool | createStream (ConnPolicy const &policy)=0 |
Creates a data stream from or to this port using connection-less transports. | |
virtual bool | addConnection (internal::ConnID *cid, ChannelElementBase::shared_ptr channel_input, ConnPolicy const &policy=ConnPolicy())=0 |
Adds a user created connection to this port. | |
virtual bool | removeConnection (internal::ConnID *cid)=0 |
Removes a user created connection from this port. | |
void | setInterface (DataFlowInterface *iface) |
Once a port is added to a DataFlowInterface, it gets a pointer to that interface. | |
DataFlowInterface * | getInterface () const |
Returns the DataFlowInterface this port belongs to or null if it was not added to such an interface. | |
virtual const internal::ConnectionManager * | getManager () const =0 |
Returns the connection manager of this port (if any). | |
Protected Member Functions | |
PortInterface (const std::string &name) | |
Protected Attributes | |
DataFlowInterface * | iface |
The base class of every data flow port.
Definition at line 57 of file PortInterface.hpp.
virtual bool RTT::base::PortInterface::addConnection | ( | internal::ConnID * | cid, |
ChannelElementBase::shared_ptr | channel_input, | ||
ConnPolicy const & | policy = ConnPolicy() |
||
) | [pure virtual] |
Adds a user created connection to this port.
This is an advanced method, prefer to use connectTo and createStream.
Implemented in RTT::corba::RemoteInputPort, RTT::base::InputPortInterface, and RTT::base::OutputPortInterface.
virtual PortInterface* RTT::base::PortInterface::antiClone | ( | ) | const [pure virtual] |
Create a local clone of this port with the same name.
If this port is a local port, this is an object of the inverse direction (read for write and write for read), and same name. If this object is a remote port, then it is a local port of the inverse direction and with the same name.
Implemented in RTT::OutputPort< T >, RTT::InputPort< T >, RTT::corba::RemoteInputPort, and RTT::corba::RemoteOutputPort.
virtual PortInterface* RTT::base::PortInterface::clone | ( | ) | const [pure virtual] |
Create a local clone of this port with the same name.
If this port is a local port, this is an object of the same type and same name. If this object is a remote port, then it is a local port of the same type and same name.
Implemented in RTT::OutputPort< T >, RTT::InputPort< T >, RTT::corba::RemoteInputPort, and RTT::corba::RemoteOutputPort.
virtual bool RTT::base::PortInterface::connectTo | ( | PortInterface * | other, |
ConnPolicy const & | policy | ||
) | [pure virtual] |
Connects this port with other, using the given policy.
Unlike OutputPortInterface::createConnection, other can be the write port and this
the read port.
Implemented in RTT::base::InputPortInterface, and RTT::base::OutputPortInterface.
virtual bool RTT::base::PortInterface::connectTo | ( | PortInterface * | other | ) | [pure virtual] |
Connects this port with other, using the default policy of the input.
Unlike OutputPortInterface::createConnection, other can be the write port and this
the read port.
Implemented in RTT::base::InputPortInterface, and RTT::base::OutputPortInterface.
virtual bool RTT::base::PortInterface::createStream | ( | ConnPolicy const & | policy | ) | [pure virtual] |
Creates a data stream from or to this port using connection-less transports.
Typically, policy.transport and policy.name_id must be properly filled in such that the data stream can be set up and input and output port can find each other. You need to call this method on two ports (input and output) using the same transport and (probably) same name_id.
policy | The connection policy describing how the stream must be set up. |
Implemented in RTT::OutputPort< T >, and RTT::InputPort< T >.
virtual bool RTT::base::PortInterface::disconnect | ( | PortInterface * | port | ) | [pure virtual] |
Removes the connection that links this port and the given port.
Returns true if there was such a connection, false otherwise
Implemented in RTT::base::OutputPortInterface, and RTT::base::InputPortInterface.
PortInterface & PortInterface::doc | ( | const std::string & | desc | ) |
Set the documentation of this port.
desc | The description of the port |
Definition at line 60 of file PortInterface.cpp.
References RTT::DataFlowInterface::setPortDescription().
Referenced by RTT::InputPort< T >::createPortObject().
const std::string& RTT::base::PortInterface::getDescription | ( | ) | const [inline] |
Get the documentation of this port.
Definition at line 91 of file PortInterface.hpp.
virtual const internal::ConnectionManager* RTT::base::PortInterface::getManager | ( | ) | const [pure virtual] |
Returns the connection manager of this port (if any).
This method provides access to the internals of this port in order to allow connection introspection.
Implemented in RTT::base::InputPortInterface, and RTT::base::OutputPortInterface.
virtual bool RTT::base::PortInterface::removeConnection | ( | internal::ConnID * | cid | ) | [pure virtual] |
Removes a user created connection from this port.
This is an advanced method, prefer to use disconnect() or a method from a subclass of PortInterface.
Implemented in RTT::base::OutputPortInterface, and RTT::base::InputPortInterface.
void PortInterface::setInterface | ( | DataFlowInterface * | iface | ) |
Once a port is added to a DataFlowInterface, it gets a pointer to that interface.
This allows advanced ports to track back to which component they belong.
Definition at line 92 of file PortInterface.cpp.
Referenced by RTT::DataFlowInterface::addLocalPort().
bool PortInterface::setName | ( | const std::string & | name | ) |
Change the name of this unconnected Port.
One can only change the name when it is not yet connected.
true | if !this->connected(), the name has changed. |
false | if this->connected(), the name has not been changed. |
Definition at line 51 of file PortInterface.cpp.
References connected().
Referenced by RTT::DataFlowInterface::addEventPort(), RTT::TaskContext::addEventPort(), RTT::DataFlowInterface::addPort(), and RTT::TaskContext::addPort().