A Port to a readable Data Connection. More...
#include <rtt/DataPort.hpp>
Inherits RTT::DataPortBase< T >.
Public Types | |
typedef T | DataType |
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 | |
ReadDataPort (const std::string &name) | |
Construct an unconnected Port to a readable data object. | |
T | Get () const |
Get the current value of this Port. | |
void | Get (T &result) |
Get the current value of this Port. | |
virtual PortInterface::PortType | getPortType () const |
Get the PortType of this port. | |
virtual PortInterface * | clone () const |
Create a clone of this port with the same name. | |
virtual 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. | |
virtual TaskObject * | createPortObject () |
Create accessor Object for this Port, for addition to a TaskContext Object interface. | |
ConnectionInterface::shared_ptr | createConnection (DataSourceBase::shared_ptr data) |
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 ConnectionModel | getConnectionModel () const |
virtual const TypeInfo * | getTypeInfo () const |
bool | connect (ConnectionInterface::shared_ptr conn) |
virtual ConnectionInterface::shared_ptr | connection () const |
bool | connected () const |
bool | connectTo (ConnectionInterface::shared_ptr other) |
virtual bool | connectTo (PortInterface *other) |
Connect to another Port and create a new connection if necessary. | |
void | disconnect () |
const DataObjectInterface< T > * | data () const |
Get the data object to read from. | |
DataObjectInterface< T > * | data () |
Get the data object to write to. | |
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 int | serverProtocol () const |
Returns the protocol over which this port can be accessed. | |
Protected Attributes | |
DataConnection< T >::shared_ptr | mconn |
The connection to read from. | |
std::string | portname |
NewDataOnPortEvent * | new_data_on_port_event |
Friends | |
class | ConnectionInterface |
A Port to a readable Data Connection.
Use connection() to access the data object. If the port is not connected, connection() returns null.
T | The type of the data of the data object. |
Definition at line 132 of file DataPort.hpp.
RTT::ReadDataPort< T >::ReadDataPort | ( | const std::string & | name | ) | [inline] |
Construct an unconnected Port to a readable data object.
name | The name of this port. |
Definition at line 144 of file DataPort.hpp.
virtual bool RTT::PortInterface::connectTo | ( | PortInterface * | other | ) | [virtual, inherited] |
Connect to another Port and create a new connection if necessary.
Referenced by RTT::ReadBufferPort< T >::antiClone().
virtual ConnectionInterface::shared_ptr RTT::PortInterface::createConnection | ( | BufferBase::shared_ptr | buf | ) | [virtual, inherited] |
Create a new connection object using a buffered connection implementation.
Reimplemented in RTT::Corba::CorbaPort.
DataObjectInterface<T>* RTT::DataPortBase< T >::data | ( | ) | [inline, inherited] |
Get the data object to write to.
The Task may use this to write to a Data Object connected to this port.
Definition at line 115 of file DataPort.hpp.
const DataObjectInterface<T>* RTT::DataPortBase< T >::data | ( | ) | const [inline, inherited] |
Get the data object to read from.
The Task may use this to read from a Data object connection connected to this port.
Definition at line 108 of file DataPort.hpp.
void RTT::ReadDataPort< T >::Get | ( | T & | result | ) | [inline] |
Get the current value of this Port.
result | the variable in which the port value will be stored. |
Definition at line 172 of file DataPort.hpp.
T RTT::ReadDataPort< T >::Get | ( | ) | const [inline] |
Get the current value of this Port.
this->data()->Get() | if this->connected() | |
T() | if !this->connected() |
Definition at line 151 of file DataPort.hpp.
bool RTT::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.
true | if !this->connected(), the name has changed. | |
false | if this->connected(), the name has not been changed. |