#include <rtt/BufferPort.hpp>

Use connection() to access the buffer. If the port is not connected, connection() returns null.
| T | The type of the data of the buffer. |
Definition at line 233 of file BufferPort.hpp.
Public Types | |
| enum | PortType { ReadPort, WritePort, ReadWritePort } |
| This enum classifies if a port is inbound outbound or both. More... | |
Public Member Functions | |
| WriteBufferPort (const std::string &name, size_t preferred_size, const T &initial_value=T()) | |
| Construct an unconnected Port to a writeable buffer. | |
| ~WriteBufferPort () | |
| void | setBufferSize (size_t b_size) |
| Set the prefered buffersize before this port is connected. | |
| bool | Push (const T &data) |
| Push a value into the buffer of this Port's connection. | |
| void | Set (const T &data) |
| Set the initial value of the port's connection. | |
| void | clear () |
| Clears all contents of this buffer. | |
| BufferBase::size_type | size () const |
| Returns the actual number of items that are stored in the buffer. | |
| BufferBase::size_type | capacity () const |
| Returns the maximum number of items that can be stored in the buffer. | |
| bool | empty () const |
| Check if this buffer is empty. | |
| bool | full () const |
| Check if this buffer is full. | |
| bool | connected () const |
| Inspect if this Port is currently connected with another Port. | |
| virtual bool | connect (typename WriteConnectionInterface< T >::shared_ptr conn) |
| Connect a writeable buffer to this Port. | |
| bool | connectTo (ConnectionInterface::shared_ptr other) |
| Connect this port to a Connection. | |
| void | disconnect () |
| No longer participate in a connection. | |
| virtual WriteInterface< T > * | write () const |
| Get the buffer to write to. | |
| virtual ConnectionInterface::shared_ptr | connection () const |
| Returns the connection in which this Port currently participates. | |
| virtual PortType | getPortType () const |
| Get the PortType of this port. | |
| virtual const TypeInfo * | getTypeInfo () const |
| Get the data type of this port. | |
| WriteBufferPort & | operator= (BufferInterface< T > *impl) |
| Provide a new implementation for the connection of this port. | |
| ConnectionInterface::shared_ptr | createConnection (PortInterface *other, ConnectionTypes::ConnectionType con_type=ConnectionTypes::lockfree) |
| Create a connection object from this port to another port. | |
| ConnectionInterface::shared_ptr | createConnection (ConnectionTypes::ConnectionType con_type=ConnectionTypes::lockfree) |
| Create a new connection object to which this port is subscribed. | |
| 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. | |
| 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. | |
| virtual bool | connectTo (PortInterface *other) |
| Connect to another Port and create a new connection if necessary. | |
| virtual int | serverProtocol () const |
| Returns the protocol over which this port can be accessed. | |
Protected Attributes | |
|
WriteConnectionInterface < T >::shared_ptr | mconn |
| The buffer to write from. | |
| size_t | buf_size |
| T | minitial_value |
| std::string | portname |
enum PortType [inherited] |
This enum classifies if a port is inbound outbound or both.
Reimplemented in BufferPort.
Definition at line 65 of file PortInterface.hpp.
| WriteBufferPort | ( | const std::string & | name, | |
| size_t | preferred_size, | |||
| const T & | initial_value = T() | |||
| ) | [inline] |
Construct an unconnected Port to a writeable buffer.
| name | The name of this port. | |
| initial_value | The initial value of this port's connection when the connection is created. If this port is connected to an existing connection, this value is ignored. |
Definition at line 253 of file BufferPort.hpp.
| void setBufferSize | ( | size_t | b_size | ) | [inline] |
Set the prefered buffersize before this port is connected.
If this->connected(), this value has no effect.
Definition at line 266 of file BufferPort.hpp.
References WriteBufferPort::buf_size.
| bool Push | ( | const T & | data | ) | [inline] |
Push a value into the buffer of this Port's connection.
| data | The data to push. |
| this->read()->Push(data) | if this->connected() | |
| false | if !this->connected() |
Definition at line 274 of file BufferPort.hpp.
References WriteBufferPort::mconn.
| void Set | ( | const T & | data | ) | [inline] |
Set the initial value of the port's connection.
This value is only used when the connection is created. If this port is connected to an existing connection, the value is ignored.
Definition at line 287 of file BufferPort.hpp.
References WriteBufferPort::minitial_value.
| BufferBase::size_type size | ( | ) | const [inline] |
Returns the actual number of items that are stored in the buffer.
Reimplemented in BufferPort.
Definition at line 305 of file BufferPort.hpp.
References WriteBufferPort::mconn.
| BufferBase::size_type capacity | ( | ) | const [inline] |
Returns the maximum number of items that can be stored in the buffer.
Reimplemented in BufferPort.
Definition at line 316 of file BufferPort.hpp.
References WriteBufferPort::mconn.
| bool empty | ( | ) | const [inline] |
Check if this buffer is empty.
Reimplemented in BufferPort.
Definition at line 326 of file BufferPort.hpp.
References WriteBufferPort::mconn.
| bool full | ( | ) | const [inline] |
Check if this buffer is full.
Reimplemented in BufferPort.
Definition at line 336 of file BufferPort.hpp.
References WriteBufferPort::mconn.
| bool connectTo | ( | ConnectionInterface::shared_ptr | conn | ) | [inline, virtual] |
Connect this port to a Connection.
If the connection is in the connected() state, this port will participate in that connection, otherwise, the port will become connected once conn becomes connected().
Implements PortInterface.
Reimplemented in BufferPort.
Definition at line 355 of file BufferPort.hpp.
References WriteBufferPort::mconn.
Referenced by WriteBufferPort::operator=().
| virtual WriteInterface<T>* write | ( | ) | const [inline, virtual] |
Get the buffer to write to.
Definition at line 367 of file BufferPort.hpp.
References WriteBufferPort::mconn.
| virtual ConnectionInterface::shared_ptr connection | ( | ) | const [inline, virtual] |
Returns the connection in which this Port currently participates.
It is possible that this port is part of a dormant connection, ( the connection object is not in the connected() state), in that case this method will return null, until the dormant connection becomes connected().
| null | if not connected to another Port. |
Implements PortInterface.
Reimplemented in BufferPort.
Definition at line 369 of file BufferPort.hpp.
References WriteBufferPort::mconn.
Referenced by ConnectionFactory::createBuffer().
| WriteBufferPort< T > & operator= | ( | BufferInterface< T > * | impl | ) | [inline] |
Provide a new implementation for the connection of this port.
If this port is not connected, a new connection is created.
Reimplemented in BufferPort.
Definition at line 635 of file BufferPort.hpp.
References WriteBufferPort::connectTo(), and WriteBufferPort::mconn.
| bool 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. |
Definition at line 50 of file PortInterface.cpp.
References PortInterface::connected(), and PortInterface::portname.
| bool ready | ( | ) | const [inherited] |
Returns true if this Port is ready to be used.
Identical to connected().
Definition at line 59 of file PortInterface.cpp.
References PortInterface::connected().
Referenced by DataPort::createPortObject(), WriteDataPort::createPortObject(), ReadDataPort::createPortObject(), BufferPort::createPortObject(), WriteBufferPort::createPortObject(), and ReadBufferPort::createPortObject().
| bool connectTo | ( | PortInterface * | other | ) | [virtual, inherited] |
Connect to another Port and create a new connection if necessary.
Definition at line 63 of file PortInterface.cpp.
References PortInterface::antiClone(), PortInterface::connection(), PortInterface::connectTo(), PortInterface::createConnection(), PortInterface::disconnect(), and RTT::Warning.
1.5.3