YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
InputStream.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_INPUTSTREAM_H
8#define YARP_OS_INPUTSTREAM_H
9
10#include <yarp/conf/numeric.h>
11
12#include <yarp/os/api.h>
13
14#include <string>
15
16namespace yarp::os {
17
18class Bytes;
19
25{
26public:
31
35 virtual ~InputStream();
36
42 virtual void check();
43
50 virtual int read();
51
63 virtual yarp::conf::ssize_t read(Bytes& b, size_t offset, yarp::conf::ssize_t len);
64
74
75
79 virtual yarp::conf::ssize_t partialRead(yarp::os::Bytes& b);
80
84 virtual void close() = 0;
85
90 virtual void interrupt();
91
97 virtual bool isOk() const = 0;
98
103 virtual bool setReadTimeout(double timeout);
104
108 std::string readLine(const char terminal = '\n', bool* success = nullptr);
109
113 yarp::conf::ssize_t readFull(Bytes& b);
114
118 yarp::conf::ssize_t readDiscard(size_t len);
119
124 typedef void (*readEnvelopeCallbackType)(void*, const yarp::os::Bytes& envelope);
125
135 virtual bool setReadEnvelopeCallback(readEnvelopeCallbackType callback, void* data);
136};
137
138} // namespace yarp::os
139
140#endif // YARP_OS_INPUTSTREAM_H
A mini-server for performing network communication in the background.
A simple abstraction for a block of bytes.
Definition Bytes.h:24
Simple specification of the minimum functions needed from input streams.
Definition InputStream.h:25
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
virtual yarp::conf::ssize_t read(yarp::os::Bytes &b)=0
Read a block of data from the stream.
virtual void close()=0
Terminate the stream.
InputStream()
Constructor.
virtual ~InputStream()
Destructor.
::ssize_t ssize_t
Definition numeric.h:86
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition api.h:18