YARP
Yet Another Robot Platform
InputStream.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_INPUTSTREAM_H
11 #define YARP_OS_INPUTSTREAM_H
12 
13 #include <yarp/conf/numeric.h>
14 
15 #include <yarp/os/api.h>
16 
17 #include <string>
18 
19 namespace yarp {
20 namespace os {
21 
22 class Bytes;
23 
29 {
30 public:
35 
39  virtual ~InputStream();
40 
46  virtual void check();
47 
54  virtual int read();
55 
67  virtual yarp::conf::ssize_t read(Bytes& b, size_t offset, yarp::conf::ssize_t len);
68 
78 
79 
83  virtual yarp::conf::ssize_t partialRead(yarp::os::Bytes& b);
84 
88  virtual void close() = 0;
89 
94  virtual void interrupt();
95 
101  virtual bool isOk() const = 0;
102 
107  virtual bool setReadTimeout(double timeout);
108 
112  std::string readLine(const char terminal = '\n', bool* success = nullptr);
113 
117  yarp::conf::ssize_t readFull(Bytes& b);
118 
122  yarp::conf::ssize_t readDiscard(size_t len);
123 
128  typedef void (*readEnvelopeCallbackType)(void*, const yarp::os::Bytes& envelope);
129 
139  virtual bool setReadEnvelopeCallback(readEnvelopeCallbackType callback, void* data);
140 };
141 
142 } // namespace os
143 } // namespace yarp
144 
145 #endif // YARP_OS_INPUTSTREAM_H
yarp::os::InputStream::~InputStream
virtual ~InputStream()
Destructor.
yarp::sig::file::read
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:827
yarp::os::InputStream::close
virtual void close()=0
Terminate the stream.
numeric.h
api.h
yarp::os::InputStream::InputStream
InputStream()
Constructor.
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::conf::ssize_t
::ssize_t ssize_t
Definition: numeric.h:60
yarp::os::InputStream::isOk
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::InputStream
Simple specification of the minimum functions needed from input streams.
Definition: InputStream.h:29