#include <rtt/BufferPort.hpp>
Inherits RTT::BufferPortBase< T >.
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 324 of file BufferPort.hpp.
Public Types | |
| 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. | |
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. | |
| 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. | |
| virtual PortInterface::PortType | getPortType () const |
| Get the PortType of this 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. | |
| 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. | |
| virtual ConnectionModel | getConnectionModel () const |
| virtual const TypeInfo * | getTypeInfo () const |
| bool | connected () const |
| void | disconnect () |
| bool | connectTo (ConnectionInterface::shared_ptr other) |
| virtual bool | connectTo (PortInterface *other) |
| Connect to another Port and create a new connection if necessary. | |
| virtual BufferInterface< T > * | buffer () |
| Get the buffer to read from or write to. | |
|
virtual const BufferInterface < T > * | buffer () const |
|
virtual ConnectionInterface::shared_ptr | connection () const |
| ConnectionInterface::shared_ptr | createConnection (BufferBase::shared_ptr impl) |
| virtual ConnectionInterface::shared_ptr | createConnection (DataSourceBase::shared_ptr data) |
| Create a new connection object using a data connection implementation. | |
| 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 int | serverProtocol () const |
| Returns the protocol over which this port can be accessed. | |
Protected Member Functions | |
| virtual bool | connect (typename ConnectionInterface::shared_ptr conn) |
| Connect a readable buffer to this Port. | |
Protected Attributes | |
| size_t | buf_size |
| T | minitial_value |
| BufferConnection< T >::shared_ptr | mconn |
| std::string | portname |
Friends | |
| class | ConnectionInterface |
| 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 341 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 349 of file BufferPort.hpp.
| bool Push | ( | const T & | data | ) | [inline] |
Push a value into the buffer of this Port's connection.
| data | The data to push. |
| this->buffer()->Push(data) | if this->connected() | |
| false | if !this->connected() |
Definition at line 357 of file BufferPort.hpp.
| 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 378 of file BufferPort.hpp.
| BufferBase::size_type size | ( | ) | const [inline, inherited] |
Returns the actual number of items that are stored in the buffer.
Definition at line 100 of file BufferPort.hpp.
| BufferBase::size_type capacity | ( | ) | const [inline, inherited] |
Returns the maximum number of items that can be stored in the buffer.
Definition at line 119 of file BufferPort.hpp.
| bool empty | ( | ) | const [inline, inherited] |
Check if this buffer is empty.
Definition at line 137 of file BufferPort.hpp.
| bool full | ( | ) | const [inline, inherited] |
Check if this buffer is full.
Definition at line 155 of file BufferPort.hpp.
| bool connectTo | ( | PortInterface * | other | ) | [virtual, inherited] |
Connect to another Port and create a new connection if necessary.
Definition at line 71 of file PortInterface.cpp.
References PortInterface::antiClone(), PortInterface::connect(), PortInterface::connection(), PortInterface::connectTo(), PortInterface::createConnection(), PortInterface::disconnect(), PortInterface::getPortType(), PortInterface::ready(), and PortInterface::serverProtocol().
| virtual BufferInterface<T>* buffer | ( | ) | [inline, virtual, inherited] |
Get the buffer to read from or write to.
Definition at line 194 of file BufferPort.hpp.
| ConnectionInterface::shared_ptr createConnection | ( | DataSourceBase::shared_ptr | data | ) | [virtual, inherited] |
Create a new connection object using a data connection implementation.
Reimplemented in CorbaPort.
Definition at line 192 of file PortInterface.cpp.
| 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().
1.5.6