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