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

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 ()=default
 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...

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 22 of file TypedReader.h.

Constructor & Destructor Documentation

◆ ~TypedReader()

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


Member Function Documentation

◆ acquire()

template<class T >
virtual void* yarp::os::TypedReader< T >::acquire ( )
pure virtual

◆ 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.

shouldWaittrue if the method should wait until an object is available, false if the call should return immediately if no message is available
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::PortReaderBuffer< T >, yarp::os::PortReaderBuffer< yarp::sig::VectorOf >, yarp::os::PortReaderBuffer< yarp::os::Bottle >, yarp::os::PortReaderBuffer< yarp::sig::ImageOf< yarp::sig::PixelRgb > >, yarp::os::PortReaderBuffer< yarp::sig::FlexImage >, yarp::os::BufferedPort< T >, yarp::os::BufferedPort< yarp::sig::Vector >, yarp::os::BufferedPort< yarp::sig::VectorOf >, yarp::os::BufferedPort< yarp::dev::impl::jointData >, yarp::os::BufferedPort< SensorStreamingData >, yarp::os::BufferedPort< yarp::sig::ImageOf< yarp::sig::PixelFloat > >, yarp::os::BufferedPort< yarp::os::Bottle >, yarp::os::BufferedPort< return_getAllTransforms >, yarp::os::BufferedPort< JoyData >, yarp::os::BufferedPort< yarp::os::PortablePair >, yarp::os::BufferedPort< yarp::dev::Nav2D::Map2DLocation >, yarp::os::BufferedPort< yarp::sig::FlexImage >, yarp::os::BufferedPort< yarp::dev::LaserScan2D >, yarp::os::BufferedPort< yarp::dev::OdometryData >, yarp::os::BufferedPort< DepthImage >, and yarp::os::BufferedPort< yarp::sig::Sound >.

◆ release()

◆ setReplier()

◆ setStrict()

◆ setTargetPeriod()

◆ useCallback()

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