Orocos Real-Time Toolkit
2.9.0
|
A component's data input port. More...
#include <rtt/InputPort.hpp>
Public Member Functions | |
InputPort (std::string const &name="unnamed", ConnPolicy const &default_policy=ConnPolicy()) | |
virtual | ~InputPort () |
void | clear () |
Clears the input buffer (or all input buffers), so that read() will return NoData before a new sample has been written. More... | |
FlowStatus | read (base::DataSourceBase::shared_ptr source) |
FlowStatus | read (base::DataSourceBase::shared_ptr source, bool copy_old_data) |
Reads the port and updates the value hold by the given data source. More... | |
FlowStatus | readNewest (base::DataSourceBase::shared_ptr source, bool copy_old_data=true) |
Read all new samples that are available on this port, and returns the last one. More... | |
FlowStatus | read (typename base::ChannelElement< T >::reference_t sample) |
FlowStatus | read (typename base::ChannelElement< T >::reference_t sample, bool copy_old_data) |
Reads a sample from the connection. More... | |
FlowStatus | readNewest (typename base::ChannelElement< T >::reference_t sample, bool copy_old_data=true) |
Read all new samples that are available on this port, and returns the last one. More... | |
void | getDataSample (T &sample) |
Get a sample of the data on this port, without actually reading the port's data. More... | |
virtual const types::TypeInfo * | getTypeInfo () const |
Returns the types::TypeInfo object for the port's type. More... | |
virtual base::PortInterface * | clone () const |
Create a clone of this port with the same name. More... | |
virtual base::PortInterface * | antiClone () const |
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. More... | |
base::DataSourceBase * | getDataSource () |
Returns a base::DataSourceBase interface to read this port. More... | |
virtual bool | createStream (ConnPolicy const &policy) |
Creates a data stream from or to this port using connection-less transports. More... | |
virtual Service * | createPortObject () |
Create accessor Object for this Port, for addition to a TaskContext Object interface. More... | |
virtual internal::ConnOutputEndpoint< T > * | getEndpoint () const |
Returns the input or output endpoint of this port (if any). More... | |
virtual base::ChannelElement< T >::shared_ptr | getSharedBuffer () const |
ConnPolicy | getDefaultPolicy () const |
virtual bool | addConnection (internal::ConnID *port_id, ChannelElementBase::shared_ptr channel, ConnPolicy const &policy) |
Adds a user created connection to this port. 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... | |
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 bool | createConnection (internal::SharedConnectionBase::shared_ptr shared_connection, ConnPolicy const &policy=ConnPolicy()) |
Connects the port to an existing shared connection instance. 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 bool | connectedTo (PortInterface *port) |
Returns true if this port is connected to the given port. 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 bool | removeConnection (internal::ConnID *cid) |
Removes a user created connection from this port. 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... | |
virtual internal::ConnectionManager * | getManager () |
Returns the connection manager of this port (if any). More... | |
virtual internal::SharedConnectionBase::shared_ptr | getSharedConnection () const |
Returns a pointer to the shared connection element this port may be connected to. More... | |
Protected Member Functions | |
void | signal () |
The ConnOutputEndpoint signals that new data is available. More... | |
Protected Attributes | |
ConnPolicy | default_policy |
bool | msignal_interface |
DataFlowInterface * | iface |
internal::ConnectionManager | cmanager |
Friends | |
class | internal::ConnOutputEndpoint< T > |
A component's data input port.
An Orocos input port is used to receive data samples from a distant publisher. The InputPort is read() and returns true if a sample is available.
Ideally, your algorithm should not assume a certain connection policy being used from output to input. So it should work on data connections and buffer connections.
Definition at line 63 of file InputPort.hpp.
|
inline |
Definition at line 81 of file InputPort.hpp.
|
inlinevirtual |
Definition at line 86 of file InputPort.hpp.
References RTT::base::InputPortInterface::disconnect().
|
virtualinherited |
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.
Referenced by RTT::internal::ConnOutputEndpoint< T >::channelReady(), and RTT::internal::ConnFactory::createAndCheckSharedConnection().
|
inlinevirtual |
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.
Implements RTT::base::PortInterface.
Definition at line 194 of file InputPort.hpp.
References RTT::base::PortInterface::getName().
|
virtualinherited |
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 138 of file InputPortInterface.cpp.
|
inlinevirtual |
Clears the input buffer (or all input buffers), so that read() will return NoData before a new sample has been written.
Implements RTT::base::InputPortInterface.
Definition at line 91 of file InputPort.hpp.
References RTT::InputPort< T >::getEndpoint().
Referenced by RTT::internal::InputPortSource< T >::reset().
|
inlinevirtual |
Create a clone of this port with the same name.
Implements RTT::base::PortInterface.
Definition at line 186 of file InputPort.hpp.
References RTT::base::PortInterface::getName().
|
virtualinherited |
Returns true if this port is connected.
Implements RTT::base::PortInterface.
Reimplemented in RTT::corba::RemotePort< base::InputPortInterface >.
Definition at line 120 of file InputPortInterface.cpp.
|
virtualinherited |
Returns true if this port is connected to the given port.
Definition at line 67 of file PortInterface.cpp.
References RTT::base::PortInterface::cmanager, and RTT::internal::ConnectionManager::connectedTo().
Referenced by RTT::internal::ConnFactory::createConnection().
|
virtualinherited |
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().
|
virtualinherited |
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 |
Connects the port to an existing shared connection instance.
Implements RTT::base::PortInterface.
Reimplemented in RTT::corba::RemoteInputPort.
Definition at line 133 of file InputPortInterface.cpp.
References RTT::internal::ConnFactory::createAndCheckSharedConnection().
Referenced by RTT::corba::RemoteInputPort::addConnection(), RTT::internal::ConnFactory::buildSharedConnection(), and RTT::corba::CDataFlowInterface_i::deregisterChannel().
|
inlinevirtual |
Create accessor Object for this Port, for addition to a TaskContext Object interface.
Reimplemented from RTT::base::PortInterface.
Definition at line 215 of file InputPort.hpp.
References RTT::base::InputPortInterface::clear(), RTT::base::PortInterface::createPortObject(), and RTT::base::PortInterface::doc().
|
inlinevirtual |
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. |
Implements RTT::base::PortInterface.
Definition at line 205 of file InputPort.hpp.
References RTT::internal::ConnFactory::createStream().
|
virtualinherited |
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 123 of file InputPortInterface.cpp.
Referenced by RTT::InputPort< T >::~InputPort().
|
virtualinherited |
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 128 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(), and RTT::corba::TaskContextProxy::synchronizePorts().
|
inline |
Get a sample of the data on this port, without actually reading the port's data.
It's the complement of OutputPort::setDataSample() and serves to retrieve the size of a variable sized data type T. Returns default T if !connected() or if the OutputPort did not use setDataSample(). Returns an example T otherwise. In case multiple inputs are connected to this port a sample from the currently read connection will be returned.
Definition at line 174 of file InputPort.hpp.
References RTT::InputPort< T >::getEndpoint().
Referenced by RTT::internal::InputPortSource< T >::InputPortSource().
|
inlinevirtual |
Returns a base::DataSourceBase interface to read this port.
The returned data source is always a new object.
Implements RTT::base::InputPortInterface.
Definition at line 200 of file InputPort.hpp.
|
inherited |
Definition at line 74 of file InputPortInterface.cpp.
Referenced by RTT::base::OutputPortInterface::createBufferConnection().
|
inlineinherited |
Get the documentation of this port.
Definition at line 93 of file PortInterface.hpp.
Referenced by RTT::corba::CDataFlowInterface_i::_default_POA().
|
inlinevirtual |
Returns the input or output endpoint of this port (if any).
This method provides access to the internals of this port in order to access connected channel objects directly.
Implements RTT::base::PortInterface.
Definition at line 227 of file InputPort.hpp.
Referenced by RTT::internal::ConnFactory::buildChannelOutput(), RTT::InputPort< T >::clear(), RTT::InputPort< T >::getDataSample(), RTT::InputPort< T >::getSharedBuffer(), and RTT::InputPort< T >::read().
|
inherited |
Returns the DataFlowInterface this port belongs to or null if it was not added to such an interface.
Definition at line 104 of file PortInterface.cpp.
References RTT::base::PortInterface::iface.
Referenced by RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), RTT::corba::RemoteOutputPort::createConnection(), and RTT::mqueue::MQSendRecv::setupStream().
|
inlinevirtualinherited |
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.
Definition at line 222 of file PortInterface.hpp.
Referenced by RTT::internal::ConnInputEndpoint< T >::disconnect(), and RTT::internal::ConnOutputEndpoint< T >::disconnect().
|
inlineinherited |
Get the name of this Port.
Definition at line 79 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::internal::ConnFactory::buildChannelInput(), RTT::corba::CorbaFallBackProtocol::buildChannelOutput(), RTT::internal::ConnFactory::buildChannelOutput(), RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), RTT::internal::ConnFactory::buildRemoteChannelOutput(), RTT::internal::ConnFactory::buildSharedConnection(), RTT::corba::RemoteOutputPort::clone(), RTT::corba::RemoteInputPort::clone(), RTT::InputPort< T >::clone(), RTT::OutputPort< T >::clone(), RTT::TaskContext::connectPorts(), RTT::base::InputPortInterface::connectTo(), RTT::internal::ConnFactory::createAndCheckConnection(), RTT::internal::ConnFactory::createAndCheckSharedConnection(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::corba::RemoteOutputPort::createConnection(), RTT::corba::RemoteInputPort::createConnection(), RTT::internal::ConnFactory::createConnection(), RTT::base::PortInterface::createPortObject(), RTT::corba::CorbaFallBackProtocol::createStream(), RTT::corba::CDataFlowInterface_i::deregisterChannel(), RTT::corba::RemoteOutputPort::disconnect(), RTT::internal::ConnectionManager::eraseConnection(), RTT::internal::ConnFactory::findSharedConnection(), RTT::OutputPort< T >::setDataSample(), RTT::mqueue::MQSendRecv::setupStream(), and RTT::OutputPort< T >::write().
|
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 76 of file PortInterface.cpp.
Referenced by RTT::internal::ConnectionManager::connectedTo(), RTT::internal::ConnFactory::createAndCheckConnection(), and RTT::internal::ConnectionManager::disconnect().
|
inlinevirtual |
Definition at line 233 of file InputPort.hpp.
References RTT::InputPort< T >::getEndpoint().
Referenced by RTT::internal::ConnFactory::buildChannelOutput().
|
virtualinherited |
Returns a pointer to the shared connection element this port may be connected to.
Definition at line 109 of file PortInterface.cpp.
References RTT::base::PortInterface::cmanager, and RTT::internal::ConnectionManager::getSharedConnection().
Referenced by RTT::internal::ConnFactory::createAndCheckSharedConnection(), and RTT::internal::ConnFactory::findSharedConnection().
|
inlinevirtual |
Returns the types::TypeInfo object for the port's type.
Implements RTT::base::PortInterface.
Definition at line 180 of file InputPort.hpp.
References RTT::internal::DataSourceTypeInfo< T >::getTypeInfo().
|
virtualinherited |
Returns true if this port is located on this process, and false otherwise.
Definition at line 71 of file PortInterface.cpp.
References RTT::base::PortInterface::serverProtocol().
Referenced by RTT::internal::ConnFactory::buildSharedConnection(), RTT::internal::ConnFactory::createAndCheckSharedConnection(), and RTT::internal::ConnFactory::createConnection().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 97 of file InputPort.hpp.
Referenced by RTT::internal::InputPortSource< T >::evaluate(), RTT::InputPort< T >::read(), and RTT::InputPort< T >::readNewest().
|
inlinevirtual |
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 from RTT::base::InputPortInterface.
Definition at line 100 of file InputPort.hpp.
References RTT::Error, RTT::NoData, RTT::InputPort< T >::read(), and RTT::internal::AssignableDataSource< T >::set().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 131 of file InputPort.hpp.
References RTT::InputPort< T >::read().
|
inline |
Reads a sample from the connection.
sample is a reference which will get updated if a new sample is available.
The method returns an enum FlowStatus, which describes what type of sample (old or new data) or if a sample was returned (no data)
With the argument
Definition at line 145 of file InputPort.hpp.
References RTT::InputPort< T >::getEndpoint().
|
inline |
Read all new samples that are available on this port, and returns the last one.
Returns RTT::NewData if at least one new sample was available, and either RTT::OldData or RTT::NoData otherwise.
Definition at line 118 of file InputPort.hpp.
References RTT::Error, RTT::NoData, and RTT::internal::AssignableDataSource< T >::set().
|
inline |
Read all new samples that are available on this port, and returns the last one.
Returns RTT::NewData if at least one new sample was available, and either RTT::OldData or RTT::NoData otherwise.
Definition at line 156 of file InputPort.hpp.
References RTT::NewData, and RTT::InputPort< T >::read().
|
virtualinherited |
Removes a user created connection from this port.
This is an advanced method, prefer to use disconnect() or a method from a subclass of PortInterface.
Definition at line 95 of file PortInterface.cpp.
References RTT::base::PortInterface::cmanager, and RTT::internal::ConnectionManager::removeConnection().
Referenced by RTT::corba::CDataFlowInterface_i::deregisterChannel().
|
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 73 of file PortInterface.cpp.
Referenced by RTT::internal::ConnFactory::buildRemoteChannelOutput(), 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 100 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().
|
protectedinherited |
The ConnOutputEndpoint signals that new data is available.
Definition at line 107 of file InputPortInterface.cpp.
Referenced by RTT::internal::ConnOutputEndpoint< T >::signal().
|
inherited |
When called with true, will signal the DataFlowInterface when new data is available.
Definition at line 112 of file InputPortInterface.cpp.
Referenced by RTT::DataFlowInterface::addLocalEventPort().
|
friend |
Definition at line 66 of file InputPort.hpp.
|
protectedinherited |
Definition at line 64 of file PortInterface.hpp.
Referenced by RTT::base::OutputPortInterface::addConnection(), RTT::OutputPort< T >::clear(), RTT::base::OutputPortInterface::connected(), RTT::base::PortInterface::connectedTo(), RTT::base::OutputPortInterface::disconnect(), RTT::base::PortInterface::getSharedConnection(), RTT::base::PortInterface::removeConnection(), and RTT::base::OutputPortInterface::~OutputPortInterface().
|
protectedinherited |
Definition at line 69 of file InputPortInterface.hpp.
|
protectedinherited |
Definition at line 63 of file PortInterface.hpp.
Referenced by RTT::base::PortInterface::createPortObject(), RTT::base::PortInterface::doc(), RTT::base::PortInterface::getInterface(), and RTT::base::PortInterface::setInterface().
|
protectedinherited |
Definition at line 73 of file InputPortInterface.hpp.