YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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
8
9#include <yarp/os/Bytes.h>
10
11
13
15{
16 write(yarp::os::Bytes(&ch, 1));
17}
18
19void 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
28
29void yarp::os::OutputStream::writeLine(const char* data, int len)
30{
31 yarp::os::Bytes b((char*)data, len);
32 write(b);
33 write('\n');
35
37{
38 YARP_UNUSED(timeout);
39 return false;
40}
41
43{
45 return false;
46}
47
49{
50 return -1;
51}
A mini-server for performing network communication in the background.
A simple abstraction for a block of bytes.
Definition Bytes.h:24
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.
#define YARP_UNUSED(var)
Definition api.h:162