RTT::PortInterface Class Reference

A Port of a task is used to connect it with other tasks using a Connector. More...

#include <rtt/PortInterface.hpp>

Inheritance diagram for RTT::PortInterface:
RTT::Corba::CorbaPort

List of all members.

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 TypeInfogetTypeInfo () 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 PortInterfaceclone () const =0
 Create a clone of this port with the same name.
virtual PortInterfaceantiClone () 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 TaskObjectcreatePortObject ()
 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

Detailed Description

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.


Member Function Documentation

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.

Returns:
true if a successful connection could be made.

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().

Return values:
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.

  • If this port is already connected, this method returns false.
  • If the other port has a connection, this method is equivalent to 'this->connectTo( other->connection() )'.
  • If the other port is not connected, a new connection is created and both ports are connected.
    Returns:
    true upon success, false otherwise.

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().

Returns:
true if connection was possible, false otherwise.

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.

Returns:
null if this->connected() or this->getConnectionModel() != Data else a valid connection object is returned.

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.

Returns:
null if this->connected() or this->getConnectionModel() != Buffered else a valid connection object is returned.

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.

Return values:
true if !this->connected(), the name has changed.
false if this->connected(), the name has not been changed.

The documentation for this class was generated from the following file:
Generated on Thu Dec 23 13:22:43 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3