YARP  2.3.68+228-20170410.2+git7d0b2e0
Yet Another Robot Platform
yarp::os::PortWriterBuffer< T > Class Template Reference

Buffer outgoing data to a port. More...

#include <yarp/os/PortWriterBuffer.h>

+ Inheritance diagram for yarp::os::PortWriterBuffer< T >:

Public Member Functions

T & prepare ()
 Access the object which will be transmitted by the next call to PortWriterBuffer::write. More...
 
bool unprepare ()
 Give the last prepared object back to YARP without writing it. More...
 
T & get ()
 A synonym of PortWriterBuffer::prepare. More...
 
int getCount ()
 Check the number of buffers currently in use for communication. More...
 
void attach (Port &port)
 Set the Port to which objects will be written. More...
 
void write (bool forceStrict=false)
 Try to write the last buffer returned by PortWriterBuffer::get. More...
 
void waitForWrite ()
 Wait until any pending writes are done. More...
 

Detailed Description

template<class T>
class yarp::os::PortWriterBuffer< T >

Buffer outgoing data to a port.

An instance of this class can be associated with a Port by calling attach(). "T" should be a PortWriter class, such as Bottle.

Definition at line 15 of file PortWriterBuffer.h.

Member Function Documentation

◆ attach()

template<class T>
void yarp::os::PortWriterBuffer< T >::attach ( Port port)
inline

Set the Port to which objects will be written.

Parameters
portthe Port to which objects will be written

Definition at line 167 of file PortWriterBuffer.h.

◆ get()

template<class T>
T& yarp::os::PortWriterBuffer< T >::get ( )
inline

A synonym of PortWriterBuffer::prepare.

Returns
the next object that will be written

Definition at line 146 of file PortWriterBuffer.h.

◆ getCount()

template<class T>
int yarp::os::PortWriterBuffer< T >::getCount ( )
inline

Check the number of buffers currently in use for communication.

This may increase as PortWriterBuffer::read is called. It can decrease at any time as buffers are successfully transmitted and made available for reuse.

Returns
the number of buffers in use for communication.

Definition at line 159 of file PortWriterBuffer.h.

◆ prepare()

template<class T>
T& yarp::os::PortWriterBuffer< T >::prepare ( )
inline

Access the object which will be transmitted by the next call to PortWriterBuffer::write.

The object can safely be modified by the user of this class, to prepare it. Extra objects will be created or reused as necessary depending on the state of communication with the output(s) of the port.

Returns
the next object that will be written

Definition at line 127 of file PortWriterBuffer.h.

◆ unprepare()

template<class T>
bool yarp::os::PortWriterBuffer< T >::unprepare ( )
inline

Give the last prepared object back to YARP without writing it.

Returns
true if there was a prepared object to return.

Definition at line 138 of file PortWriterBuffer.h.

◆ waitForWrite()

template<class T>
void yarp::os::PortWriterBuffer< T >::waitForWrite ( )
inline

Wait until any pending writes are done.

Definition at line 181 of file PortWriterBuffer.h.

◆ write()

template<class T>
void yarp::os::PortWriterBuffer< T >::write ( bool  forceStrict = false)
inline

Try to write the last buffer returned by PortWriterBuffer::get.

Definition at line 174 of file PortWriterBuffer.h.


The documentation for this class was generated from the following file: