Orocos Real-Time Toolkit
2.8.3
|
The base class of the InputPort. More...
#include <rtt/base/InputPortInterface.hpp>
Public Member Functions | |
InputPortInterface (std::string const &name, ConnPolicy const &default_policy=ConnPolicy()) | |
virtual | ~InputPortInterface () |
void | clear () |
Clears the connection. More... | |
ConnPolicy | getDefaultPolicy () const |
virtual bool | addConnection (internal::ConnID *port_id, ChannelElementBase::shared_ptr channel_input, ConnPolicy const &policy) |
Adds a user created connection to this port. More... | |
virtual bool | removeConnection (internal::ConnID *cid) |
Removes the input channel. More... | |
virtual DataSourceBase * | getDataSource ()=0 |
Returns a DataSourceBase interface to read this port. More... | |
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. More... | |
virtual void | disconnect () |
Removes any connection that either go to or come from this port and removes all callbacks and cleans up the NewDataOnPortEvent. More... | |
virtual bool | disconnect (PortInterface *port) |
Removes the channel that connects this port to port . More... | |
virtual bool | connected () const |
Returns true if this port is connected. More... | |
virtual bool | channelReady (base::ChannelElementBase::shared_ptr channel, ConnPolicy const &policy) |
Call this to indicate that the connection leading to this port is ready to use. More... | |
void | signalInterface (bool true_false) |
When called with true, will signal the DataFlowInterface when new data is available. More... | |
virtual bool | connectTo (PortInterface *other, ConnPolicy const &policy) |
Connects this port with other, using the given policy. More... | |
virtual bool | connectTo (PortInterface *other) |
Connects this port with other, using the default policy of the input. More... | |
virtual const internal::ConnectionManager * | getManager () const |
Returns the connection manager of this port (if any). More... | |
virtual base::ChannelElementBase::shared_ptr | buildRemoteChannelOutput (base::OutputPortInterface &output_port, types::TypeInfo const *type_info, base::InputPortInterface &input, const ConnPolicy &policy) |
This method is analoguous to the static ConnFactory::buildChannelOutput. More... | |
virtual internal::ConnID * | getPortID () const |
Returns the identity of this port in a ConnID object. More... | |
const std::string & | getName () const |
Get the name of this Port. More... | |
bool | setName (const std::string &name) |
Change the name of this unconnected Port. More... | |
const std::string & | getDescription () const |
Get the documentation of this port. More... | |
PortInterface & | doc (const std::string &desc) |
Set the documentation of this port. More... | |
virtual const types::TypeInfo * | getTypeInfo () const =0 |
Returns the types::TypeInfo object for the port's type. More... | |
virtual bool | isLocal () const |
Returns true if this port is located on this process, and false otherwise. More... | |
virtual int | serverProtocol () const |
Returns the protocol over which this port can be accessed. More... | |
virtual PortInterface * | clone () const =0 |
Create a local clone of this port with the same name. More... | |
virtual PortInterface * | antiClone () const =0 |
Create a local clone of this port with the same name. More... | |
virtual Service * | createPortObject () |
Create accessor Object for this Port, for addition to a TaskContext Object interface. More... | |
virtual bool | createStream (ConnPolicy const &policy)=0 |
Creates a data stream from or to this port using connection-less transports. More... | |
void | setInterface (DataFlowInterface *iface) |
Once a port is added to a DataFlowInterface, it gets a pointer to that interface. More... | |
DataFlowInterface * | getInterface () const |
Returns the DataFlowInterface this port belongs to or null if it was not added to such an interface. More... | |
Protected Member Functions | |
void | signal () |
The ConnOutputEndpoint signals that new data is available. More... | |
InputPortInterface (const InputPortInterface &orig) | |
Protected Attributes | |
internal::ConnectionManager | cmanager |
ConnPolicy | default_policy |
bool | msignal_interface |
DataFlowInterface * | iface |
The base class of the InputPort.
It contains the connection management code, which is independent of the actual data being transmitted.
Definition at line 60 of file InputPortInterface.hpp.
|
protected |
RTT::base::InputPortInterface::InputPortInterface | ( | std::string const & | name, |
ConnPolicy const & | default_policy = ConnPolicy() |
||
) |
|
virtual |
Definition at line 64 of file InputPortInterface.cpp.
|
virtual |
Adds a user created connection to this port.
This is an advanced method, prefer to use connectTo and createStream.
Implements RTT::base::PortInterface.
Reimplemented in RTT::corba::RemoteInputPort, and RTT::corba::RemotePort< base::InputPortInterface >.
Definition at line 100 of file InputPortInterface.cpp.
|
pure virtualinherited |
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 |
This method is analoguous to the static ConnFactory::buildChannelOutput.
It is provided for remote connection building: for these connections, no template can be used and therefore the connection setup should be done based on the types::TypeInfo object
Reimplemented in RTT::corba::RemoteInputPort.
Definition at line 170 of file InputPortInterface.cpp.
|
virtual |
Call this to indicate that the connection leading to this port is ready to use.
The input port will check its channel elements by sending an inputReady() message. If this succeeds, this function returns true and the input port is ready to use (this->connected() == true). If sending inputReady() returns failure, this method returns false and the connection is aborted (this->connected() == false).
Reimplemented in RTT::corba::RemoteInputPort.
Definition at line 107 of file InputPortInterface.cpp.
References RTT::Error.
Referenced by RTT::internal::ConnFactory::createAndCheckConnection(), RTT::internal::ConnFactory::createAndCheckStream(), and RTT::corba::CDataFlowInterface_i::deregisterChannel().
void InputPortInterface::clear | ( | ) |
Clears the connection.
After call to read() will return false after clear() has been called
Definition at line 155 of file InputPortInterface.cpp.
Referenced by RTT::InputPort< T >::createPortObject(), and RTT::internal::InputPortSource< T >::reset().
|
pure virtualinherited |
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 |
Returns true if this port is connected.
Implements RTT::base::PortInterface.
Reimplemented in RTT::corba::RemotePort< base::InputPortInterface >.
Definition at line 152 of file InputPortInterface.cpp.
|
virtual |
Connects this port with other, using the given policy.
Unlike OutputPortInterface::createConnection, other can be the write port and this
the read port.
Implements RTT::base::PortInterface.
Definition at line 85 of file InputPortInterface.cpp.
References RTT::base::OutputPortInterface::createConnection(), RTT::Error, and RTT::base::PortInterface::getName().
|
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.
Implements RTT::base::PortInterface.
Definition at line 95 of file InputPortInterface.cpp.
|
virtualinherited |
Create accessor Object for this Port, for addition to a TaskContext Object interface.
Reimplemented in RTT::OutputPort< T >, and RTT::InputPort< T >.
Definition at line 75 of file PortInterface.cpp.
References RTT::Service::addSynchronousOperation(), RTT::base::PortInterface::connected(), RTT::base::PortInterface::disconnect(), RTT::base::PortInterface::getName(), RTT::DataFlowInterface::getOwner(), and RTT::base::PortInterface::iface.
Referenced by RTT::InputPort< T >::createPortObject(), RTT::DataFlowInterface::createPortObject(), and RTT::OutputPort< T >::createPortObject().
|
pure virtualinherited |
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 >, RTT::InputPort< T >, RTT::corba::RemotePort< base::InputPortInterface >, and RTT::corba::RemotePort< base::OutputPortInterface >.
Referenced by RTT::corba::CDataFlowInterface_i::deregisterChannel().
|
virtual |
Removes any connection that either go to or come from this port and removes all callbacks and cleans up the NewDataOnPortEvent.
Implements RTT::base::PortInterface.
Reimplemented in RTT::corba::RemotePort< base::InputPortInterface >.
Definition at line 160 of file InputPortInterface.cpp.
Referenced by RTT::InputPort< T >::~InputPort().
|
virtual |
Removes the channel that connects this port to port
.
All other ports or callbacks remain unaffected.
Implements RTT::base::PortInterface.
Reimplemented in RTT::corba::RemoteInputPort.
Definition at line 165 of file InputPortInterface.cpp.
|
inherited |
Set the documentation of this port.
desc | The description of the port |
Definition at line 60 of file PortInterface.cpp.
References RTT::base::PortInterface::iface, and RTT::DataFlowInterface::setPortDescription().
Referenced by RTT::InputPort< T >::createPortObject().
|
pure virtual |
Returns a DataSourceBase interface to read this port.
The returned data source is always a new object.
Implemented in RTT::InputPort< T >, and RTT::corba::RemoteInputPort.
ConnPolicy InputPortInterface::getDefaultPolicy | ( | ) | const |
Definition at line 74 of file InputPortInterface.cpp.
Referenced by RTT::base::OutputPortInterface::createBufferConnection().
|
inlineinherited |
Get the documentation of this port.
Definition at line 91 of file PortInterface.hpp.
|
inherited |
Returns the DataFlowInterface this port belongs to or null if it was not added to such an interface.
Definition at line 95 of file PortInterface.cpp.
References RTT::base::PortInterface::iface.
Referenced by RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), RTT::corba::RemoteOutputPort::createConnection(), and RTT::mqueue::MQSendRecv::setupStream().
|
inlinevirtual |
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.
Implements RTT::base::PortInterface.
Definition at line 159 of file InputPortInterface.hpp.
|
inlineinherited |
Get the name of this Port.
Definition at line 77 of file PortInterface.hpp.
Referenced by RTT::DataFlowInterface::addEventPort(), RTT::DataFlowInterface::addLocalEventPort(), RTT::DataFlowInterface::addLocalPort(), RTT::DataFlowInterface::addPort(), RTT::corba::RemoteOutputPort::antiClone(), RTT::corba::RemoteInputPort::antiClone(), RTT::InputPort< T >::antiClone(), RTT::OutputPort< T >::antiClone(), RTT::corba::CorbaFallBackProtocol::buildChannelInput(), RTT::corba::CorbaFallBackProtocol::buildChannelOutput(), RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), RTT::corba::RemoteInputPort::channelReady(), RTT::corba::RemoteOutputPort::clone(), RTT::corba::RemoteInputPort::clone(), RTT::InputPort< T >::clone(), RTT::OutputPort< T >::clone(), RTT::TaskContext::connectPorts(), connectTo(), RTT::internal::ConnFactory::createAndCheckConnection(), RTT::internal::ConnFactory::createAndCheckOutOfBandConnection(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::corba::RemoteOutputPort::createConnection(), RTT::internal::ConnFactory::createConnection(), RTT::base::PortInterface::createPortObject(), RTT::internal::ConnFactory::createRemoteConnection(), RTT::corba::CorbaFallBackProtocol::createStream(), RTT::corba::CDataFlowInterface_i::deregisterChannel(), RTT::corba::RemoteOutputPort::disconnect(), and RTT::mqueue::MQSendRecv::setupStream().
|
virtualinherited |
Returns the identity of this port in a ConnID object.
Reimplemented in RTT::corba::RemotePort< base::InputPortInterface >, and RTT::corba::RemotePort< base::OutputPortInterface >.
Definition at line 72 of file PortInterface.cpp.
Referenced by RTT::internal::ConnFactory::createAndCheckConnection(), RTT::internal::ConnFactory::createConnection(), and RTT::internal::ConnectionManager::disconnect().
|
pure virtualinherited |
Returns the types::TypeInfo object for the port's type.
Implemented in RTT::OutputPort< T >, RTT::InputPort< T >, RTT::corba::RemotePort< base::InputPortInterface >, and RTT::corba::RemotePort< base::OutputPortInterface >.
Referenced by RTT::corba::CDataFlowInterface_i::_default_POA(), RTT::internal::ConnFactory::createAndCheckOutOfBandConnection(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::internal::ConnFactory::createRemoteConnection(), and RTT::corba::CDataFlowInterface_i::deregisterChannel().
|
virtualinherited |
Returns true if this port is located on this process, and false otherwise.
Definition at line 67 of file PortInterface.cpp.
References RTT::base::PortInterface::serverProtocol().
Referenced by RTT::internal::ConnFactory::createAndCheckOutOfBandConnection(), and RTT::internal::ConnFactory::createConnection().
|
virtual |
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 149 of file InputPortInterface.cpp.
|
virtual |
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 133 of file InputPortInterface.cpp.
Referenced by RTT::internal::ConnFactory::createStream(), and RTT::internal::ConnOutputEndpoint< T >::disconnect().
|
virtualinherited |
Returns the protocol over which this port can be accessed.
Reimplemented in RTT::corba::RemotePort< base::InputPortInterface >, and RTT::corba::RemotePort< base::OutputPortInterface >.
Definition at line 69 of file PortInterface.cpp.
Referenced by RTT::internal::ConnFactory::createRemoteConnection(), and RTT::base::PortInterface::isLocal().
|
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 91 of file PortInterface.cpp.
References RTT::base::PortInterface::iface.
Referenced by RTT::DataFlowInterface::addLocalPort(), and RTT::corba::CDataFlowInterface_i::deregisterChannel().
|
inherited |
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 RTT::base::PortInterface::connected().
Referenced by RTT::DataFlowInterface::addEventPort(), RTT::TaskContext::addEventPort(), RTT::DataFlowInterface::addPort(), and RTT::TaskContext::addPort().
|
protected |
The ConnOutputEndpoint signals that new data is available.
Definition at line 139 of file InputPortInterface.cpp.
Referenced by RTT::internal::ConnOutputEndpoint< T >::signal().
void InputPortInterface::signalInterface | ( | bool | true_false | ) |
When called with true, will signal the DataFlowInterface when new data is available.
Definition at line 144 of file InputPortInterface.cpp.
Referenced by RTT::DataFlowInterface::addLocalEventPort().
|
protected |
Definition at line 69 of file InputPortInterface.hpp.
Referenced by RTT::InputPort< T >::getDataSample(), and RTT::InputPort< T >::read().
|
protected |
Definition at line 70 of file InputPortInterface.hpp.
|
protectedinherited |
Definition at line 62 of file PortInterface.hpp.
Referenced by RTT::base::PortInterface::createPortObject(), RTT::base::PortInterface::doc(), RTT::base::PortInterface::getInterface(), and RTT::base::PortInterface::setInterface().
|
protected |
Definition at line 74 of file InputPortInterface.hpp.