YARP
Yet Another Robot Platform
yarp::os::TypedReader< T > Class Template Referenceabstract

A base class for sources of typed data. More...

#include <yarp/os/TypedReader.h>

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

Detailed Description

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

A base class for sources of typed data.

This could be a BufferedPort or a PortReaderBuffer.

Definition at line 25 of file TypedReader.h.

Public Member Functions

virtual void setStrict (bool strict=true)=0
 Call this to strictly keep all messages, or allow old ones to be quietly dropped. More...
 
virtual T * read (bool shouldWait=true)=0
 Read an available object from the port. More...
 
virtual void interrupt ()=0
 Abort any read operation currently in progress. More...
 
virtual T * lastRead ()=0
 Get the last data returned by read() More...
 
virtual bool isClosed ()=0
 Returns whether the port associated with this reader has been closed. More...
 
virtual void useCallback (TypedReaderCallback< T > &callback)=0
 Set an object whose onRead method will be called when data is available. More...
 
virtual void disableCallback ()=0
 Remove a callback set up with useCallback() More...
 
virtual int getPendingReads ()=0
 Check how many messages are waiting to be read. More...
 
virtual ~TypedReader ()
 Destructor. More...
 
virtual std::string getName () const =0
 Get name of port being read from. More...
 
virtual void setReplier (PortReader &reader)=0
 If a message is received that requires a reply, use this handler. More...
 
virtual void * acquire ()=0
 Take control of the last object read. More...
 
virtual void release (void *handle)=0
 Return control to YARP of an object previously taken control of with the acquire() method. More...
 
virtual void setTargetPeriod (double period)=0
 Try to provide data periodically. More...
 

Constructor & Destructor Documentation

◆ ~TypedReader()

template<class T>
virtual yarp::os::TypedReader< T >::~TypedReader ( )
inlinevirtual

Destructor.

Definition at line 92 of file TypedReader.h.

Member Function Documentation

◆ acquire()

◆ disableCallback()

◆ getName()

◆ getPendingReads()

◆ interrupt()

◆ isClosed()

◆ lastRead()

◆ read()

template<class T>
virtual T* yarp::os::TypedReader< T >::read ( bool  shouldWait = true)
pure virtual

Read an available object from the port.

Parameters
shouldWaittrue if the method should wait until an object is available, false if the call should return immediately if no message is available
Returns
A pointer to an object read from the port, or nullptr if none is available and waiting was not requested. This object is owned by the communication system and should not be deleted by the user. The object is available to the user until the next call to one of the read methods, after which it should not be accessed again.

Implemented in yarp::os::BufferedPort< T >, yarp::os::BufferedPort< ImageType >, yarp::os::BufferedPort< jointData >, yarp::os::BufferedPort< yarp::sig::ImageOf< yarp::sig::PixelFloat > >, yarp::os::BufferedPort< yarp::sig::VectorOf >, yarp::os::BufferedPort< yarp::os::Bottle >, yarp::os::BufferedPort< SensorStreamingData >, yarp::os::BufferedPort< VectorOf< unsigned char > >, yarp::os::BufferedPort< yarp::sig::FlexImage >, yarp::os::PortReaderBuffer< T >, yarp::os::PortReaderBuffer< Bottle >, yarp::os::PortReaderBuffer< ImageType >, yarp::os::PortReaderBuffer< jointData >, yarp::os::PortReaderBuffer< yarp::sig::ImageOf< yarp::sig::PixelFloat > >, yarp::os::PortReaderBuffer< yarp::sig::VectorOf >, yarp::os::PortReaderBuffer< yarp::os::Bottle >, yarp::os::PortReaderBuffer< SensorStreamingData >, yarp::os::PortReaderBuffer< VectorOf< unsigned char > >, yarp::os::PortReaderBuffer< yarp::sig::ImageOf< yarp::sig::PixelRgb > >, and yarp::os::PortReaderBuffer< yarp::sig::FlexImage >.

◆ release()

◆ setReplier()

◆ setStrict()

◆ setTargetPeriod()

◆ useCallback()


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