YARP
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 >:

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 69 of file PortWriterBuffer.h.

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...
 
virtual PortWriterWrapper * create (PortWriterBufferManager &man, void *tracker) override
 
- Public Member Functions inherited from yarp::os::PortWriterBufferBase
 PortWriterBufferBase ()
 
virtual ~PortWriterBufferBase ()
 
const void * getContent () const
 
bool releaseContent ()
 
int getCount ()
 
void attach (Port &port)
 
void detach ()
 
void write (bool strict)
 
void waitForWrite ()
 

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 125 of file PortWriterBuffer.h.

◆ create()

template<class T >
virtual PortWriterWrapper* yarp::os::PortWriterBuffer< T >::create ( PortWriterBufferManager &  man,
void *  tracker 
)
inlineoverridevirtual

Implements yarp::os::PortWriterBufferBase.

Definition at line 146 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 102 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 116 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 81 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 93 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 141 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 133 of file PortWriterBuffer.h.


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