YARP
Yet Another Robot Platform
OutputStream.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_OUTPUTSTREAM_H
8 #define YARP_OS_OUTPUTSTREAM_H
9 
10 #include <yarp/os/api.h>
11 
12 namespace yarp {
13 namespace os {
14 
15 class Bytes;
16 
22 {
23 public:
27  virtual ~OutputStream();
28 
35  virtual void write(char ch);
36 
45  virtual void write(const Bytes& b, int offset, int len);
46 
52  virtual void write(const yarp::os::Bytes& b) = 0;
53 
57  virtual void close() = 0;
58 
62  virtual void flush();
63 
70  virtual void writeLine(const char* data, int len);
71 
77  virtual bool isOk() const = 0;
78 
83  virtual bool setWriteTimeout(double timeout);
84 
85  /*
86  * Set the Type Of Service field of all outgoing packets.
87  * @return true iff the TOS is set.
88  */
89  virtual bool setTypeOfService(int tos);
90 
91  /*
92  * Get the Type Of Service field of all outgoing packets.
93  * @return the TOS byte or -1 if not implemented.
94  */
95  virtual int getTypeOfService();
96 };
97 
98 
99 } // namespace os
100 } // namespace yarp
101 
102 #endif // YARP_OS_OUTPUTSTREAM_H
A simple abstraction for a block of bytes.
Definition: Bytes.h:25
Simple specification of the minimum functions needed from output streams.
Definition: OutputStream.h:22
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
virtual void write(const yarp::os::Bytes &b)=0
Write a block of bytes to the stream.
virtual ~OutputStream()
Destructor.
virtual void close()=0
Terminate the stream.
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1099
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18