YARP
Yet Another Robot Platform
OutputStream.cpp
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 #include <yarp/os/OutputStream.h>
8 
9 #include <yarp/os/Bytes.h>
10 
11 
13 
15 {
16  write(yarp::os::Bytes(&ch, 1));
17 }
18 
19 void yarp::os::OutputStream::write(const Bytes& b, int offset, int len)
20 {
21  const yarp::os::Bytes bytes(const_cast<char*>(b.get()) + offset, len);
22  write(bytes);
23 }
24 
26 {
27 }
28 
29 void yarp::os::OutputStream::writeLine(const char* data, int len)
30 {
31  yarp::os::Bytes b((char*)data, len);
32  write(b);
33  write('\n');
34 }
35 
37 {
38  YARP_UNUSED(timeout);
39  return false;
40 }
41 
43 {
44  YARP_UNUSED(tos);
45  return false;
46 }
47 
49 {
50  return -1;
51 }
A simple abstraction for a block of bytes.
Definition: Bytes.h:25
const char * get() const
Definition: Bytes.cpp:27
virtual void flush()
Make sure all pending write operations are finished.
virtual bool setWriteTimeout(double timeout)
Set activity timeout.
virtual int getTypeOfService()
virtual void write(char ch)
Write a single byte to the stream.
virtual void writeLine(const char *data, int len)
Write some text followed by a line feed.
virtual bool setTypeOfService(int tos)
virtual ~OutputStream()
Destructor.
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1099
#define YARP_UNUSED(var)
Definition: api.h:162