YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
TypedReader.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_TYPEDREADER_H
8#define YARP_OS_TYPEDREADER_H
9
10
12
13
14namespace yarp::os {
15
20template <class T>
22{
23public:
32 virtual void setStrict(bool strict = true) = 0;
33
46 virtual T* read(bool shouldWait = true) = 0;
47
51 virtual void interrupt() = 0;
52
58 virtual T* lastRead() = 0;
59
65 virtual bool isClosed() = 0;
66
72 virtual void useCallback(TypedReaderCallback<T>& callback) = 0;
73
77 virtual void disableCallback() = 0;
78
83 virtual int getPendingReads() = 0;
84
88 virtual ~TypedReader() = default;
89
94 virtual std::string getName() const = 0;
95
96
104 virtual void setReplier(PortReader& reader) = 0;
105
106
118 virtual void* acquire() = 0;
119
120
128 virtual void release(void* handle) = 0;
129
130
139 virtual void setTargetPeriod(double period) = 0;
140};
141
142} // namespace yarp::os
143
144#endif // YARP_OS_TYPEDREADER_H
A mini-server for performing network communication in the background.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
A base class for sources of typed data.
Definition TypedReader.h:22
virtual void setReplier(PortReader &reader)=0
If a message is received that requires a reply, use this handler.
virtual void setStrict(bool strict=true)=0
Call this to strictly keep all messages, or allow old ones to be quietly dropped.
virtual void * acquire()=0
Take control of the last object read.
virtual void disableCallback()=0
Remove a callback set up with useCallback()
virtual void interrupt()=0
Abort any read operation currently in progress.
virtual std::string getName() const =0
Get name of port being read from.
virtual void release(void *handle)=0
Return control to YARP of an object previously taken control of with the acquire() method.
virtual int getPendingReads()=0
Check how many messages are waiting to be read.
virtual bool isClosed()=0
Returns whether the port associated with this reader has been closed.
virtual T * lastRead()=0
Get the last data returned by read()
virtual void useCallback(TypedReaderCallback< T > &callback)=0
Set an object whose onRead method will be called when data is available.
virtual ~TypedReader()=default
Destructor.
virtual void setTargetPeriod(double period)=0
Try to provide data periodically.
virtual T * read(bool shouldWait=true)=0
Read an available object from the port.
An interface to the operating system, including Port based communication.