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
12namespace yarp::os {
13
14class Bytes;
15
21{
22public:
26 virtual ~OutputStream();
27
34 virtual void write(char ch);
35
44 virtual void write(const Bytes& b, int offset, int len);
45
51 virtual void write(const yarp::os::Bytes& b) = 0;
52
56 virtual void close() = 0;
57
61 virtual void flush();
62
69 virtual void writeLine(const char* data, int len);
70
76 virtual bool isOk() const = 0;
77
82 virtual bool setWriteTimeout(double timeout);
83
84 /*
85 * Set the Type Of Service field of all outgoing packets.
86 * @return true iff the TOS is set.
87 */
88 virtual bool setTypeOfService(int tos);
89
90 /*
91 * Get the Type Of Service field of all outgoing packets.
92 * @return the TOS byte or -1 if not implemented.
93 */
94 virtual int getTypeOfService();
95};
96
97
98} // namespace yarp::os
99
100#endif // YARP_OS_OUTPUTSTREAM_H
A simple abstraction for a block of bytes.
Definition: Bytes.h:24
Simple specification of the minimum functions needed from output streams.
Definition: OutputStream.h:21
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.
An interface to the operating system, including Port based communication.
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1091
#define YARP_os_API
Definition: api.h:18