Orocos Real-Time Toolkit  2.5.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
RTT::corba::RemoteInputPort Class Reference

Proxy for a remote input port. More...

#include <rtt/transports/corba/RemotePorts.hpp>

Inheritance diagram for RTT::corba::RemoteInputPort:
RTT::corba::RemotePort< base::InputPortInterface > RTT::internal::ConnFactory RTT::base::InputPortInterface RTT::base::PortInterface

List of all members.

Public Member Functions

 RemoteInputPort (types::TypeInfo const *type_info, CDataFlowInterface_ptr dataflow, std::string const &name, PortableServer::POA_ptr poa)
internal::ConnFactorygetConnFactory ()
 The ChannelFactory object that allows to build the ChannelElement chain needed to build connections to or from this port.
base::ChannelElementBase::shared_ptr buildRemoteChannelOutput (base::OutputPortInterface &output_port, types::TypeInfo const *type, base::InputPortInterface &reader_, ConnPolicy const &policy)
 This method will do more than just building the output half, it will create the two crucial ChannelElements on both sides of the CORBA connection to marshal/demarshal the channel data.
base::PortInterfaceclone () const
 Create a local clone of this port with the same name.
base::PortInterfaceantiClone () const
 Create a local clone of this port with the same name.
base::DataSourceBasegetDataSource ()
 Returns a DataSourceBase interface to read this port.
virtual bool channelReady (base::ChannelElementBase::shared_ptr channel)
 For remote input port objects, this is forwarded to the other end over the Data Flow Interface.
PortableServer::POA_ptr _default_POA ()
CDataFlowInterface_ptr getDataFlowInterface () const
internal::ConnIDgetPortID () const
 Returns the identity of this port in a ConnID object.
types::TypeInfo const * getTypeInfo () const
 Returns the types::TypeInfo object for the port's type.
int serverProtocol () const
 Returns the protocol over which this port can be accessed.
bool connected () const
 Returns true if this port is connected.
bool createStream (const ConnPolicy &policy)
 Creates a data stream from or to this port using connection-less transports.
void disconnect ()
 Removes any connection that either go to or come from this port *and* removes all callbacks and cleans up the NewDataOnPortEvent.
bool disconnect (base::PortInterface *p)
 Removes the channel that connects this port to port.
void clear ()
 Clears the connection.
ConnPolicy getDefaultPolicy () const
virtual bool removeConnection (internal::ConnID *cid)
 Removes the input channel.
virtual FlowStatus read (DataSourceBase::shared_ptr source, bool copy_old_data=true)
 Reads the port and updates the value hold by the given data source.
void signalInterface (bool true_false)
 When called with true, will signal the DataFlowInterface when new data is available.
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).
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 bool isLocal () const
 Returns true if this port is located on this process, and false otherwise.
virtual ServicecreatePortObject ()
 Create accessor Object for this Port, for addition to a TaskContext Object interface.
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.

Static Public Member Functions

template<typename T >
static base::ChannelElementBasebuildDataStorage (ConnPolicy const &policy, const T &initial_value=T())
 This method creates the connection element that will store data inside the connection, based on the given policy.
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildChannelInput (OutputPort< T > &port, ConnID *conn_id, base::ChannelElementBase::shared_ptr output_channel)
 During the process of building a connection between two ports, this method builds the input half (starting from the OutputPort).
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildBufferedChannelInput (OutputPort< T > &port, ConnID *conn_id, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr output_channel)
 Extended version of buildChannelInput that also installs a buffer after the channel input endpoint, according to a policy.
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildChannelOutput (InputPort< T > &port, ConnID *conn_id)
 During the process of building a connection between two ports, this method builds the output part of the channel, that is the half that is connected to the input port.
template<typename T >
static
base::ChannelElementBase::shared_ptr 
buildBufferedChannelOutput (InputPort< T > &port, ConnID *conn_id, ConnPolicy const &policy, T const &initial_value=T())
 Extended version of buildChannelOutput that also installs a buffer before the channel output endpoint, according to a policy.
template<typename T >
static bool createConnection (OutputPort< T > &output_port, base::InputPortInterface &input_port, ConnPolicy const &policy)
 Creates a connection from a local output_port to a local or remote input_port.
template<class T >
static bool createStream (OutputPort< T > &output_port, ConnPolicy const &policy)
 Creates, attaches and checks an outbound stream to an Output port.
template<class T >
static bool createStream (InputPort< T > &input_port, ConnPolicy const &policy)
 Creates, attaches and checks an inbound stream to an Input port.
static bool createAndCheckStream (base::OutputPortInterface &output_port, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr chan, StreamConnID *conn_id)

Protected Member Functions

virtual bool addConnection (internal::ConnID *port_id, base::ChannelElementBase::shared_ptr channel_input, ConnPolicy const &policy)
 The ConnectionFactory calls this.
bool connectionAdded (base::ChannelElementBase::shared_ptr channel, ConnPolicy const &policy)
void signal ()
 The ConnOutputEndpoint signals that new data is available.

Static Protected Member Functions

static bool createAndCheckStream (base::InputPortInterface &input_port, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr outhalf, StreamConnID *conn_id)
static bool createAndCheckConnection (base::OutputPortInterface &output_port, base::InputPortInterface &input_port, base::ChannelElementBase::shared_ptr channel_input, ConnPolicy policy)
static
base::ChannelElementBase::shared_ptr 
createRemoteConnection (base::OutputPortInterface &output_port, base::InputPortInterface &input_port, ConnPolicy const &policy)
template<class T >
static
base::ChannelElementBase::shared_ptr 
createOutOfBandConnection (OutputPort< T > &output_port, InputPort< T > &input_port, ConnPolicy const &policy)
 This code is for setting up an in-process out-of-band connection.
static
base::ChannelElementBase::shared_ptr 
createAndCheckOutOfBandConnection (base::OutputPortInterface &output_port, base::InputPortInterface &input_port, ConnPolicy const &policy, base::ChannelElementBase::shared_ptr output_half, StreamConnID *conn_id)

Protected Attributes

types::TypeInfo const * type_info
CDataFlowInterface_var dataflow
PortableServer::POA_var mpoa
internal::ConnectionManager cmanager
ConnPolicy default_policy
bool msignal_interface
DataFlowInterfaceiface

Detailed Description

Proxy for a remote input port.

Since it inherits from ConnFactory, it also allows for building an output endpoint. You can not access its datasource.

Definition at line 123 of file RemotePorts.hpp.


Member Function Documentation

virtual bool RTT::corba::RemoteInputPort::addConnection ( internal::ConnID port_id,
base::ChannelElementBase::shared_ptr  channel_input,
ConnPolicy const &  policy 
) [inline, protected, virtual]

The ConnectionFactory calls this.

Overload to do nothing when dealing with remote ports.

Parameters:
port_id
channel_input
policy
Returns:

Reimplemented from RTT::corba::RemotePort< base::InputPortInterface >.

Definition at line 137 of file RemotePorts.hpp.

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.

Implements RTT::base::PortInterface.

Definition at line 202 of file RemotePorts.cpp.

References RTT::base::PortInterface::getName(), and RTT::types::TypeInfo::outputPort().

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildBufferedChannelInput ( OutputPort< T > &  port,
ConnID conn_id,
ConnPolicy const &  policy,
base::ChannelElementBase::shared_ptr  output_channel 
) [inline, static, inherited]

Extended version of buildChannelInput that also installs a buffer after the channel input endpoint, according to a policy.

Parameters:
portThe output port to which the connection will be added by client code.
conn_idA unique connection id which identifies this connection
policyThe policy dictating which kind of buffer must be installed. The transport and other parameters are ignored.
output_channelOptional. If present, the buffer will be connected to this element.

Definition at line 193 of file ConnFactory.hpp.

References RTT::base::ChannelElementBase::setOutput().

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildBufferedChannelOutput ( InputPort< T > &  port,
ConnID conn_id,
ConnPolicy const &  policy,
T const &  initial_value = T() 
) [inline, static, inherited]

Extended version of buildChannelOutput that also installs a buffer before the channel output endpoint, according to a policy.

Parameters:
portThe input port to which the connection is added.
conn_idA unique connection id which identifies this connection
policyThe policy dictating which kind of buffer must be installed. The transport and other parameters are ignored.
initial_valueThe value to use to initialize the connection's storage buffer.

Definition at line 229 of file ConnFactory.hpp.

References RTT::base::ChannelElementBase::setOutput().

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildChannelInput ( OutputPort< T > &  port,
ConnID conn_id,
base::ChannelElementBase::shared_ptr  output_channel 
) [inline, static, inherited]

During the process of building a connection between two ports, this method builds the input half (starting from the OutputPort).

The output_channel argument is the connection element that has been returned by buildChannelOutput.

See also:
buildChannelOutput

Definition at line 173 of file ConnFactory.hpp.

References RTT::base::ChannelElementBase::setOutput().

template<typename T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::buildChannelOutput ( InputPort< T > &  port,
ConnID conn_id 
) [inline, static, inherited]

During the process of building a connection between two ports, this method builds the output part of the channel, that is the half that is connected to the input port.

The returned value is the connection element that should be connected to the end of the input-half.

See also:
buildChannelInput

Definition at line 212 of file ConnFactory.hpp.

template<typename T >
static base::ChannelElementBase* RTT::internal::ConnFactory::buildDataStorage ( ConnPolicy const &  policy,
const T &  initial_value = T() 
) [inline, static, inherited]

This method creates the connection element that will store data inside the connection, based on the given policy.

Todo:
: shouldn't this belong in the template type info ? This allows the type lib to choose which locked/lockfree algorithms are implemented and leaves out 4x code generation for each alternative in each compilation unit.

Contra: needs T in typelib.

Todo:
: since setDataSample, initial_value is no longer needed.

Definition at line 113 of file ConnFactory.hpp.

References RTT::ConnPolicy::lock_policy, RTT::ConnPolicy::size, and RTT::ConnPolicy::type.

RTT::base::ChannelElementBase::shared_ptr RemoteInputPort::buildRemoteChannelOutput ( base::OutputPortInterface output_port,
types::TypeInfo const *  type,
base::InputPortInterface reader_,
RTT::ConnPolicy const &  policy 
) [virtual]

This method will do more than just building the output half, it will create the two crucial ChannelElements on both sides of the CORBA connection to marshal/demarshal the channel data.

The policy is used to determine if storage must be allocated remotely or (has been allocated) locally. reader_ is ignored and must be this.

Parameters:
output_portThe local port that will be sending data to the remote channel.
typeThe type of data to transport
reader_Ignored. Must be this.
policyThe policy for the ConnFactory.
Returns:
The local endpoint for the output.

Implements RTT::internal::ConnFactory.

Definition at line 120 of file RemotePorts.cpp.

References RTT::types::TypeInfo::buildDataStorage(), RTT::types::TypeTransporter::createStream(), RTT::base::PortInterface::getInterface(), RTT::base::PortInterface::getName(), RTT::types::TypeInfo::getProtocol(), RTT::types::TypeInfo::getTypeName(), RTT::ConnPolicy::name_id, RTT::ConnPolicy::pull, and RTT::ConnPolicy::transport.

bool RemoteInputPort::channelReady ( base::ChannelElementBase::shared_ptr  channel) [virtual]

For remote input port objects, this is forwarded to the other end over the Data Flow Interface.

The given channel must be the output endpoint of a connection, which was built using buildRemoteChannelOutput. So channel->getOutputEndpoint() == channel

Returns:

Reimplemented from RTT::base::InputPortInterface.

Definition at line 206 of file RemotePorts.cpp.

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

void InputPortInterface::clear ( ) [inherited]

Clears the connection.

After call to read() will return false after clear() has been called

Definition at line 145 of file InputPortInterface.cpp.

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

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.

Implements RTT::base::PortInterface.

Definition at line 199 of file RemotePorts.cpp.

References RTT::base::PortInterface::getName(), and RTT::types::TypeInfo::inputPort().

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

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 84 of file InputPortInterface.cpp.

References RTT::base::OutputPortInterface::createConnection(), and RTT::base::PortInterface::getName().

Referenced by RTT::base::InputPortInterface::connectTo().

bool InputPortInterface::connectTo ( PortInterface other) [virtual, inherited]

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 94 of file InputPortInterface.cpp.

References RTT::base::InputPortInterface::connectTo().

bool ConnFactory::createAndCheckStream ( base::OutputPortInterface output_port,
ConnPolicy const &  policy,
base::ChannelElementBase::shared_ptr  chan,
StreamConnID conn_id 
) [static, inherited]
template<typename T >
static bool RTT::internal::ConnFactory::createConnection ( OutputPort< T > &  output_port,
base::InputPortInterface input_port,
ConnPolicy const &  policy 
) [inline, static, inherited]

Creates a connection from a local output_port to a local or remote input_port.

This function contains all logic to decide on how connections must be created to local or remote input ports.

In order to set up out-of-band communication between input_port and output_port, use a different transport number in the policy parameter than the transport of the input port.

Definition at line 248 of file ConnFactory.hpp.

References RTT::OutputPort< T >::getLastWrittenValue(), RTT::base::PortInterface::getName(), RTT::base::PortInterface::getPortID(), RTT::base::PortInterface::isLocal(), and RTT::ConnPolicy::transport.

template<class T >
static base::ChannelElementBase::shared_ptr RTT::internal::ConnFactory::createOutOfBandConnection ( OutputPort< T > &  output_port,
InputPort< T > &  input_port,
ConnPolicy const &  policy 
) [inline, static, protected, inherited]

This code is for setting up an in-process out-of-band connection.

This means that both input and output port are present in the same process. This function is used when the policy dictates a transport protocol, but both ports are local.

Returns:
a channel element chain with a channel output endpoint, but no channel input endpoint.

Definition at line 344 of file ConnFactory.hpp.

References RTT::ConnPolicy::name_id.

bool RTT::corba::RemotePort< base::InputPortInterface >::createStream ( const ConnPolicy policy) [virtual, inherited]
template<class T >
static bool RTT::internal::ConnFactory::createStream ( OutputPort< T > &  output_port,
ConnPolicy const &  policy 
) [inline, static, inherited]

Creates, attaches and checks an outbound stream to an Output port.

Parameters:
output_portThe port to connect the stream to.
policyThe policy dictating which transport to use.
Returns:
true if the stream could be created and connected to output_port.

Definition at line 301 of file ConnFactory.hpp.

References RTT::ConnPolicy::name_id.

template<class T >
static bool RTT::internal::ConnFactory::createStream ( InputPort< T > &  input_port,
ConnPolicy const &  policy 
) [inline, static, inherited]

Creates, attaches and checks an inbound stream to an Input port.

Parameters:
input_portThe port to connect the stream to.
policyThe policy dictating which transport to use.
Returns:
true if the stream could be created and connected to input_port.

Definition at line 319 of file ConnFactory.hpp.

References RTT::ConnPolicy::name_id, and RTT::base::InputPortInterface::removeConnection().

bool RTT::corba::RemotePort< base::InputPortInterface >::disconnect ( base::PortInterface port) [virtual, inherited]

Reimplemented from RTT::base::InputPortInterface.

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

Returns a DataSourceBase interface to read this port.

The returned data source is always the same object and will be destroyed when the port is destroyed.

Implements RTT::base::InputPortInterface.

Definition at line 117 of file RemotePorts.cpp.

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::InputPortInterface::getManager ( ) const [inline, virtual, inherited]

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 160 of file InputPortInterface.hpp.

FlowStatus InputPortInterface::read ( DataSourceBase::shared_ptr  source,
bool  copy_old_data = true 
) [virtual, inherited]

Reads the port and updates the value hold by the given data source.

This is only valid for local ports.

source has to be an assignable data source

Reimplemented in RTT::InputPort< T >.

Definition at line 139 of file InputPortInterface.cpp.

bool InputPortInterface::removeConnection ( internal::ConnID cid) [virtual, inherited]

Removes the input channel.

Returns true if the provided channel was actually a channel of this port, and false otherwise.

You should usually not use this directly. Use disconnect() instead.

Implements RTT::base::PortInterface.

Definition at line 123 of file InputPortInterface.cpp.

Referenced by RTT::internal::ConnFactory::createStream(), and RTT::internal::ConnOutputEndpoint< T >::disconnect().

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: