A Port to a readable Buffer. More...
#include <rtt/BufferPort.hpp>
Inherits RTT::BufferPortBase< T >.
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. | |
typedef Event< void(PortInterface *) | NewDataOnPortEvent ) |
Public Member Functions | |
ReadBufferPort (const std::string &name) | |
Construct an unconnected Port to a readable buffer. | |
bool | Pop (T &data) |
Pop a value from the buffer of this Port's connection. | |
T | front () const |
Get the next value to be Pop()'ed, or the default value if empty. | |
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 |
The anti-Clone of a ReadBufferPort is a WriteBufferPort with prefered buffer size '1'. | |
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 (ConnectionTypes::ConnectionType con_type=ConnectionTypes::lockfree) |
Create a new connection object to which this port is subscribed. | |
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. | |
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 Member Functions | |
virtual bool | connect (typename ConnectionInterface::shared_ptr conn) |
Connect a readable buffer to this Port. | |
Protected Attributes | |
BufferConnection< T >::shared_ptr | mconn |
std::string | portname |
NewDataOnPortEvent * | new_data_on_port_event |
Friends | |
class | ConnectionInterface |
A Port to a readable Buffer.
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 236 of file BufferPort.hpp.
RTT::ReadBufferPort< T >::ReadBufferPort | ( | const std::string & | name | ) | [inline] |
Construct an unconnected Port to a readable buffer.
name | The name of this port. |
Definition at line 247 of file BufferPort.hpp.
virtual BufferInterface<T>* RTT::BufferPortBase< T >::buffer | ( | ) | [inline, virtual, inherited] |
Get the buffer to read from or write to.
Definition at line 189 of file BufferPort.hpp.
BufferBase::size_type RTT::BufferPortBase< T >::capacity | ( | ) | const [inline, inherited] |
Returns the maximum number of items that can be stored in the buffer.
Definition at line 114 of file BufferPort.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 | ( | DataSourceBase::shared_ptr | data | ) | [virtual, inherited] |
Create a new connection object using a data connection implementation.
Reimplemented in RTT::Corba::CorbaPort.
bool RTT::BufferPortBase< T >::empty | ( | ) | const [inline, inherited] |
Check if this buffer is empty.
Definition at line 132 of file BufferPort.hpp.
bool RTT::BufferPortBase< T >::full | ( | ) | const [inline, inherited] |
Check if this buffer is full.
Definition at line 150 of file BufferPort.hpp.
bool RTT::ReadBufferPort< T >::Pop | ( | T & | data | ) | [inline] |
Pop a value from the buffer of this Port's connection.
data | The location where to store the popped value. |
this->buffer()->Pop(data) | if this->connected() | |
false | if !this->connected() |
Definition at line 255 of file BufferPort.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. |
BufferBase::size_type RTT::BufferPortBase< T >::size | ( | ) | const [inline, inherited] |
Returns the actual number of items that are stored in the buffer.
Definition at line 95 of file BufferPort.hpp.