RTT::BufferConnection< T > Class Template Reference

A local connection with a Buffer, which is used to connect multiple Ports to that Buffer. More...

#include <rtt/BufferConnection.hpp>

Inheritance diagram for RTT::BufferConnection< T >:
RTT::ConnectionInterface

List of all members.

Public Types

typedef boost::intrusive_ptr
< BufferConnection
shared_ptr

Public Member Functions

 BufferConnection (typename BufferInterface< T >::shared_ptr bufi)
 Create an BufferConnection with initially no readers and no writers.
 ~BufferConnection ()
 The cleanup of BufferConnection does nothing.
virtual DataSourceBase::shared_ptr getDataSource () const
 Get a Data source representing the current value of this connection.
virtual BufferBase::shared_ptr getBuffer () const
 Returns the buffer and its associated status of this connection, if this connection is buffered.
virtual const TypeInfogetTypeInfo () const
 Get the data type of this port.
void setImplementation (BufferInterface< T > *bufi)
BufferInterface< T > * buffer ()
virtual bool connect ()
 Connect all readers and writers.
virtual bool connected () const
 Get Connection status.
virtual bool disconnect ()
 Disconnect all readers and writers.
virtual bool addPort (PortInterface *p)
 Add a Port to the connection.
virtual bool removePort (PortInterface *p)
 Remove a Port from the connection.
virtual int serverProtocol () const
 Returns the protocol over which this connection can be accessed.
void signal ()
 Signals that a new data sample has been written on this connection.
std::string getConnectionName ()
 Return the name of this connection if available.
void setConnectionName (std::string newConnectionName)
 Set a new name for this connection.
PList getPortList ()
 Accessibility method to return all the port list associated with this connection.

Protected Types

typedef std::vector
< PortInterface * > 
PList

Protected Member Functions

friend void::intrusive_ptr_add_ref (ConnectionInterface *p)
friend void::intrusive_ptr_release (ConnectionInterface *p)

Protected Attributes

OS::AtomicInt refcount
PList ports
bool mconnected
std::string connectionName

Detailed Description

template<class T>
class RTT::BufferConnection< T >

A local connection with a Buffer, which is used to connect multiple Ports to that Buffer.

See also:
ConnectionInterface why connection management is not thread-safe in this class.

Definition at line 53 of file BufferConnection.hpp.


Constructor & Destructor Documentation

template<class T>
RTT::BufferConnection< T >::~BufferConnection (  )  [inline]

The cleanup of BufferConnection does nothing.

The only cause of deletion is that no Port holds a pointer to this connection (refcount becomes zero), hence, all readers and writers are already disconnected.

Definition at line 65 of file BufferConnection.hpp.


Member Function Documentation

virtual bool RTT::ConnectionInterface::addPort ( PortInterface p  )  [virtual, inherited]

Add a Port to the connection.

If this->connected(), also immediately connect p to this connection.

Parameters:
p A port which wants to read or write data from this connection.
Returns:
true if p has the correct type and could be added
virtual bool RTT::ConnectionInterface::connect (  )  [virtual, inherited]

Connect all readers and writers.

If a reader or writer is already connected to another connection, this method fails.

Returns:
false if at least one reader or writer was already participating in a connection or if connected()
template<class T>
virtual BufferBase::shared_ptr RTT::BufferConnection< T >::getBuffer (  )  const [inline, virtual]

Returns the buffer and its associated status of this connection, if this connection is buffered.

Otherwise, this returns the null pointer.

Implements RTT::ConnectionInterface.

Definition at line 71 of file BufferConnection.hpp.

std::string RTT::ConnectionInterface::getConnectionName (  )  [inherited]

Return the name of this connection if available.

Returns:
the name of the connection
template<class T>
virtual DataSourceBase::shared_ptr RTT::BufferConnection< T >::getDataSource (  )  const [inline, virtual]

Get a Data source representing the current value of this connection.

This function always returns a meaningful data source.

Implements RTT::ConnectionInterface.

Definition at line 67 of file BufferConnection.hpp.

PList RTT::ConnectionInterface::getPortList (  )  [inherited]

Accessibility method to return all the port list associated with this connection.

Returns:
the port list for this connection
virtual bool RTT::ConnectionInterface::removePort ( PortInterface p  )  [virtual, inherited]

Remove a Port from the connection.

If this->connected(), also immediately disconnect p from this connection.

Parameters:
p A port which no longer wants to read or write data from this connection.
Returns:
true if p was present.
void RTT::ConnectionInterface::setConnectionName ( std::string  newConnectionName  )  [inherited]

Set a new name for this connection.

Parameters:
newConnectionName The new name to be set for this connection.
void RTT::ConnectionInterface::signal (  )  [inherited]

Signals that a new data sample has been written on this connection.

This is to be called by source ports when new data is written on the connection


The documentation for this class was generated from the following file:
Generated on Thu Dec 23 13:22:39 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3