Orocos Real-Time Toolkit  2.5.0
Public Member Functions | Protected Member Functions | Protected Attributes
RTT::base::OutputPortInterface Class Reference

The base class of each OutputPort. More...

#include <rtt/base/OutputPortInterface.hpp>

Inheritance diagram for RTT::base::OutputPortInterface:
RTT::base::PortInterface RTT::corba::RemotePort< base::OutputPortInterface > RTT::OutputPort< T > RTT::corba::RemoteOutputPort

List of all members.

Public Member Functions

virtual bool addConnection (internal::ConnID *port_id, ChannelElementBase::shared_ptr channel_input, ConnPolicy const &policy)
 Adds a new connection to this output port and initializes the connection if required by policy.
 OutputPortInterface (std::string const &name)
virtual bool keepsLastWrittenValue () const =0
 Returns true if this port records the last written value.
virtual void keepLastWrittenValue (bool new_flag)=0
 Change the setting for keeping the last written value.
virtual DataSourceBase::shared_ptr getDataSource () const =0
 Returns a Data source that stores the last written value, or a null pointer if this port does not keep its last written value.
virtual void disconnect ()
 Removes any connection that either go to or come from this port.
virtual bool connected () const
 Returns true if there is at least one channel registered in this port's list of outputs.
virtual void write (DataSourceBase::shared_ptr source)
 Write this port using the value stored in source.
bool createDataConnection (InputPortInterface &sink, int lock_policy=ConnPolicy::LOCK_FREE)
 Connects this write port to the given read port, using a single-data policy with the given locking mechanism.
bool createBufferConnection (InputPortInterface &sink, int size, int lock_policy=ConnPolicy::LOCK_FREE)
 Connects this write port to the given read port, using a buffered policy, with the buffer of the given size and the given locking mechanism.
bool createConnection (InputPortInterface &sink)
 Connects this write port to the given read port, using as policy the default policy of the sink port.
virtual bool createConnection (InputPortInterface &sink, ConnPolicy const &policy)=0
 Connects this write port to the given read port, using the given connection policy.
virtual bool disconnect (PortInterface *port)
 Removes the channel that connects this port to port.
virtual bool removeConnection (internal::ConnID *cid)
 Removes the connection associated with this channel, and the channel as well.
virtual bool connectTo (PortInterface *other, ConnPolicy const &policy)
 Connects this port with other, using the given policy.
virtual bool connectTo (PortInterface *other)
 Connects this port with other, using the default policy of the input.
virtual const
internal::ConnectionManager
getManager () const
 Returns the connection manager of this port (if any).
virtual internal::ConnIDgetPortID () 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.
PortInterfacedoc (const std::string &desc)
 Set the documentation of this port.
virtual const types::TypeInfogetTypeInfo () const =0
 Returns the types::TypeInfo object for the port's type.
virtual internal::ConnFactorygetConnFactory ()
 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 PortInterfaceclone () const =0
 Create a local clone of this port with the same name.
virtual PortInterfaceantiClone () const =0
 Create a local clone of this port with the same name.
virtual ServicecreatePortObject ()
 Create accessor Object for this Port, for addition to a TaskContext Object interface.
virtual bool createStream (ConnPolicy const &policy)=0
 Creates a data stream from or to this port using connection-less transports.
void setInterface (DataFlowInterface *iface)
 Once a port is added to a DataFlowInterface, it gets a pointer to that interface.
DataFlowInterfacegetInterface () const
 Returns the DataFlowInterface this port belongs to or null if it was not added to such an interface.

Protected Member Functions

virtual bool connectionAdded (ChannelElementBase::shared_ptr channel_input, ConnPolicy const &policy)=0
 Upcall to OutputPort.
 OutputPortInterface (OutputPortInterface const &orig)

Protected Attributes

internal::ConnectionManager cmanager
DataFlowInterfaceiface

Detailed Description

The base class of each OutputPort.

It contains the connection management code, which is independent of the actual data being transmitted.

Definition at line 53 of file OutputPortInterface.hpp.


Member Function Documentation

bool OutputPortInterface::addConnection ( internal::ConnID port_id,
ChannelElementBase::shared_ptr  channel_input,
ConnPolicy const &  policy 
) [virtual]

Adds a new connection to this output port and initializes the connection if required by policy.

Use with care. Allows you to add any arbitrary connection to this output port. It is your responsibility to do any further bookkeeping, such as informing the input that a new output has been added.

Implements RTT::base::PortInterface.

Definition at line 72 of file OutputPortInterface.cpp.

References RTT::internal::ConnectionManager::addConnection(), and connectionAdded().

Referenced by RTT::internal::ConnFactory::createAndCheckStream().

virtual PortInterface* RTT::base::PortInterface::antiClone ( ) const [pure virtual, inherited]

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, inherited]

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.

bool OutputPortInterface::connected ( ) const [virtual]

Returns true if there is at least one channel registered in this port's list of outputs.

Returns true if this port is connected.

Implements RTT::base::PortInterface.

Definition at line 59 of file OutputPortInterface.cpp.

References RTT::internal::ConnectionManager::connected().

bool OutputPortInterface::connectTo ( PortInterface other,
ConnPolicy const &  policy 
) [virtual]

Connects this port with other, using the given policy.

Unlike OutputPortInterface::createConnection, other can be the write port and this the read port.

Returns:
true on success, false on failure

Implements RTT::base::PortInterface.

Definition at line 100 of file OutputPortInterface.cpp.

References createConnection().

bool OutputPortInterface::connectTo ( PortInterface other) [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.

Returns:
true on success, false on failure

Implements RTT::base::PortInterface.

Definition at line 108 of file OutputPortInterface.cpp.

References createConnection().

virtual bool RTT::base::PortInterface::createStream ( ConnPolicy const &  policy) [pure virtual, inherited]

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.

Parameters:
policyThe connection policy describing how the stream must be set up.

Implemented in RTT::OutputPort< T >, and RTT::InputPort< T >.

PortInterface & PortInterface::doc ( const std::string &  desc) [inherited]

Set the documentation of this port.

Parameters:
descThe description of the port
Returns:
a reference to this object.

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, inherited]

Get the documentation of this port.

Returns:
A description.

Definition at line 91 of file PortInterface.hpp.

virtual const internal::ConnectionManager* RTT::base::OutputPortInterface::getManager ( ) const [inline, 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.

Returns:
null if no such manager is available, or the manager otherwise.
See also:
ConnectionManager::getChannels() for a list of all connections of this port.

Implements RTT::base::PortInterface.

Definition at line 142 of file OutputPortInterface.hpp.

virtual void RTT::base::OutputPortInterface::keepLastWrittenValue ( bool  new_flag) [pure virtual]

Change the setting for keeping the last written value.

Setting this to false will clear up any unneeded storage. If set, this port can initialize new connections with a data sample and allows real-time data transport of dynamically sized objects over its newly created connections.

See also:
OutputPort::OutputPort.

Implemented in RTT::OutputPort< T >, and RTT::corba::RemoteOutputPort.

void PortInterface::setInterface ( DataFlowInterface iface) [inherited]

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) [inherited]

Change the name of this unconnected Port.

One can only change the name when it is not yet connected.

Return values:
trueif !this->connected(), the name has changed.
falseif this->connected(), the name has not been changed.

Definition at line 51 of file PortInterface.cpp.

References RTT::base::PortInterface::connected().

Referenced by RTT::DataFlowInterface::addEventPort(), RTT::TaskContext::addEventPort(), RTT::DataFlowInterface::addPort(), and RTT::TaskContext::addPort().


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