ReadBufferPort Class Template Reference
[Data Transfer Ports]

#include <rtt/BufferPort.hpp>

Inheritance diagram for ReadBufferPort:

PortInterface BufferPort

List of all members.


Detailed Description

template<class T>
class RTT::ReadBufferPort< T >

A Port to a readable Buffer.

Use connection() to access the buffer. If the port is not connected, connection() returns null.

Parameters:
T The type of the data of the buffer.

Definition at line 58 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

 ReadBufferPort (const std::string &name)
 Construct an unconnected Port to a readable buffer.
 ~ReadBufferPort ()
bool Pop (T &data)
 Pop a value from the buffer of this Port's connection.
front () const
 Get the next value to be Pop()'ed, or the default value if empty.
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 PortType getPortType () const
 Get the PortType of this port.
virtual const TypeInfogetTypeInfo () const
 Get the data type of this port.
ReadBufferPortoperator= (BufferInterface< T > *impl)
 Provide a new implementation for the connection of this port.
bool connected () const
 Inspect if this Port is currently connected with another Port.
virtual bool connect (typename ReadConnectionInterface< T >::shared_ptr conn)
 Connect a readable buffer to this Port.
void disconnect ()
 No longer participate in a connection.
bool connectTo (ConnectionInterface::shared_ptr other)
 Connect this port to a Connection.
virtual
ReadInterface< T > * 
read () const
 Get the buffer to read from.
virtual
ConnectionInterface::shared_ptr 
connection () const
 Returns the connection in which this Port currently participates.
virtual PortInterfaceclone () const
 Create a clone of this port with the same name.
virtual PortInterfaceantiClone () const
 The anti-Clone of a ReadBufferPort is a WriteBufferPort with prefered buffer size '1'.
virtual TaskObjectcreatePortObject ()
 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
ConnectionInterface::shared_ptr 
createConnection (PortInterface *other, ConnectionTypes::ConnectionType con_type=ConnectionTypes::lockfree)
 Create a connection object from this port to another port.
virtual
ConnectionInterface::shared_ptr 
createConnection (ConnectionTypes::ConnectionType con_type=ConnectionTypes::lockfree)
 Create a new connection object to which this port is subscribed.
virtual int serverProtocol () const
 Returns the protocol over which this port can be accessed.

Protected Attributes

ReadConnectionInterface
< T >::shared_ptr 
mconn
std::string portname

Member Enumeration Documentation

enum PortType [inherited]

This enum classifies if a port is inbound outbound or both.

Enumerator:
ReadPort 
WritePort 
ReadWritePort 

Reimplemented in BufferPort.

Definition at line 65 of file PortInterface.hpp.


Constructor & Destructor Documentation

ReadBufferPort ( const std::string &  name  )  [inline]

Construct an unconnected Port to a readable buffer.

Parameters:
name The name of this port.

Definition at line 68 of file BufferPort.hpp.


Member Function Documentation

bool Pop ( T &  data  )  [inline]

Pop a value from the buffer of this Port's connection.

Parameters:
data The location where to store the popped value.
Return values:
this->read()->Pop(data) if this->connected()
false if !this->connected()

Definition at line 81 of file BufferPort.hpp.

References ReadBufferPort::mconn.

BufferBase::size_type size (  )  const [inline]

Returns the actual number of items that are stored in the buffer.

Returns:
number of items.

Reimplemented in BufferPort.

Definition at line 111 of file BufferPort.hpp.

References ReadBufferPort::mconn.

BufferBase::size_type capacity (  )  const [inline]

Returns the maximum number of items that can be stored in the buffer.

Returns:
maximum number of items.

Reimplemented in BufferPort.

Definition at line 122 of file BufferPort.hpp.

References ReadBufferPort::mconn.

bool empty (  )  const [inline]

Check if this buffer is empty.

Returns:
true if size() == 0

Reimplemented in BufferPort.

Definition at line 132 of file BufferPort.hpp.

References ReadBufferPort::mconn.

bool full (  )  const [inline]

Check if this buffer is full.

Returns:
true if size() == capacity()

Reimplemented in BufferPort.

Definition at line 142 of file BufferPort.hpp.

References ReadBufferPort::mconn.

ReadBufferPort< 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 623 of file BufferPort.hpp.

References ReadBufferPort::connectTo(), and ReadBufferPort::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().

Returns:
true if connection was possible, false otherwise.

Implements PortInterface.

Reimplemented in BufferPort.

Definition at line 175 of file BufferPort.hpp.

References ReadBufferPort::mconn.

Referenced by ReadBufferPort::operator=().

virtual ReadInterface<T>* read (  )  const [inline, virtual]

Get the buffer to read from.

The Task may use this to read from a Buffer connected to this port.

Returns:
0 if !connected(), the buffer otherwise.

Definition at line 184 of file BufferPort.hpp.

References ReadBufferPort::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().

Return values:
null if not connected to another Port.

Implements PortInterface.

Reimplemented in BufferPort.

Definition at line 186 of file BufferPort.hpp.

References ReadBufferPort::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.

Return values:
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.


The documentation for this class was generated from the following file:
Generated on Tue Mar 25 17:41:53 2008 for OrocosReal-TimeToolkit by  doxygen 1.5.3