A Port of a task is used to connect it with other tasks using a Connector. More...
#include <rtt/PortInterface.hpp>
Public Types | |
enum | PortType { ReadPort, WritePort, ReadWritePort } |
This enum classifies if a port is inbound outbound or both. | |
enum | ConnectionModel { Buffered, Data } |
This enum classifies the kind of data connections that are available through ports: buffered or data. | |
typedef Event< void(PortInterface *) | NewDataOnPortEvent ) |
Public Member Functions | |
const std::string & | getName () const |
Get the name of this Port. | |
bool | setName (const std::string &name) |
Change the name of this unconnected Port. | |
bool | ready () const |
Returns true if this Port is ready to be used. | |
void | signal () |
Call this method to signal that new data is available on this port. | |
NewDataOnPortEvent * | getNewDataOnPortEvent () |
Returns an Event object which is triggered every time new data is made available on this port. | |
virtual ConnectionModel | getConnectionModel () const =0 |
Get the ConnectionModel of this port. | |
virtual PortType | getPortType () const =0 |
Get the PortType of this port. | |
virtual const TypeInfo * | getTypeInfo () const =0 |
Get the data type of this port. | |
virtual bool | connected () const =0 |
Inspect if this Port is currently connected with another Port. | |
virtual ConnectionInterface::shared_ptr | connection () const =0 |
Returns the connection in which this Port currently participates. | |
virtual bool | connectTo (ConnectionInterface::shared_ptr conn)=0 |
Connect this port to a Connection. | |
virtual bool | connectTo (PortInterface *other) |
Connect to another Port and create a new connection if necessary. | |
virtual void | disconnect ()=0 |
No longer participate in a connection. | |
virtual PortInterface * | clone () const =0 |
Create a clone of this port with the same name. | |
virtual PortInterface * | antiClone () const =0 |
Create the anti-clone (inverse port) of this port with the same name A port for reading will return a new port for writing and vice versa. | |
virtual ConnectionInterface::shared_ptr | createConnection (ConnectionTypes::ConnectionType con_type=ConnectionTypes::lockfree) |
Create a new connection object to which this port is subscribed. | |
virtual ConnectionInterface::shared_ptr | createConnection (BufferBase::shared_ptr buf) |
Create a new connection object using a buffered connection implementation. | |
virtual ConnectionInterface::shared_ptr | createConnection (DataSourceBase::shared_ptr data) |
Create a new connection object using a data connection implementation. | |
virtual TaskObject * | createPortObject () |
Create accessor Object for this Port, for addition to a TaskContext Object interface. | |
virtual int | serverProtocol () const |
Returns the protocol over which this port can be accessed. | |
Protected Member Functions | |
PortInterface (const std::string &name) | |
virtual bool | connect (ConnectionInterface::shared_ptr conn)=0 |
Connects this port to a connection object. | |
Protected Attributes | |
std::string | portname |
NewDataOnPortEvent * | new_data_on_port_event |
Friends | |
class | ConnectionInterface |
A Port of a task is used to connect it with other tasks using a Connector.
The Connector can be a Buffer or a DataObject.
Definition at line 56 of file PortInterface.hpp.
virtual bool RTT::PortInterface::connect | ( | ConnectionInterface::shared_ptr | conn | ) | [protected, pure virtual] |
Connects this port to a connection object.
This function must test if this port is compatible with conn.
Implemented in RTT::Corba::CorbaPort.
virtual ConnectionInterface::shared_ptr RTT::PortInterface::connection | ( | ) | const [pure virtual] |
Returns the connection in which this Port currently participates.
It is possible that this port is part of a dormant connection, ( the connection object is not in the connected() state), in that case this method will return null, until the dormant connection becomes connected().
null | if not connected to another Port. |
Implemented in RTT::Corba::CorbaPort.
virtual bool RTT::PortInterface::connectTo | ( | PortInterface * | other | ) | [virtual] |
Connect to another Port and create a new connection if necessary.
Referenced by RTT::ReadBufferPort< T >::antiClone().
virtual bool RTT::PortInterface::connectTo | ( | ConnectionInterface::shared_ptr | conn | ) | [pure virtual] |
Connect this port to a Connection.
If the connection is in the connected() state, this port will participate in that connection, otherwise, the port will become connected once conn becomes connected().
Implemented in RTT::Corba::CorbaPort.
virtual ConnectionInterface::shared_ptr RTT::PortInterface::createConnection | ( | DataSourceBase::shared_ptr | data | ) | [virtual] |
Create a new connection object using a data connection implementation.
Reimplemented in RTT::Corba::CorbaPort.
virtual ConnectionInterface::shared_ptr RTT::PortInterface::createConnection | ( | BufferBase::shared_ptr | buf | ) | [virtual] |
Create a new connection object using a buffered connection implementation.
Reimplemented in RTT::Corba::CorbaPort.
bool RTT::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. |